github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/ledger.go (about) 1 package storage 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // Ledger takes care of storing registers (key, value pairs) providing proof of correctness 8 // we aim to store a state of the order of 10^10 registers with up to 1M historic state versions 9 type Ledger interface { 10 EmptyStateCommitment() flow.StateCommitment 11 12 // Trusted methods (without proof) 13 // Get registers at specific StateCommitment by a list of register ids 14 GetRegisters(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment) (values []flow.RegisterValue, err error) 15 // Batched atomic updates of a subset of registers at specific state 16 UpdateRegisters(registerIDs []flow.RegisterID, values []flow.RegisterValue, stateCommitment flow.StateCommitment) (newStateCommitment flow.StateCommitment, err error) 17 18 // Untrusted methods (providing proofs) 19 // Get registers at specific StateCommitment by a list of register ids with proofs 20 GetRegistersWithProof(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment) (values []flow.RegisterValue, proofs []flow.StorageProof, err error) 21 // Batched atomic updates of a subset of registers at specific state with proofs 22 UpdateRegistersWithProof(registerIDs []flow.RegisterID, values []flow.RegisterValue, stateCommitment flow.StateCommitment) (newStateCommitment flow.StateCommitment, proofs []flow.StorageProof, err error) 23 } 24 25 // LedgerVerifier should be designed as an standalone package to verify proofs of storage 26 type LedgerVerifier interface { 27 // verify if a provided proof for getRegisters is accurate 28 VerifyRegistersProof(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment, values []flow.RegisterValue, proof []flow.StorageProof) (verified bool, err error) 29 }