-
Notifications
You must be signed in to change notification settings - Fork 154
Use hash writer for aristo computeKey #3572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
chirag-parmar
wants to merge
15
commits into
master
Choose a base branch
from
hash-writer-aristo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+241
−63
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e68ae43
incomplete
chirag-parmar 92a55e6
commented code
chirag-parmar 6d2ae2a
use similar structure to ordered trie
chirag-parmar bdd4004
comment
chirag-parmar b991e71
reintroduce the line
chirag-parmar c55c531
Remove hack.
bhartnett a00b997
Remove unneeded usages of untyped. Update encodeExt to a func to prev…
bhartnett cd73383
review
chirag-parmar 838f783
Remove usages of auto in encodeLeaf.
bhartnett cd1841e
fix imports
chirag-parmar 581b3f5
Make encodeLeaf a func and store hashKeys in encodeBranch.
bhartnett 54b5cb9
Update execution_chain/db/aristo/aristo_compute.nim
bhartnett b85334d
static encoding
chirag-parmar e75b222
use static helpers in nim-eth
chirag-parmar d158632
Add compute benchmark test.
bhartnett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Nimbus | ||
| # Copyright (c) 2026 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. | ||
|
|
||
| {.used.} | ||
|
|
||
| import | ||
| std/times, | ||
| unittest2, | ||
| ../../execution_chain/db/aristo/[ | ||
| aristo_compute, | ||
| aristo_merge, | ||
| aristo_desc, | ||
| aristo_init/memory_only, | ||
| aristo_tx_frame, | ||
| ] | ||
|
|
||
| suite "Aristo compute benchmark": | ||
| const | ||
| NUM_THREADS = 16 | ||
| NUM_FRAMES = 10 | ||
| NUM_ACCOUNTS_PER_FRAME = 400000 | ||
|
|
||
| setup: | ||
| let db = AristoDbRef.init() | ||
| var txFrame = db.txRef | ||
|
|
||
| for i in 0 ..< NUM_ACCOUNTS_PER_FRAME: | ||
| check: | ||
| txFrame.mergeAccount( | ||
| cast[Hash32](i), | ||
| AristoAccount(balance: i.u256(), codeHash: EMPTY_CODE_HASH)) == Result[bool, AristoError].ok(true) | ||
| txFrame.checkpoint(1, skipSnapshot = true) | ||
|
|
||
| let batch = db.putBegFn()[] | ||
| db.persist(batch, txFrame) | ||
| check db.putEndFn(batch).isOk() | ||
|
|
||
| txFrame = db.baseTxFrame() | ||
|
|
||
| for n in 1 .. NUM_FRAMES: | ||
| txFrame = db.txFrameBegin(txFrame) | ||
|
|
||
| let | ||
| startIdx = NUM_ACCOUNTS_PER_FRAME * n | ||
| endIdx = startIdx + NUM_ACCOUNTS_PER_FRAME | ||
|
|
||
| for i in startIdx ..< endIdx: | ||
| check: | ||
| txFrame.mergeAccount( | ||
| cast[Hash32](i * i), | ||
| AristoAccount(balance: i.u256(), codeHash: EMPTY_CODE_HASH)) == Result[bool, AristoError].ok(true) | ||
|
|
||
| txFrame.checkpoint(1, skipSnapshot = false) | ||
|
|
||
|
|
||
| test "Serial benchmark - skipLayers = false": | ||
| debugEcho "\nSerial benchmark (skipLayers = false) running..." | ||
|
|
||
| let before = cpuTime() | ||
| check txFrame.computeKey((STATE_ROOT_VID, STATE_ROOT_VID)).isOk() | ||
| let elapsed = cpuTime() - before | ||
|
|
||
| debugEcho "Serial benchmark (skipLayers = false) cpu time: ", elapsed |
Submodule nim-eth
updated
4 files
| +4 −24 | eth/rlp/hash_writer.nim | |
| +3 −15 | eth/rlp/length_writer.nim | |
| +183 −0 | eth/rlp/static_encoder.nim | |
| +4 −23 | eth/rlp/two_pass_writer.nim |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.