Skip to content
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

TrieLog shipping prep #5317

Merged

Conversation

garyschulte
Copy link
Contributor

@garyschulte garyschulte commented Apr 6, 2023

PR description

prep bonsai for trielog shipping
add zero reads of slot storage and accounts to bonsai accumulator storageToUpdate and accountsToUpdate

Fixed Issue(s)

protocols-misc 707

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.
  • I have considered running ./gradlew acceptanceTestNonMainnet locally if my PR affects non-mainnet modules.
  • I thought about the changelog and included a changelog update if required.

@garyschulte garyschulte changed the title Zkbesu 707/accumulator zero reads accumulator zero reads Apr 6, 2023
@garyschulte garyschulte changed the title accumulator zero reads TrieLog shipping prep Apr 6, 2023
@garyschulte garyschulte force-pushed the zkbesu-707/accumulator-zero-reads branch 4 times, most recently from 8727fbf to 7419e59 Compare April 13, 2023 03:19
@garyschulte garyschulte force-pushed the zkbesu-707/accumulator-zero-reads branch from 966aa5d to 5ac40b7 Compare April 18, 2023 21:46
@garyschulte garyschulte marked this pull request as ready for review April 19, 2023 00:19
@garyschulte garyschulte force-pushed the zkbesu-707/accumulator-zero-reads branch from 3a0478c to 924193a Compare April 19, 2023 21:43
@macfarla
Copy link
Contributor

Files without headers: /home/circleci/project/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/bonsai/trielog/TrieLogLayerTests.java

Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok. couple of comments

@garyschulte garyschulte force-pushed the zkbesu-707/accumulator-zero-reads branch from a9630ea to aba0b39 Compare April 20, 2023 00:07
@garyschulte garyschulte enabled auto-merge (squash) April 20, 2023 00:07
@garyschulte garyschulte merged commit 9eec16e into hyperledger:main Apr 20, 2023
@garyschulte garyschulte deleted the zkbesu-707/accumulator-zero-reads branch April 20, 2023 01:25
var val = slotUpdate.getValue();

if (val.getPrior() == null && val.getUpdated() == null) {
// by default do not persist empty reads to the trie log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need enough to prove absence when Verkle Tries happen. Something to keep in mind but I don't think now is the time to address it.

@@ -69,6 +71,10 @@ public synchronized void saveTrieLog(
try {
final TrieLogLayer trieLog = prepareTrieLog(forBlockHeader, localUpdater);
persistTrieLog(forBlockHeader, forWorldStateRootHash, trieLog, stateUpdater);

// notify trie log added observers, synchronously
trieLogAddedObservers.forEach(o -> o.onTrieLogAdded(new TrieLogAddedEvent(trieLog)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to notify subscribers synchronously ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besu's observer notification precedent is synchronous. I put this comment here to call out that we are conforming to that precedent, but this might be a good candidate for handling async here rather than in the observer itself. Since we don't have any observers yet, IMO it didn't warrant creating that behavior (yet?)

@@ -512,6 +502,10 @@ private void importIntoTrieLog(final TrieLogLayer layer, final Hash blockHash) {
newValue.getBalance(),
newValue.getStorageRoot(),
newValue.getCodeHash());
if (oldValue == null && newValue == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

Copy link
Contributor

@matkt matkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comment

elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
* trielog save event, observer, test
* add zero read slots to Accumulator storageToUpdate, omit zero read slots from trielog generation
* add account zero reads, mark self-destructed accounts, code and storage as cleared

Signed-off-by: garyschulte <[email protected]>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* trielog save event, observer, test
* add zero read slots to Accumulator storageToUpdate, omit zero read slots from trielog generation
* add account zero reads, mark self-destructed accounts, code and storage as cleared

Signed-off-by: garyschulte <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants