Commit Graph

8 Commits

Author SHA1 Message Date
Jacek Sieka 6bd6bae86c
Align core types with execution spec (#733)
Since these types were written, we've gained an executable spec:

https://github.com/ethereum/execution-specs

This PR aligns some of the types we use with this spec to simplify
comparisons and cross-referencing.

Using a `distinct` type is a tradeoff between nim ergonomics, type
safety and the ability to work around nim quirks and stdlib weaknesses.

In particular, it allows us to overload common functions such as `hash`
with correct and performant versions as well as maintain control over
string conversions etc at the cost of a little bit of ceremony when
instantiating them.

Apart from distinct byte types, `Hash32`, is introduced in lieu of the
existing `Hash256`, again aligning this commonly used type with the spec
which picks bytes rather than bits in the name.
2024-09-29 10:52:19 +02:00
Jacek Sieka 56f72c7a66
Revert speedups (#718)
* Revert "hash compatibility fix (#717)"

This reverts commit 047de2b788.

* Revert "port eth2_digest speedups to eth_hash (#716)"

This reverts commit 864d54467e.
2024-08-09 07:20:35 +02:00
Jacek Sieka 047de2b788
hash compatibility fix (#717) 2024-08-09 06:23:56 +02:00
Jacek Sieka 864d54467e
port eth2_digest speedups to eth_hash (#716)
* port eth2_digest speedups to eth_hash

* faster comparison
* `hash` integration
* lower-case printing
2024-08-08 05:44:15 +00:00
Jacek Sieka b9b522f7ac
keccak doesn't need `init` (#693) 2024-06-07 22:30:32 +02:00
Jacek Sieka c02e050db8
avoid `burnMem` for `keccakHash` (#691)
We don't need to clear keccak context after hashing ethereum data since
it is already public - similar to
https://github.com/status-im/nimbus-eth2/pull/222.

Because we overwrite the result fully, we also don't need to zero first.
2024-06-07 16:27:38 +02:00
tersec 7564b21ade
support only Nim 1.6+ (#606) 2023-05-09 20:19:44 +00:00
Jacek Sieka d31abca010
clean up eth_types (#531)
`eth_types` is being imported from many projects and ends up causing
long build times due to its extensive import lists - this PR starts
cleaning some of that up by moving the chain DB and RLP to their own
modules.

this PR also moves `keccakHash` to its own module and uses it in many
places.
2022-09-02 16:57:52 +02:00