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

wasm-executor: Support growing the memory #12520

Merged
merged 52 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4dbc715
As always, start with something :P
bkchr Aug 6, 2021
639dbaf
Add support for max_heap_pages
bkchr Aug 9, 2021
b251bda
Add support for wasmtime
bkchr Aug 9, 2021
b2e5d1e
Merge branch 'bkchr-grow-memory' of github.com:paritytech/substrate i…
bkchr Aug 9, 2021
b07dc47
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Dec 5, 2021
79303bb
Merge branch 'bkchr-grow-memory' of github.com:paritytech/substrate i…
bkchr Dec 5, 2021
ecf5031
Make it compile
bkchr Dec 25, 2021
e99a9dd
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Apr 20, 2022
0840615
Fix compilation
bkchr Apr 20, 2022
945b08b
Copy wrongly merged code
bkchr Apr 21, 2022
9380a48
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr May 19, 2022
a2d9290
Fix compilation
bkchr May 20, 2022
11348ae
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Aug 6, 2022
8e746fb
Some fixes
bkchr Aug 9, 2022
0032da0
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Aug 22, 2022
9bbc1ab
Fix
bkchr Aug 22, 2022
545f225
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Sep 12, 2022
ac1558b
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Sep 19, 2022
0536fc4
Get stuff working
bkchr Sep 19, 2022
128b3ab
More work
bkchr Sep 20, 2022
984b74d
More fixes
bkchr Sep 20, 2022
d990d20
...
bkchr Sep 20, 2022
a9abd56
More
bkchr Sep 21, 2022
3da8cdc
FIXEs
bkchr Sep 22, 2022
b18f871
Switch wasmi to use `RuntimeBlob` like wasmtime
bkchr Sep 23, 2022
30c6ac8
Removed unused stuff
bkchr Sep 23, 2022
113353a
Cleanup
bkchr Oct 4, 2022
a8732ff
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Oct 4, 2022
5d54905
More cleanups
bkchr Oct 4, 2022
8b2ec2b
Introduce `CallContext`
bkchr Oct 5, 2022
bb3abea
Fixes
bkchr Oct 6, 2022
9cb8209
More fixes
bkchr Oct 7, 2022
eff2076
Add builder for creating the `WasmExecutor`
bkchr Oct 12, 2022
db9ecdc
Adds some docs
bkchr Oct 18, 2022
1b25227
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Oct 18, 2022
56110e6
FMT
bkchr Oct 18, 2022
396b6ad
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Feb 14, 2023
31a7528
First round of feedback.
bkchr Feb 14, 2023
b51fcc0
Review feedback round 2
bkchr Feb 15, 2023
cf2e698
More fixes
bkchr Feb 15, 2023
c5cd976
Fix try-runtime
bkchr Feb 15, 2023
1ea94ce
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Feb 15, 2023
b511254
Update client/executor/wasmtime/src/instance_wrapper.rs
bkchr Feb 17, 2023
905a1dc
Update client/executor/common/src/wasm_runtime.rs
bkchr Feb 17, 2023
d9b84c2
Update client/executor/common/src/runtime_blob/runtime_blob.rs
bkchr Feb 17, 2023
1bc71ff
Update client/executor/common/src/wasm_runtime.rs
bkchr Feb 17, 2023
0c2fbe5
Update client/allocator/src/freeing_bump.rs
bkchr Feb 17, 2023
2c234a5
Update client/allocator/src/freeing_bump.rs
bkchr Feb 17, 2023
4378b30
Feedback round 3
bkchr Feb 17, 2023
c7c3117
FMT
bkchr Feb 17, 2023
1f41507
Review comments
bkchr Feb 23, 2023
ac27b2e
Merge remote-tracking branch 'origin/master' into bkchr-grow-memory
bkchr Feb 23, 2023
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
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 26 additions & 4 deletions bin/node/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use sc_executor::{
};
use sp_core::{
storage::well_known_keys,
traits::{CodeExecutor, RuntimeCode},
traits::{CallContext, CodeExecutor, RuntimeCode},
};
use sp_runtime::traits::BlakeTwo256;
use sp_state_machine::TestExternalities as CoreTestExternalities;
Expand Down Expand Up @@ -112,20 +112,41 @@ fn construct_block<E: Externalities>(

// execute the block to get the real header.
executor
.call(ext, &runtime_code, "Core_initialize_block", &header.encode(), true)
.call(
ext,
&runtime_code,
"Core_initialize_block",
&header.encode(),
true,
CallContext::Offchain,
)
.0
.unwrap();

for i in extrinsics.iter() {
executor
.call(ext, &runtime_code, "BlockBuilder_apply_extrinsic", &i.encode(), true)
.call(
ext,
&runtime_code,
"BlockBuilder_apply_extrinsic",
&i.encode(),
true,
CallContext::Offchain,
)
.0
.unwrap();
}

let header = Header::decode(
&mut &executor
.call(ext, &runtime_code, "BlockBuilder_finalize_block", &[0u8; 0], true)
.call(
ext,
&runtime_code,
"BlockBuilder_finalize_block",
&[0u8; 0],
true,
CallContext::Offchain,
)
.0
.unwrap()[..],
)
Expand Down Expand Up @@ -201,6 +222,7 @@ fn bench_execute_block(c: &mut Criterion) {
"Core_execute_block",
&block.0,
use_native,
CallContext::Offchain,
)
.0
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions bin/node/executor/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sp_consensus_babe::{
use sp_core::{
crypto::KeyTypeId,
sr25519::Signature,
traits::{CodeExecutor, RuntimeCode},
traits::{CallContext, CodeExecutor, RuntimeCode},
};
use sp_runtime::{
traits::{BlakeTwo256, Header as HeaderT},
Expand Down Expand Up @@ -114,7 +114,7 @@ pub fn executor_call(
heap_pages: heap_pages.and_then(|hp| Decode::decode(&mut &hp[..]).ok()),
};
sp_tracing::try_init_simple();
executor().call(&mut t, &runtime_code, method, data, use_native)
executor().call(&mut t, &runtime_code, method, data, use_native, CallContext::Onchain)
}

pub fn new_test_ext(code: &[u8]) -> TestExternalities<BlakeTwo256> {
Expand Down
2 changes: 1 addition & 1 deletion client/allocator/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

/// The error type used by the allocators.
#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, Debug, PartialEq)]
pub enum Error {
/// Someone tried to allocate more memory than the allowed maximum per allocation.
#[error("Requested allocation size is too large")]
Expand Down
Loading