feat(l1): serialize execution witness with ssz instead of rkyv #6797
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 311 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.344
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6797"
general
weight: 0.35
benbencik
Motivation
Replace
rkyvencoding ofExecutionWitnessandChainConfigwith SSZ. This aligns with the encoding in the stateless specification.The earlier effort in PR #6524 was left behind because of a major change in PR #6550. This PR builds on top of it.
Description
The major change is the new
SszExecutionWitness, which stores RPL-nodes and wraps them in an SSZ container. The difference is that everything is flat bytes as opposed to the previous recursive representation asNode. Decoding in the guest reconstructs the embedded trie.The new
SszChainConfigimplements SSZ encoding forChainConfig. Sincelibsszdoes not have support forOption, we introduceSszOptionU64,SszOptionU128, andSszOptionBlobScheduletypes with#[ssz(enum_behaviour = "union")].This PR intentionally keeps
RpcExecutionWitnessto keep the changes atomic. Currently, we cast from canonical witness to rpc witness and finally to execution witness. We could convert directly to execution witness and get rid ofRpcExecutionWitness. I would like to open a discussion if it is necessary to maintainRpcExecutionWitness.Setting ChainConfig Size
Fixed-size fields:
chain_id8B,dao_fork_support1B,terminal_total_difficulty_passed1B,deposit_contract_address20B,enable_verkle_at_genesis1B, 5xSszForkBlobSchedule16BTotal: 111B
Variable size have each 1B selector and value (assume worst case): 26x
SszOptionU64each 9B,SszOptionU12817B, 4xSszOptionBlobScheduleeach 17BTotal: 319B
Offsets for variable size types are 4B each, so 31x 4B = 124B. Total space required is 554B, so 1024 is enough, and we keep some buffer.
Profiling
Profiling in ZisK v0.16.1 on mainnet blocks 24949787 - 24949811:
37669b7c3): 45.17852BThis is ~20% regression. The flat SSZ encoding requires the guest to rebuild the tree as opposed to
rkyv,which serialized the tree structure directly. To my understanding, this is inherent in the encoding choice of the specification. This PR is meant to be a transition towards the specification, and further optimizations should be introduced.