Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wasm-builder): switch to new wasm32v1-none target #4407

Merged
merged 71 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
1d541b3
chore: bump rust version to latest nightly
StackOverflowExcept1on Dec 14, 2024
5a16b0f
fix tests
StackOverflowExcept1on Dec 14, 2024
b290d72
switch to `wasm32v1-none` target
StackOverflowExcept1on Dec 14, 2024
d7ba5ea
temporarily switch to beta rust instead of stable
StackOverflowExcept1on Dec 14, 2024
f083676
fix anyhow features in utils/node-wrapper
StackOverflowExcept1on Dec 14, 2024
ee4490b
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Dec 15, 2024
0d73df0
remove TODOs
StackOverflowExcept1on Dec 16, 2024
c450f77
fix static_mut_refs warning with gcore::{static_mut, static_ref} macros
StackOverflowExcept1on Dec 16, 2024
83004c8
fix wait_state_machine test
StackOverflowExcept1on Dec 16, 2024
0af7df8
fix semver in utils/crates-io
StackOverflowExcept1on Dec 16, 2024
c05cf17
switch to rust 2024 edition
StackOverflowExcept1on Dec 16, 2024
f39eb7b
fix fmt
StackOverflowExcept1on Dec 16, 2024
76004be
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Dec 16, 2024
ebe30af
link_section -> unsafe(link_section)
StackOverflowExcept1on Dec 16, 2024
0e51b62
2021 -> 2024
StackOverflowExcept1on Dec 16, 2024
d67b957
update cagro_metadata and cargo_toml
StackOverflowExcept1on Dec 16, 2024
b54e2d5
fix gear-wasm-builder
StackOverflowExcept1on Dec 16, 2024
8e39e90
idk how to fix it rn
StackOverflowExcept1on Dec 16, 2024
3559052
beta -> nightly-2024-12-14 (temp)
StackOverflowExcept1on Dec 16, 2024
733c263
temp ignore doc tests
StackOverflowExcept1on Dec 17, 2024
01d5a97
fix test in gmeta
StackOverflowExcept1on Dec 17, 2024
d3d4ddb
Revert "2021 -> 2024"
StackOverflowExcept1on Dec 17, 2024
e2157e8
switch back to 2021 edition and rollback fmt
StackOverflowExcept1on Dec 17, 2024
f08d3ca
revert gtest and gmeta fixes
StackOverflowExcept1on Dec 17, 2024
88d28b4
Revert "beta -> nightly-2024-12-14 (temp)"
StackOverflowExcept1on Dec 17, 2024
e1f02b7
Revert "temporarily switch to beta rust instead of stable"
StackOverflowExcept1on Dec 17, 2024
34b5f0f
back to wasm32-unknown-unknown target, set rust-version to 1.82
StackOverflowExcept1on Dec 17, 2024
e771d97
missed this
StackOverflowExcept1on Dec 17, 2024
2bf4edf
use match *self instead of &mut Self::Pattern
StackOverflowExcept1on Dec 17, 2024
52d9fa3
bump to nightly-2024-12-17
StackOverflowExcept1on Dec 17, 2024
3758f22
switch to beta
StackOverflowExcept1on Dec 18, 2024
e97f103
place wasms in ./target/profile/wasms/
StackOverflowExcept1on Dec 18, 2024
392e5e3
switch to wasm32v1-none target
StackOverflowExcept1on Dec 18, 2024
a9cfba5
run CI on this branch
StackOverflowExcept1on Dec 18, 2024
a905cb4
fix clippy
StackOverflowExcept1on Dec 18, 2024
cda0ed7
wasm-builder should copy wasm32v1-none target
StackOverflowExcept1on Dec 18, 2024
65b27b8
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Dec 26, 2024
9d1b0b0
bump to nightly-2024-12-26
StackOverflowExcept1on Dec 26, 2024
c2a1fbb
Merge branch 'av/rust' into av/wasm32v1-target
StackOverflowExcept1on Dec 26, 2024
1e01109
bump to nightly-2025-01-01
StackOverflowExcept1on Jan 1, 2025
b55865a
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Jan 1, 2025
77cbc84
fix fmt
StackOverflowExcept1on Jan 1, 2025
b98037d
Merge branch 'av/rust' into av/wasm32v1-target
StackOverflowExcept1on Jan 4, 2025
0f3960b
remove wasm32-unknown-unknown
StackOverflowExcept1on Jan 4, 2025
b5158a3
fix target_os = unknown
StackOverflowExcept1on Jan 4, 2025
dc7f4d0
use substrate-wasm-builder from git
StackOverflowExcept1on Jan 4, 2025
7886ad3
completely remove wasm32-unknown-unknown
StackOverflowExcept1on Jan 4, 2025
5decc0b
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Jan 9, 2025
c96c6c7
bump rust to 2025-01-09
StackOverflowExcept1on Jan 9, 2025
7d1b3a1
fix Cargo.lock
StackOverflowExcept1on Jan 9, 2025
83325b1
Merge branch 'av/rust' into av/wasm32v1-target
StackOverflowExcept1on Jan 9, 2025
4589157
Revert "switch to beta"
StackOverflowExcept1on Jan 9, 2025
64f382b
fix target
StackOverflowExcept1on Jan 9, 2025
bf990ed
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Jan 11, 2025
c1690aa
Merge branch 'av/rust' into av/wasm32v1-target
StackOverflowExcept1on Jan 11, 2025
b7df200
Merge remote-tracking branch 'origin/master' into av/rust
StackOverflowExcept1on Jan 11, 2025
d87e46b
replace dead_code with unused
StackOverflowExcept1on Jan 11, 2025
a8dd356
Merge branch 'av/rust' into av/wasm32v1-target
StackOverflowExcept1on Jan 11, 2025
2040b8f
resolve conversations
StackOverflowExcept1on Jan 11, 2025
e0f35e4
Merge remote-tracking branch 'origin/master' into av/wasm32v1-target
StackOverflowExcept1on Jan 11, 2025
edfe8e4
remove patches and commented deps
StackOverflowExcept1on Jan 14, 2025
1e42ac6
gear-wasm virtual target
StackOverflowExcept1on Jan 14, 2025
c8460a3
Merge remote-tracking branch 'origin/master' into av/wasm32v1-target
StackOverflowExcept1on Jan 14, 2025
0f56df0
fix clippy
StackOverflowExcept1on Jan 14, 2025
521b274
gear-wasm -> wasm32-gear
StackOverflowExcept1on Jan 14, 2025
539fd6d
temp ignore demo-fungible-token test
StackOverflowExcept1on Jan 17, 2025
7e76522
fix wrong path
StackOverflowExcept1on Jan 17, 2025
4aa7586
Merge remote-tracking branch 'origin/master' into av/wasm32v1-target
StackOverflowExcept1on Jan 17, 2025
d28e982
Merge remote-tracking branch 'origin/master' into av/wasm32v1-target
StackOverflowExcept1on Jan 18, 2025
d8d3512
Merge remote-tracking branch 'origin/master' into av/wasm32v1-target
StackOverflowExcept1on Feb 3, 2025
683a794
update hashes for gear-polkadot-stable2409-wasm32v1-none branch
StackOverflowExcept1on Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix static_mut_refs warning with gcore::{static_mut, static_ref} macros
  • Loading branch information
