Skip to content

Commit

Permalink
update smoldot (#755)
Browse files Browse the repository at this point in the history
* update smoldot

* add storageProofSize option

* remove storageProofSize cli

* fix: avoid param modification
  • Loading branch information
qiweiii authored May 21, 2024
1 parent dc55b39 commit 15ef228
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "vendor/smoldot"]
path = vendor/smoldot
url = https://github.com/ermalkaleci/smoldot.git
url = https://github.com/smol-dot/smoldot.git
56 changes: 32 additions & 24 deletions executor/Cargo.lock

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

3 changes: 3 additions & 0 deletions executor/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct TaskCall {
mock_signature_host: bool,
allow_unresolved_imports: bool,
runtime_log_level: u32,
storage_proof_size: u64,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -142,6 +143,8 @@ pub async fn run_task(task: TaskCall, js: crate::JsCallback) -> Result<TaskRespo
storage_main_trie_changes,
max_log_level: task.runtime_log_level,
calculate_trie_changes: false,
storage_proof_size_behavior:
runtime_call::StorageProofSizeBehavior::ConstantReturnValue(task.storage_proof_size),
});

let mut vm = match vm {
Expand Down
28 changes: 16 additions & 12 deletions packages/core/src/wasm-executor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ export type RuntimeVersion = {
stateVersion: number
}

export type TaskCall = {
wasm: HexString
calls: [string, HexString[]][]
mockSignatureHost: boolean
allowUnresolvedImports: boolean
runtimeLogLevel: number
storageProofSize?: number
}

export type RuntimeLog = {
message: string
level?: number
Expand Down Expand Up @@ -113,19 +122,14 @@ export const createProof = async (nodes: HexString[], updates: [HexString, HexSt
return { trieRootHash, nodes: newNodes }
}

export const runTask = async (
task: {
wasm: HexString
calls: [string, HexString[]][]
mockSignatureHost: boolean
allowUnresolvedImports: boolean
runtimeLogLevel: number
},
callback: JsCallback = emptyTaskHandler,
) => {
export const runTask = async (task: TaskCall, callback: JsCallback = emptyTaskHandler) => {
const task2 = {
...task,
storageProofSize: task.storageProofSize ?? 0,
}
const worker = await getWorker()
logger.trace(truncate(task), 'taskRun')
const response = await worker.remote.runTask(task, Comlink.proxy(callback))
logger.trace(truncate(task2), 'taskRun')
const response = await worker.remote.runTask(task2, Comlink.proxy(callback))
if ('Call' in response) {
logger.trace(truncate(response.Call), 'taskResponse')
} else {
Expand Down
2 changes: 1 addition & 1 deletion vendor/smoldot
Submodule smoldot updated 43 files
+414 −387 Cargo.lock
+3 −3 full-node/Cargo.toml
+3 −0 full-node/src/consensus_service.rs
+8 −10 full-node/src/json_rpc_service.rs
+52 −63 full-node/src/json_rpc_service/chain_head_subscriptions.rs
+1 −0 full-node/src/json_rpc_service/requests_handler.rs
+3 −3 full-node/tests/author.rs
+8 −8 lib/Cargo.toml
+6 −0 lib/src/author/runtime.rs
+8 −2 lib/src/chain/async_tree.rs
+2 −0 lib/src/chain/chain_information/build.rs
+5 −0 lib/src/chain/fork_tree.rs
+89 −8 lib/src/executor/host.rs
+8 −2 lib/src/executor/host/tests.rs
+12 −2 lib/src/executor/host/tests/hash_algorithms.rs
+86 −11 lib/src/executor/host/tests/run.rs
+14 −2 lib/src/executor/runtime_call.rs
+2 −1 lib/src/executor/runtime_call/tests.rs
+21 −21 lib/src/executor/vm.rs
+9 −9 lib/src/executor/vm/interpreter.rs
+1 −0 lib/src/executor/vm/jit.rs
+17 −17 lib/src/json_rpc/methods.rs
+20 −20 lib/src/json_rpc/service/client_main_task.rs
+5 −5 lib/src/libp2p/multiaddr.rs
+2 −0 lib/src/transactions/validate/tests.rs
+936 −0 lib/src/trie/prefix_proof/test.json
+52 −14,469 lib/src/trie/prefix_proof/tests.rs
+4 −5 light-base/Cargo.toml
+64 −83 light-base/src/json_rpc_service.rs
+170 −112 light-base/src/json_rpc_service/background.rs
+1 −14 light-base/src/lib.rs
+1 −1 light-base/src/network_service.rs
+2 −0 light-base/src/runtime_service.rs
+32 −11 light-base/src/sync_service/parachain.rs
+1 −81 light-base/src/sync_service/standalone.rs
+30 −0 wasm-node/CHANGELOG.md
+769 −3,872 wasm-node/javascript/package-lock.json
+2 −2 wasm-node/javascript/package.json
+1 −1 wasm-node/javascript/src/internals/local-instance.ts
+12 −12 wasm-node/javascript/test/chainHead.mjs
+1 −0 wasm-node/javascript/tsconfig-cjs.json
+1 −0 wasm-node/javascript/tsconfig-mjs.json
+2 −2 wasm-node/rust/Cargo.toml

0 comments on commit 15ef228

Please sign in to comment.