diff --git a/model/flow/chunk.go b/model/flow/chunk.go index 6baf6e193c3..aab8179eb05 100644 --- a/model/flow/chunk.go +++ b/model/flow/chunk.go @@ -60,14 +60,25 @@ func (ch *Chunk) Checksum() Identifier { // ChunkDataPack holds all register touches (any read, or write). // -// Note that we have to capture a read proof for each write before updating the registers. -// `Proof` includes proofs for all registers read to execute the chunk. +// Note that we have to include merkle paths as storage proof for all registers touched (read or written) for +// the _starting_ state of the chunk (i.e. before the chunk computation updates the registers). +// For instance, if an execution state contains three registers: { A: 1, B: 2, C: 3}, and a certain +// chunk has a tx that assigns A = A + B, then its chunk data pack should include the merkle +// paths for { A: 1, B: 2 } as storage proof. +// C is not included because it's neither read or written by the chunk. +// B is included because it's read by the chunk. +// A is included because it's updated by the chunk, and its value 1 is included because it's +// the value before the chunk computation. +// This is necessary for Verification Nodes to (i) check that the read register values are +// consistent with the starting state's root hash and (ii) verify the correctness of the resulting +// state after the chunk computation. `Proof` includes merkle proofs for all touched registers +// during the execution of the chunk. // Register proofs order must not be correlated to the order of register reads during // the chunk execution in order to enforce the SPoCK secret high entropy. type ChunkDataPack struct { ChunkID Identifier // ID of the chunk this data pack is for StartState StateCommitment // commitment for starting state - Proof StorageProof // proof for all registers read during the chunk execution + Proof StorageProof // proof for all registers touched (read or written) during the chunk execution Collection *Collection // collection executed in this chunk // ExecutionDataRoot is the root data structure of an execution_data.BlockExecutionData.