mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
Contracts: Reuse module when validating (#3789)
Reuse wasmi Module when validating. Prepare the code for 0.32 and the addition of Module::new_unchecked
This commit is contained in:
@@ -34,7 +34,7 @@ use crate::{
|
||||
primitives::CodeUploadReturnValue,
|
||||
storage::DeletionQueueManager,
|
||||
tests::test_utils::{get_contract, get_contract_checked},
|
||||
wasm::{Determinism, ReturnErrorCode as RuntimeReturnCode},
|
||||
wasm::{Determinism, LoadingMode, ReturnErrorCode as RuntimeReturnCode},
|
||||
weights::WeightInfo,
|
||||
Array, BalanceOf, Code, CodeHash, CodeInfoOf, CollectEvents, Config, ContractInfo,
|
||||
ContractInfoOf, DebugInfo, DefaultAddressGenerator, DeletionQueueCounter, Error, HoldReason,
|
||||
@@ -1102,6 +1102,20 @@ fn delegate_call() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn track_check_uncheck_module_call() {
|
||||
let (wasm, code_hash) = compile_module::<Test>("dummy").unwrap();
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
|
||||
Contracts::bare_upload_code(ALICE, wasm, None, Determinism::Enforced).unwrap();
|
||||
builder::bare_instantiate(Code::Existing(code_hash)).build_and_unwrap_result();
|
||||
});
|
||||
|
||||
// It should have recorded 1 `Checked` for the upload and 1 `Unchecked` for the instantiate.
|
||||
let record = crate::wasm::tracker::LOADED_MODULE.with(|stack| stack.borrow().clone());
|
||||
assert_eq!(record, vec![LoadingMode::Checked, LoadingMode::Unchecked]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transfer_expendable_cannot_kill_account() {
|
||||
let (wasm, _code_hash) = compile_module::<Test>("dummy").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user