Jordan Hrycaj 8727307ef4
Aristo uses pre classified tree types cont1 (#2389)
* Provide dedicated functions for deleteing accounts and storage trees

why:
  Storage trees are always linked to an account, so there is no need
  for an application to fiddle about (e.g. re-cycling, unlinking)
  storage tree vertex IDs.

* Remove `delete()` and other cruft from API, `aristo_delete`, etc.

* clean up delete functions

details:
  The delete implementations `deleteImpl()` and `delTreeImpl()` do not
  need to be super generic anymore as all the edge cases are covered by
  the specialised `deleteAccountPayload()`, `deleteGenericData()`, etc.

* Avoid unnecessary re-calculations of account keys

why:
  The function `registerAccountForUpdate()` did extract the storage ID
  (if any) and automatically marked the Merkle keys along the account
  path for re-hashing.

  This would also apply if there was later detected that the account
  or the storage tree did not need to be updated.

  So the `registerAccountForUpdate()` function was split into a part
  which retrieved the storage ID, and another one which marked the
  Merkle keys for re-calculation to be applied only when needed.
2024-06-18 19:30:01 +00:00

305 lines
7.2 KiB
Nim

# nimbus-eth1
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
# http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed
# except according to those terms.
type
AristoError* = enum
NothingSerious = 0
GenericError
# Rlp decoder, `read()`
Rlp2Or17ListEntries
RlpBlobExpected
RlpBranchHashKeyExpected
RlpEmptyBlobExpected
RlpExtHashKeyExpected
RlpHashKeyExpected
RlpNonEmptyBlobExpected
RlpOtherException
RlpRlpException
# Serialise decoder
SerCantResolveStorageRoot
# Data record transcoders, `deblobify()` and `blobify()`
BlobifyBranchMissingRefs
BlobifyExtMissingRefs
BlobifyExtPathOverflow
BlobifyLeafPathOverflow
BlobifyNilFilter
BlobifyNilVertex
BlobifyStateSrcLenGarbled
BlobifyStateTrgLenGarbled
DeblobNilArgument
DeblobUnknown
DeblobVtxTooShort
DeblobHashKeyExpected
DeblobBranchTooShort
DeblobBranchSizeGarbled
DeblobBranchInxOutOfRange
DeblobExtTooShort
DeblobExtSizeGarbled
DeblobExtGotLeafPrefix
DeblobLeafSizeGarbled
DeblobLeafGotExtPrefix
DeblobSizeGarbled
DeblobWrongType
DeblobWrongSize
DeblobPayloadTooShortInt64
DeblobPayloadTooShortInt256
DeblobNonceLenUnsupported
DeblobBalanceLenUnsupported
DeblobStorageLenUnsupported
DeblobCodeLenUnsupported
DeblobFilterTooShort
DeblobFilterGenTooShort
DeblobFilterTrpTooShort
DeblobFilterTrpVtxSizeGarbled
DeblobFilterSizeGarbled
# Converter `asNode()`, currenly for unit tests only
CacheMissingNodekeys
# Path function `hikeUp()`
HikeBranchMissingEdge
HikeBranchTailEmpty
HikeDanglingEdge
HikeEmptyPath
HikeExtMissingEdge
HikeExtTailEmpty
HikeExtTailMismatch
HikeLeafUnexpected
HikeNoLegs
HikeRootMissing
# Path/nibble/key conversions in `aisto_path.nim`
PathExpected64Nibbles
PathAtMost64Nibbles
PathExpectedLeaf
# Merge leaf `merge()`
MergeAssemblyFailed # Ooops, internal error
MergeAccRootNotAccepted
MergeStoRootNotAccepted
MergeBranchGarbledNibble
MergeBranchGarbledTail
MergeBranchLinkLeafGarbled
MergeBranchLinkVtxPfxTooShort
MergeBranchProofModeLock
MergeBranchRootExpected
MergeHashKeyDiffersFromCached
MergeHashKeyInvalid
MergeLeafCantChangeStorageID
MergeLeafGarbledHike
MergeLeafPathCachedAlready
MergeLeafPathOnBackendAlready
MergeLeafProofModeLock
MergeLeafTypeAccountRequired
MergeLeafTypeRawDataRequired
MergeNodeAccountPayloadError
MergeNodeVidMissing
MergeNodeVtxDiffersFromExisting
MergeNonBranchProofModeLock
MergeProofInitMissing
MergeRevVidMustHaveBeenCached
MergeRootArgsIncomplete
MergeRootBranchLinkBusy
MergeRootKeyDiffersForVid
MergeRootKeyInvalid
MergeRootKeyMissing
MergeRootKeyNotInProof
MergeRootKeysMissing
MergeRootKeysOverflow
MergeRootVidMissing
# Update `Merkle` hashes `hashify()`
HashifyVtxUnresolved
HashifyRootVtxUnresolved
HashifyProofHashMismatch
# Cache checker `checkCache()`
CheckStkKeyStrayZeroEntry
CheckStkVtxIncomplete
CheckStkVtxKeyMismatch
CheckStkVtxKeyMissing
CheckRlxVidVtxMismatch
CheckRlxVtxIncomplete
CheckRlxVtxKeyMissing
CheckRlxVtxKeyMismatch
CheckAnyVidDeadStorageRoot
CheckAnyVidSharedStorageRoot
CheckAnyVtxEmptyKeyMissing
CheckAnyVtxEmptyKeyExpected
CheckAnyVtxEmptyKeyMismatch
CheckAnyVtxBranchLinksMissing
CheckAnyVtxExtPfxMissing
CheckAnyVtxLockWithoutKey
CheckAnyVTopUnset
# Backend structural check `checkBE()`
CheckBeVtxInvalid
CheckBeVtxMissing
CheckBeVtxBranchLinksMissing
CheckBeVtxExtPfxMissing
CheckBeKeyInvalid
CheckBeKeyMissing
CheckBeKeyCantCompile
CheckBeKeyMismatch
CheckBeGarbledVTop
CheckBeCacheIsDirty
CheckBeCacheKeyMissing
CheckBeCacheKeyNonEmpty
CheckBeCacheVidUnsynced
CheckBeCacheKeyDangling
CheckBeCacheVtxDangling
CheckBeCacheKeyCantCompile
CheckBeCacheKeyMismatch
CheckBeCacheGarbledVTop
CheckBeFifoSrcTrgMismatch
CheckBeFifoTrgNotStateRoot
# Jornal check `checkJournal()`
CheckJrnCachedQidOverlap
CheckJrnSavedQidMissing
CheckJrnSavedQidStale
CheckJrnLinkingGap
# Neighbour vertex, tree traversal `nearbyRight()` and `nearbyLeft()`
NearbyBeyondRange
NearbyBranchError
NearbyDanglingLink
NearbyEmptyHike
NearbyExtensionError
NearbyFailed
NearbyBranchExpected
NearbyLeafExpected
NearbyNestingTooDeep
NearbyPathTailUnexpected
NearbyUnexpectedVtx
NearbyVidInvalid
# Deletion of vertices, `delete()`
DelAccRootNotAccepted
DelBranchExpexted
DelBranchLocked
DelBranchWithoutRefs
DelDanglingStoTrie
DelExtLocked
DelLeafExpexted
DelLeafLocked
DelLeafUnexpected
DelPathNotFound
DelPathTagError
DelRootVidMissing
DelStoAccMissing
DelStoRootMissing
DelStoRootNotAccepted
DelSubTreeAccRoot
DelSubTreeVoidRoot
DelVidStaleVtx
# Functions from `aristo_filter.nim`
FilBackendMissing
FilBackendRoMode
FilNilFilterRejected
FilSiblingsCommitUnfinshed
FilSrcTrgInconsistent
FilStateRootMismatch
FilTrgSrcMismatch
# Get functions from `aristo_get.nim`
GetLeafMissing
GetKeyUpdateNeeded
GetLeafNotFound
GetVtxNotFound
GetKeyNotFound
GetFilNotFound
GetTuvNotFound
GetLstNotFound
GetFqsNotFound
# Fetch functions from `aristo_fetch.nim`
FetchPathNotFound
LeafKeyInvalid
# RocksDB backend
RdbBeCantCreateDataDir
RdbBeCantCreateTmpDir
RdbBeDriverDelAdmError
RdbBeDriverDelKeyError
RdbBeDriverDelVtxError
RdbBeDriverGetAdmError
RdbBeDriverGetKeyError
RdbBeDriverGetVtxError
RdbBeDriverGuestError
RdbBeDriverPutAdmError
RdbBeDriverPutKeyError
RdbBeDriverPutVtxError
RdbBeDriverWriteError
RdbBeTypeUnsupported
RdbBeWrSessionUnfinished
RdbBeWrTriggerActiveAlready
RdbBeWrTriggerNilFn
RdbGuestInstanceAborted
RdbGuestInstanceUnsupported
RdbHashKeyExpected
# Transaction wrappers
TxAccRootMissing
TxArgStaleTx
TxArgsUseless
TxBackendNotWritable
TxLevelTooDeep
TxLevelUseless
TxNoPendingTx
TxNotFound
TxNotTopTx
TxPendingTx
TxStackGarbled
TxStackUnderflow
TxPrettyPointlessLayer
TxStateRootMismatch
# Functions from `aristo_desc.nim`
MustBeOnCentre
NotAllowedOnCentre
StaleDescriptor
# Functions from `aristo_utils.nim`
AccRlpDecodingError
AccStorageKeyMissing
AccVtxUnsupported
AccNodeUnsupported
PayloadTypeUnsupported
UtilsAccPathMissing
UtilsAccPathWithoutLeaf
UtilsAccInaccessible
UtilsAccWrongStorageRoot
UtilsStoRootInaccessible
UtilsStoRootMissing
UtilsAccLeafPayloadExpected
# Miscelaneous handy helpers
AccRootUnacceptable
MptRootUnacceptable
MptRootMissing
NotImplemented
TrieInvalid
VidContextLocked
# End