Stateless validation of WASM execution #9377
Labels
A-contract-runtime
Area: contract compilation and execution, virtual machines, etc
A-stateless-validation
Area: stateless validation
C-tracking-issue
Category: a tracking issue
T-contract-runtime
Team: issues relevant to the contract runtime team
Q: What would it take for WASM smart contract execution outcomes to be verifiable without prior state?
In today's architecture, we fetch the following state from the DB, which can't be derived from the latest block and chunk alone:
A naive stateless implementation would therefore add the following information to the execution outcome witness of a function call::
Account
struct value stored in theTrieKey::Account
row.TrieKey::ContractCode
row.TrieKey::ReceivedData
row.TrieKey::State
row.As you can see, all the necessary data is already in the merkle-patritia trie, so we can include merkle proof for all these inputs.
Stateless validation would then work as follows:
Deploy
action)Problem 1: Witness Size
With the naive solution, we have to include many key-value pairs alongside their proofs. The contract code is likely to be hundreds of kB, potentially up to 4MB. Contract's key-value pairs are also only limited to 4MB.
To address the size, we are looking into better suited state representations and adding stricter size limits where appropriate.
Ongoing research:
Problem 2: Execution Delay
The deploy-ahead-of-time optimization that makes function calls so cheap is no longer viable. We would have to compile functions every time we execute them.
More details in
The text was updated successfully, but these errors were encountered: