Skip to content

Commit

Permalink
Merge pull request onflow#5378 from onflow/alex/cdp_doc
Browse files Browse the repository at this point in the history
minor doc update for Chunk Data Pack
  • Loading branch information
Alexander Hentschel authored Mar 4, 2024
2 parents 649345d + a0fff1a commit fe2ffc7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions model/flow/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fe2ffc7

Please sign in to comment.