Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Contracts: Enabled signed extension #14565

Merged
merged 6 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
10 changes: 10 additions & 0 deletions frame/contracts/fixtures/sign_extension.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;; Simple fixture which requires sign_extension proposal to be enabled.
(module
pgherveou marked this conversation as resolved.
Show resolved Hide resolved
(import "env" "memory" (memory 1 1))
(func (export "deploy"))
(func (export "call"))
(func (param i32) (result i32)
local.get 0
i32.extend8_s
)
)
24 changes: 24 additions & 0 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5633,3 +5633,27 @@ fn root_cannot_instantiate() {
);
});
}

#[test]
fn sign_extension_works() {
let (code, _) = compile_module::<Test>("sign_extension").unwrap();

ExtBuilder::default().build().execute_with(|| {
agryaznov marked this conversation as resolved.
Show resolved Hide resolved
let _ = Balances::deposit_creating(&ALICE, 1_000_000);

assert_ok!(
Contracts::bare_instantiate(
ALICE,
0,
GAS_LIMIT,
None,
Code::Upload(code),
vec![],
vec![],
DebugInfo::Skip,
CollectEvents::Skip,
)
.result
);
});
}
2 changes: 1 addition & 1 deletion frame/contracts/src/wasm/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl LoadedModule {
config
.wasm_multi_value(false)
.wasm_mutable_global(false)
.wasm_sign_extension(false)
.wasm_sign_extension(true)
.wasm_bulk_memory(false)
.wasm_reference_types(false)
.wasm_tail_call(false)
Expand Down