github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/state/protocol/protocol_state/kvstore/errors.go (about)

     1  package kvstore
     2  
     3  import "errors"
     4  
     5  // ErrKeyNotSet is a sentinel returned when a key is queried and no value has been set.
     6  // The key must exist in the currently active key-value store version. This sentinel
     7  // is used to communicate an empty/unset value rather than using zero or nil values.
     8  // This sentinel is applicable on a key-by-key basis: some keys will always have a value
     9  // set, others will support unset values.
    10  var ErrKeyNotSet = errors.New("no value for requested key in Protocol State's kvstore")
    11  
    12  // ErrKeyNotSupported is a sentinel returned when a key is read or written, but
    13  // the key does not exist in the currently active version of the key-value store.
    14  // This can happen in two circumstances, for example:
    15  //  1. Current model is v2, software supports v3, and we query a key which was newly added in v3.
    16  //  2. Current model is v3 and we query a key which was added in v2 then removed  in v3
    17  var ErrKeyNotSupported = errors.New("protocol state's kvstore does not support the specified key at this version")
    18  
    19  // ErrUnsupportedVersion is a sentinel returned when we attempt to decode a key-value
    20  // store instance, but provide an unsupported version. This could happen if we accept
    21  // an already-encoded key-value store instance from an external source (should be
    22  // avoided in general) or if the node software version is downgraded.
    23  var ErrUnsupportedVersion = errors.New("unsupported version for the Protocol State's kvstore")
    24  
    25  // ErrInvalidUpgradeVersion is a sentinel returned when we attempt to set a new kvstore version
    26  // via a ProtocolStateVersionUpgrade event, but the new version is not strictly greater than
    27  // the current version. This error happens when smart contract has different understanding of
    28  // the protocol state version than the node software.
    29  var ErrInvalidUpgradeVersion = errors.New("invalid upgrade version for the Protocol State's kvstore")
    30  
    31  // ErrInvalidActivationView is a sentinel returned when we attempt to process a KV store update,
    32  // which has an activation candidateView `V` so that `CurrentView + SafetyBuffer < V` does NOT hold.
    33  var ErrInvalidActivationView = errors.New("invalid activation view for the new Protocol State version")
    34  
    35  // ErrIncompatibleVersionChange is a sentinel returned when we attempt to replicate a parent KV store snapshot into a snapshot
    36  // with the specified `protocolVersion` but such operation is not supported by the parent snapshot.
    37  var ErrIncompatibleVersionChange = errors.New("incompatible version change when replicating the Protocol State's kvstore")