Skip to content

Conversation

@chfast
Copy link
Member

@chfast chfast commented Sep 13, 2023

MPT: Remove explicit extended node kind

Notice that the formally specified extended node in
the Merkle Patricia Trie always leads to a branch node.
Therefore, we can treat branch nodes as having potentially non-empty
"extended path" and remove the explicit extended node kind.
This significantly simplifies the implementation.

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.29%. Comparing base (b1f68a3) to head (2314743).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #703   +/-   ##
=======================================
  Coverage   94.29%   94.29%           
=======================================
  Files         143      143           
  Lines       16145    16110   -35     
=======================================
- Hits        15224    15191   -33     
+ Misses        921      919    -2     
Flag Coverage Δ
eof_execution_spec_tests 16.47% <100.00%> (-0.16%) ⬇️
ethereum_tests 26.76% <100.00%> (-0.15%) ⬇️
ethereum_tests_silkpre 18.52% <100.00%> (-0.16%) ⬇️
execution_spec_tests 17.55% <100.00%> (-0.17%) ⬇️
unittests 89.72% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
test/state/mpt.cpp 100.00% <100.00%> (+1.81%) ⬆️

@chfast chfast force-pushed the mpt_branch branch 2 times, most recently from fcb7222 to 75ec69a Compare December 20, 2023 10:03
@chfast chfast changed the base branch from master to mpt/path_mismatch December 20, 2023 10:08
@chfast chfast marked this pull request as ready for review December 20, 2023 11:27
@chfast chfast force-pushed the mpt/path_mismatch branch 5 times, most recently from 42f8279 to ce0bca3 Compare January 2, 2024 18:58
@chfast chfast self-assigned this Jan 5, 2024
@chfast chfast force-pushed the mpt/path_mismatch branch 2 times, most recently from b4727c9 to f6bd4c1 Compare January 5, 2024 21:30
Base automatically changed from mpt/path_mismatch to master January 5, 2024 21:56
@chfast chfast force-pushed the mpt_branch branch 2 times, most recently from 11af3f5 to 60c37ca Compare January 6, 2024 20:37
@chfast
Copy link
Member Author

chfast commented Jan 6, 2024

After extracting refactoring to #751, this is finally ready for review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies the Merkle Patricia Trie (MPT) implementation by removing the explicit extended node type and treating branch nodes as having potentially non-empty extended paths instead.

  • Removes the ext enum value from the Kind enum, changing it from uint8_t to bool
  • Eliminates extended node creation methods and simplifies branch node construction
  • Refactors the encoding logic to handle extended paths within branch nodes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.14%. Comparing base (6b94215) to head (2d4b262).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #703      +/-   ##
==========================================
- Coverage   87.15%   87.14%   -0.01%     
==========================================
  Files         167      167              
  Lines       24751    24701      -50     
  Branches     4068     4063       -5     
==========================================
- Hits        21571    21525      -46     
+ Misses        541      538       -3     
+ Partials     2639     2638       -1     
Flag Coverage Δ
eest-develop 17.59% <100.00%> (-0.16%) ⬇️
eest-develop-gmp 15.62% <97.14%> (-0.13%) ⬇️
eest-fusaka 12.23% <94.28%> (-0.09%) ⬇️
eest-legacy 11.13% <100.00%> (-0.15%) ⬇️
eest-legacy-silkpre 17.61% <97.14%> (-0.15%) ⬇️
eest-static 18.64% <97.14%> (-0.15%) ⬇️
evmone-unittests 83.70% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 93.30% <100.00%> (+<0.01%) ⬆️
tooling 88.35% <ø> (ø)
tests 84.10% <ø> (ø)
Files with missing lines Coverage Δ
test/state/mpt.cpp 96.03% <100.00%> (+1.33%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Notice that the formally specified extended node in
the Merkle Patricia Trie always leads to a branch node.
Therefore, we can treat branch nodes as having potentially non-empty
"extended path" and remove the explicit extended node kind.
This significantly simplifies the implementation.
@chfast chfast merged commit ce78921 into master Aug 13, 2025
24 checks passed
@chfast chfast deleted the mpt_branch branch August 13, 2025 10:08
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.

3 participants