nimbus-eth1/nimbus/utils
Jordan Hrycaj a84a2131cd
No ext update (#2494)
* Imported/rebase from `no-ext`, PR #2485

  Store extension nodes together with the branch

  Extension nodes must be followed by a branch - as such, it makes sense
  to store the two together both in the database and in memory:

  * fewer reads, writes and updates to traverse the tree
  * simpler logic for maintaining the node structure
  * less space used, both memory and storage, because there are fewer
    nodes overall

  There is also a downside: hashes can no longer be cached for an
  extension - instead, only the extension+branch hash can be cached - this
  seems like a fine tradeoff since computing it should be fast.

  TODO: fix commented code

* Fix merge functions and `toNode()`

* Update `merkleSignCommit()` prototype

why:
  Result is always a 32bit hash

* Update short Merkle hash key generation

details:
  Ethereum reference MPTs use Keccak hashes as node links if the size of
  an RLP encoded node is at least 32 bytes. Otherwise, the RLP encoded
  node value is used as a pseudo node link (rather than a hash.) This is
  specified in the yellow paper, appendix D.

  Different to the `Aristo` implementation, the reference MPT would not
  store such a node on the key-value database. Rather the RLP encoded node value is stored instead of a node link in a parent node
  is stored as a node link on the parent database.

  Only for the root hash, the top level node is always referred to by the
  hash.

* Fix/update `Extension` sections

why:
  Were commented out after removal of a dedicated `Extension` type which
  left the system disfunctional.

* Clean up unused error codes

* Update unit tests

* Update docu

---------

Co-authored-by: Jacek Sieka <jacek@status.im>
2024-07-16 19:47:59 +00:00
..
debug.nim Remove EVM indirect imports and unused EVM errors (#2370) 2024-06-17 09:56:39 +02:00
ec_recover.nim Remove keyed_queue rlp support (#2300) 2024-06-06 00:01:18 +02:00
era_helpers.nim Shift era helpers to a different file (#2475) 2024-07-12 03:15:14 +00:00
prettify.nim Fix potential overflow error on toPC (#1458) 2023-02-02 09:30:14 +01:00
state_dump.nim Cache code and invalid jump destination tables (fixes #2268) (#2404) 2024-06-21 09:44:10 +02:00
utils.nim No ext update (#2494) 2024-07-16 19:47:59 +00:00
utils_defs.nim implementation of EIP-4844: Shard Blob Transactions (#1440) 2023-06-24 20:56:44 +07:00