StackOverflowExcept1on committed Dec 16, 2024
commit c450f77f33aba4c167d278f5106b8cdab0e3fe1b
2 changes: 1 addition & 1 deletion examples/async-init/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn main() {

assert_eq!(message, b"PING");

let requests = unsafe { ARGUMENTS.iter() }
let requests = unsafe { static_ref!(ARGUMENTS).iter() }
.map(|&addr| msg::send_bytes_for_reply(addr, "PING", 0, 0).expect("Failed to send message"))
.collect::<Vec<_>>();

Expand Down
6 changes: 5 additions & 1 deletion examples/bls381/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ extern "C" fn init() {
#[gstd::async_main]
async fn main() {
let msg: HandleMessage = msg::load().expect("Unable to decode `HandleMessage`");
let contract = unsafe { CONTRACT.as_mut().expect("The contract is not initialized") };
let contract = unsafe {
static_mut!(CONTRACT)
.as_mut()
.expect("The contract is not initialized")
};

match msg {
HandleMessage::MillerLoop {
Expand Down
4 changes: 2 additions & 2 deletions examples/calc-hash/over-blocks/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Method;
use gstd::{exec, msg};
use gstd::{exec, msg, prelude::*};
use types::Package;

#[no_mangle]
Expand All @@ -11,7 +11,7 @@ extern "C" fn init() {
extern "C" fn handle() {
let threshold = unsafe { state::THRESHOLD.expect("Threshold has not been set.") };
let method = msg::load::<Method>().expect("Invalid program method.");
let registry = unsafe { &mut state::REGISTRY };
let registry = unsafe { static_mut!(state::REGISTRY) };

match method {
Method::Start { expected, id, src } => {
Expand Down
2 changes: 1 addition & 1 deletion examples/compose/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async fn main() {
exec::gas_available()
);

if let Ok(outcome) = (unsafe { STATE.compose(input) }).await {
if let Ok(outcome) = (unsafe { static_mut!(STATE).compose(input) }).await {
debug!(
"[0x{} compose::handle] Composition output: {outcome:?}",
hex::encode(exec::program_id()),
Expand Down
3 changes: 2 additions & 1 deletion examples/constructor/src/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use alloc::{
string::{String, ToString},
vec::Vec,
};
use gstd::prelude::*;
use parity_scale_codec::{Codec, Decode, Encode};

#[derive(Clone, Debug, Decode, Encode)]
Expand Down Expand Up @@ -99,7 +100,7 @@ mod wasm {
match self {
Self::New(value) => value,
Self::Get(key) => {
let value = unsafe { crate::DATA.get(&key) }
let value = unsafe { static_ref!(crate::DATA).get(&key) }
.unwrap_or_else(|| panic!("Value in key {key} doesn't exist"));
T::decode(&mut value.as_ref())
.unwrap_or_else(|_| panic!("Value in key {key} failed decode"))
Expand Down
5 changes: 3 additions & 2 deletions examples/constructor/src/call.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::Arg;
use alloc::{string::String, vec::Vec};
use gstd::prelude::*;
use parity_scale_codec::{Decode, Encode};

#[derive(Clone, Debug, Decode, Encode)]
Expand Down Expand Up @@ -140,7 +141,7 @@ mod wasm {
&value[extra_encode as usize..]
);

unsafe { DATA.insert(key, value) };
unsafe { static_mut!(DATA).insert(key, value) };

None
}
Expand Down Expand Up @@ -392,7 +393,7 @@ mod wasm {

let end = count.value();
for i in 0_u64..end {
unsafe { DATA.insert("last_written_n".into(), i.encode()) };
unsafe { static_mut!(DATA).insert("last_written_n".into(), i.encode()) };
}

None
Expand Down
4 changes: 2 additions & 2 deletions examples/constructor/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{Call, Scheme};
use gstd::{collections::BTreeMap, msg, String, Vec};
use gstd::{collections::BTreeMap, msg, prelude::*, String, Vec};

pub(crate) static mut DATA: BTreeMap<String, Vec<u8>> = BTreeMap::new();
static mut SCHEME: Option<Scheme> = None;

fn process_fn<'a>(f: impl Fn(&'a Scheme) -> Option<&'a Vec<Call>>) {
let scheme = unsafe { SCHEME.as_ref() }.expect("Should be set before access");
let scheme = unsafe { static_ref!(SCHEME).as_ref() }.expect("Should be set before access");
let calls = f(scheme)
.cloned()
.unwrap_or_else(|| msg::load().expect("Failed to load payload"));
Expand Down
8 changes: 4 additions & 4 deletions examples/custom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod wasm {
reserver::wasm as reserver, simple_waiter::wasm as simple_waiter,
wake_after_exit::wasm as wake_after_exit, InitMessage,
};
use gstd::msg;
use gstd::{msg, prelude::*};

enum State {
Capacitor(capacitor::State),
Expand Down Expand Up @@ -91,7 +91,7 @@ mod wasm {

#[no_mangle]
extern "C" fn handle() {
let state = unsafe { STATE.as_mut().expect("State must be set") };
let state = unsafe { static_mut!(STATE).as_mut().expect("State must be set") };
match state {
State::Capacitor(state) => capacitor::handle(state),
State::BTree(state) => btree::handle(state),
Expand All @@ -103,15 +103,15 @@ mod wasm {

#[no_mangle]
extern "C" fn handle_reply() {
let state = unsafe { STATE.as_mut().expect("State must be set") };
let state = unsafe { static_mut!(STATE).as_mut().expect("State must be set") };
if let State::WakeAfterExit = state {
wake_after_exit::handle_reply();
}
}

#[no_mangle]
extern "C" fn state() {
let state = unsafe { STATE.take().expect("State must be set") };
let state = unsafe { static_mut!(STATE).take().expect("State must be set") };
if let State::BTree(state) = state {
btree::state(state);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/delayed-sender/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::DELAY;
use gstd::{exec, msg, MessageId};
use gstd::{exec, msg, prelude::*, MessageId};

static mut MID: Option<MessageId> = None;
static mut DONE: bool = false;
Expand Down Expand Up @@ -63,7 +63,7 @@ extern "C" fn handle() {
}

// Common delayed sender case.
if let Some(message_id) = unsafe { MID.take() } {
if let Some(message_id) = unsafe { static_mut!(MID).take() } {
let delay: u32 = msg::load().unwrap();

unsafe {
Expand Down
14 changes: 12 additions & 2 deletions examples/distributor/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,21 @@ impl Program {
}

fn nodes() -> &'static Mutex<BTreeSet<Program>> {
unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").nodes }
unsafe {
&static_mut!(STATE)
.as_mut()
.expect("STATE UNINITIALIZED!")
.nodes
}
}

fn amount() -> &'static mut u64 {
unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").amount }
unsafe {
&mut static_mut!(STATE)
.as_mut()
.expect("STATE UNINITIALIZED!")
.amount
}
}

async fn handle_request() {
Expand Down
9 changes: 7 additions & 2 deletions examples/fungible-token/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ impl FungibleToken {

#[no_mangle]
extern "C" fn state() {
let state = unsafe { FUNGIBLE_TOKEN.take().expect("State is not initialized") };
let state = unsafe {
static_mut!(FUNGIBLE_TOKEN)
.take()
.expect("State is not initialized")
};
let FungibleToken {
name,
symbol,
Expand Down Expand Up @@ -191,7 +195,8 @@ extern "C" fn state() {
#[no_mangle]
extern "C" fn handle() {
let action: FTAction = msg::load().expect("Could not load Action");
let ft: &mut FungibleToken = unsafe { FUNGIBLE_TOKEN.get_or_insert(Default::default()) };
let ft: &mut FungibleToken =
unsafe { static_mut!(FUNGIBLE_TOKEN).get_or_insert(Default::default()) };
match action {
FTAction::Mint(amount) => {
ft.mint(amount);
Expand Down
12 changes: 6 additions & 6 deletions examples/init-wait/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use gstd::{collections::BTreeMap, exec, msg, MessageId};
use gstd::{collections::BTreeMap, exec, msg, prelude::*, MessageId};

#[derive(PartialEq, Debug)]
enum State {
Expand All @@ -31,11 +31,11 @@ static mut TEST_DYNAMIC_MEMORY: BTreeMap<u32, ()> = BTreeMap::new();

#[no_mangle]
extern "C" fn init() {
let state = unsafe { &mut STATE };
let state = unsafe { static_mut!(STATE) };
match state {
State::NotInited => {
for k in 0..20 {
unsafe { TEST_DYNAMIC_MEMORY.insert(k, ()) };
unsafe { static_mut!(TEST_DYNAMIC_MEMORY).insert(k, ()) };
}

unsafe { INIT_MESSAGE = msg::id() };
Expand All @@ -45,10 +45,10 @@ extern "C" fn init() {
}
State::WaitForReply => {
for k in 0..20 {
unsafe { TEST_DYNAMIC_MEMORY.insert(k, ()) };
unsafe { static_mut!(TEST_DYNAMIC_MEMORY).insert(k, ()) };
}
for k in 0..25 {
let _ = unsafe { TEST_DYNAMIC_MEMORY.remove(&k) };
let _ = unsafe { static_mut!(TEST_DYNAMIC_MEMORY).remove(&k) };
}

*state = State::Inited;
Expand All @@ -70,7 +70,7 @@ extern "C" fn handle() {
extern "C" fn handle_reply() {
if unsafe { STATE == State::WaitForReply } {
for k in 20..40 {
unsafe { TEST_DYNAMIC_MEMORY.insert(k, ()) };
unsafe { static_mut!(TEST_DYNAMIC_MEMORY).insert(k, ()) };
}
exec::wake(unsafe { INIT_MESSAGE }).expect("Failed to wake message");
}
Expand Down
11 changes: 5 additions & 6 deletions examples/mul-by-const/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
// Effectively, this procedure executes a composition of `MAX_ITER` programs `f`
// where the output of the previous call is fed to the input of the next call.

extern crate alloc;

use gstd::{debug, exec, msg, String};
use gstd::{debug, exec, msg, prelude::*, String};

static mut DEBUG: DebugInfo = DebugInfo { me: String::new() };
static mut STATE: State = State { intrinsic: 0 };
Expand All @@ -50,7 +48,8 @@ impl State {
.expect("Multiplication overflow");
debug!(
"[0x{} mul_by_const::unchecked_mul] Calculated {} x {other} == {z}",
DEBUG.me, self.intrinsic
static_ref!(DEBUG).me,
self.intrinsic
);
z
}
Expand All @@ -60,7 +59,7 @@ impl State {
extern "C" fn handle() {
let x: u64 = msg::load().expect("Expecting a u64 number");

msg::reply(unsafe { STATE.unchecked_mul(x) }, 0).unwrap();
msg::reply(unsafe { static_mut!(STATE).unchecked_mul(x) }, 0).unwrap();
}

#[no_mangle]
Expand All @@ -75,6 +74,6 @@ extern "C" fn init() {
msg::reply_bytes([], 0).unwrap();
debug!(
"[0x{} mul_by_const::init] Program initialized with input {val}",
unsafe { &DEBUG.me },
unsafe { static_ref!(DEBUG).me.as_str() },
);
}
4 changes: 1 addition & 3 deletions examples/ncompose/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
// Effectively, this procedure executes a composition of `MAX_ITER` programs `f`
// where the output of the previous call is fed to the input of the next call.

extern crate alloc;

use gstd::{debug, exec, msg, prelude::*, ActorId};

static mut STATE: State = State {
Expand Down Expand Up @@ -132,7 +130,7 @@ async fn main() {
hex::encode(unsafe { STATE.me.handle }),
);

if let Ok(outcome) = (unsafe { STATE.compose_with_self(input) }).await {
if let Ok(outcome) = (unsafe { static_mut!(STATE).compose_with_self(input) }).await {
debug!(
"[0x{} ncompose::handle] Composition output: {outcome:?}",
hex::encode(exec::program_id()),
Expand Down
4 changes: 2 additions & 2 deletions examples/new-meta/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C" fn init() {
extern "C" fn handle() {
let message_in: MessageIn = msg::load().unwrap();

let res = unsafe { &WALLETS }
let res = unsafe { static_ref!(WALLETS) }
.iter()
.find(|w| w.id.decimal == message_in.id.decimal)
.cloned();
Expand All @@ -37,5 +37,5 @@ extern "C" fn handle() {
// State-sharing function
#[no_mangle]
extern "C" fn state() {
msg::reply(unsafe { WALLETS.clone() }, 0).expect("Failed to share state");
msg::reply(unsafe { static_ref!(WALLETS).clone() }, 0).expect("Failed to share state");
}
2 changes: 1 addition & 1 deletion examples/node/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extern "C" fn handle() {
}

fn state() -> &'static mut NodeState {
unsafe { STATE.as_mut().unwrap() }
unsafe { static_mut!(STATE).as_mut().unwrap() }
}

fn process(request: Request) -> Reply {
Expand Down
11 changes: 9 additions & 2 deletions examples/proxy-relay/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::{RelayCall, ResendPushData};
use gstd::msg::{self, MessageHandle};
use gstd::{
msg::{self, MessageHandle},
prelude::*,
};

static mut RELAY_CALL: Option<RelayCall> = None;

Expand Down Expand Up @@ -66,7 +69,11 @@ fn resend_push(resend_pushes: &[ResendPushData], size: usize) {
#[no_mangle]
extern "C" fn handle() {
use RelayCall::*;
let relay_call = unsafe { RELAY_CALL.as_ref().expect("Relay call is not initialized") };
let relay_call = unsafe {
static_ref!(RELAY_CALL)
.as_ref()
.expect("Relay call is not initialized")
};
let size = msg::size();

match relay_call {
Expand Down
2 changes: 1 addition & 1 deletion examples/read-big-state/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use gstd::{msg, prelude::*};
static mut STATE: Option<State> = None;

fn state_mut() -> &'static mut State {
unsafe { STATE.get_or_insert_with(State::new) }
unsafe { static_mut!(STATE).get_or_insert_with(State::new) }
}

#[no_mangle]
Expand Down
4 changes: 2 additions & 2 deletions examples/reservation-manager/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ extern "C" fn handle() {
unsafe {
match action {
Action::Reserve { amount, duration } => {
RESERVATIONS
static_mut!(RESERVATIONS)
.reserve(amount, duration)
.expect("Failed to reserve gas");
}
Action::SendMessageFromReservation { gas_amount } => {
let reservation = RESERVATIONS.try_take_reservation(gas_amount);
let reservation = static_mut!(RESERVATIONS).try_take_reservation(gas_amount);
if let Some(reservation) = reservation {
msg::send_bytes_from_reservation(reservation.id(), msg::source(), [], 0)
.expect("Failed to send message from reservation");
Expand Down
Loading
Loading