mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 11:57:56 +00:00
contracts: Run start function (#1367)
Fixes #116 Start function wasn't allowed in a contract. Now it is allowed and is being run. It was disallowed because it is not used by Rust and supporting it made the code more complex. However, not running the start function violates the wasm standard. This makes life harder for some languages (see linked ticket).
This commit is contained in:
committed by
GitHub
parent
44dbb73945
commit
c879d1d582
@@ -862,6 +862,27 @@ fn deposit_event_max_value_limit() {
|
||||
});
|
||||
}
|
||||
|
||||
// Fail out of fuel (ref_time weight) inside the start function.
|
||||
#[test]
|
||||
fn run_out_of_fuel_start_fun() {
|
||||
let (wasm, _code_hash) = compile_module::<Test>("run_out_of_gas_start_fn").unwrap();
|
||||
ExtBuilder::default().existential_deposit(50).build().execute_with(|| {
|
||||
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
|
||||
assert_err_ignore_postinfo!(
|
||||
Contracts::instantiate_with_code(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
0,
|
||||
Weight::from_parts(1_000_000_000_000, u64::MAX),
|
||||
None,
|
||||
wasm,
|
||||
vec![],
|
||||
vec![],
|
||||
),
|
||||
Error::<Test>::OutOfGas,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Fail out of fuel (ref_time weight) in the engine.
|
||||
#[test]
|
||||
fn run_out_of_fuel_engine() {
|
||||
|
||||
Reference in New Issue
Block a user