Skip to content

Flat/snap sync#10426

Draft
asdacap wants to merge 9 commits intoperf/simple-flatfrom
flat/snap-sync
Draft

Flat/snap sync#10426
asdacap wants to merge 9 commits intoperf/simple-flatfrom
flat/snap-sync

Conversation

@asdacap
Copy link
Contributor

@asdacap asdacap commented Feb 6, 2026

Fixes Closes Resolves #

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@asdacap asdacap force-pushed the flat/snap-sync branch 3 times, most recently from 4e0cd11 to ecd1d6b Compare February 8, 2026 00:04
return rlp is not null && ValueKeccak.Compute(rlp) == keccak;
}

public void Clear() => _tree.RootHash = Keccak.EmptyTreeHash;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clear not needed anymore.

public void BulkSet(in ArrayPoolListRef<PatriciaTree.BulkSetEntry> entries, PatriciaTree.Flags flags) =>
_tree.BulkSet(entries, flags);

public void UpdateRootHash() => _tree.UpdateRootHash();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be embedded as part of BulkSet.

public class FlatSnapTrieFactory(IPersistence persistence, ILogManager logManager) : ISnapTrieFactory
{
private ILogger _logger = logManager.GetClassLogger<FlatSnapTrieFactory>();
private bool _databaseInitiallyCleared = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably should be "_initialized".

}
}

public Hash256? ResolveStorageRoot(byte[] nodeData)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does not need to have different implementation between snap and patricia tree.

@asdacap asdacap mentioned this pull request Feb 9, 2026
4 tasks
asdacap and others added 7 commits February 9, 2026 09:01
Squashed commits:
- Parallelize FlatTrieVerifier with partition-based verification
- Snap trie store and factory implementation
- Tree sync abstraction and store implementation
- Snap server and provider helper
- Key deletion logic and tests
- Inline node handling and verifier fixes
- E2E fixes and sync hook
- Storage range split support
- Interface reduction and cleanup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
}

[Test]
public void WriteAccountFlatEntries_BranchAndExtension_WithHashReferences_WritesNothing()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extensioon cannot have child leaf

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.

1 participant