-
Notifications
You must be signed in to change notification settings - Fork 781
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
trie: trie package renaming to mpt #3719
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments. We should also update https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/README.md (and update the picture with dependencies to use mpt instead of trie)
packages/block/package.json
Outdated
@@ -49,7 +49,7 @@ | |||
"dependencies": { | |||
"@ethereumjs/common": "^4.4.0", | |||
"@ethereumjs/rlp": "^5.0.2", | |||
"@ethereumjs/trie": "^6.2.1", | |||
"@ethereumjs/mpt": "^6.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is clean in the PR, do we want this rename + keep the same version here? 🤔 (I realize that this will likely mean we need a release of the new package though to pass CI - or will this be handled correctly?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same, seemed weird not to update the version at all
@@ -65,7 +65,7 @@ | |||
"@ethereumjs/evm": "2.1.0", | |||
"@ethereumjs/rlp": "5.0.1", | |||
"@ethereumjs/statemanager": "2.1.0", | |||
"@ethereumjs/trie": "6.0.1", | |||
"@ethereumjs/mpt": "6.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This points to mpt 6.0.1 which will (likely?) not hit a package at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated everything to 6.2.2
@@ -1,5 +1,5 @@ | |||
import { decodeNode } from '@ethereumjs/mpt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm upon seeing this I realized that when renaming the MPT methods we might not have renamed them all.
I checked the MPT exports: (might be good to look over those all to see if we can make any improvements here)
{
createMPT: [Getter],
createMPTFromProof: [Getter],
CheckpointDB: [Getter],
MerklePatriciaTrie: [Getter],
BranchMPTNode: [Getter],
ExtensionMPTNode: [Getter],
LeafMPTNode: [Getter],
decodeRawNode: [Getter],
isRawNode: [Getter],
decodeNode: [Getter],
verifyMPTProof: [Getter],
verifyMPTRangeProof: [Getter],
createMerkleProof: [Getter],
updateMPTFromMerkleProof: [Getter],
verifyMerkleProof: [Getter],
verifyRangeProof: [Getter],
ROOT_DB_KEY: [Getter],
hasTerminator: [Getter],
nibblesToBytes: [Getter],
hexToKeybytes: [Getter],
nibblesToCompactBytes: [Getter],
bytesToNibbles: [Getter],
compactBytesToNibbles: [Getter],
nibbleTypeToByteType: [Getter],
byteTypeToNibbleType: [Getter],
pathToHexKey: [Getter],
mergeAndFormatKeyPaths: [Getter],
genesisStateRoot: [Getter],
WalkController: [Getter]
}
Suggestions for rename:
decodeRawNode
-> decodeRawMPTNode
isRawNode
-> isRawMPTNode
decodeNode
-> decodeMPTNode
Names which might not be specific enough:
hasTerminator
We also have verifyMerkleProof
, createMerkleProof
, verifyRangeProof
, this starts to get somewhat confusing? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm upon seeing this I realized that when renaming the MPT methods we might not have renamed them all.
I checked the MPT exports: (might be good to look over those all to see if we can make any improvements here)
{ createMPT: [Getter], createMPTFromProof: [Getter], CheckpointDB: [Getter], MerklePatriciaTrie: [Getter], BranchMPTNode: [Getter], ExtensionMPTNode: [Getter], LeafMPTNode: [Getter], decodeRawNode: [Getter], isRawNode: [Getter], decodeNode: [Getter], verifyMPTProof: [Getter], verifyMPTRangeProof: [Getter], createMerkleProof: [Getter], updateMPTFromMerkleProof: [Getter], verifyMerkleProof: [Getter], verifyRangeProof: [Getter], ROOT_DB_KEY: [Getter], hasTerminator: [Getter], nibblesToBytes: [Getter], hexToKeybytes: [Getter], nibblesToCompactBytes: [Getter], bytesToNibbles: [Getter], compactBytesToNibbles: [Getter], nibbleTypeToByteType: [Getter], byteTypeToNibbleType: [Getter], pathToHexKey: [Getter], mergeAndFormatKeyPaths: [Getter], genesisStateRoot: [Getter], WalkController: [Getter] }
Suggestions for rename:
decodeRawNode
->decodeRawMPTNode
isRawNode
->isRawMPTNode
decodeNode
->decodeMPTNode
Names which might not be specific enough:
hasTerminator
We also have
verifyMerkleProof
,createMerkleProof
,verifyRangeProof
, this starts to get somewhat confusing? 🤔
I have now:
- Updated all the ones you have suggested
- Removed the
hasTerminator
export. It is only used as a helper within the file it's being declared, and it's unlikely that external usage would require such a niche and implementation-specific helper imo. - I am currently going through the different methods that have non-mpt names and trying to take this opportunity to make them clearer. Easy example is
genesisStateRoot
->genesisMPTStateRoot
. The merkle proofs are a bit more tricky since there is some overlap in naming, need to first familiarize myself with what each of them does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, will take a look. Did you also see Holger's comment on the previously merged PR? :) #3718 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is now in a state where this can be reviewed again. I believe I've gone through all the renamings and made them clearer when possible.
"bugs": { | ||
"url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+trie%22" | ||
"url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+mpt%22" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, we should remove the package: trie
label (or at least add package: mpt
label) and update our general issue template to also point to the mpt label and not the trie label.
1533156
to
f564f41
Compare
…ethereumjs/ethereumjs-monorepo into trie/rename-trie-package-to-mpt
Side note: for this PR the |
Good point! I do not think I have permission to do this. Neither can I edit the issue template, which should be renamed from |
I think Holger is the only person who has admin rights to do so :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I am sold on everything, thanks for the extensive answers and continued discussions on how to properly name things! 🤩
I've adjusted the CI mpt/trie thing (also for future runs), browser tests were hanging, seemed unrelated but I have for now deactivated so that we can merge this huge beast in. We should have an eye upon that though and eventually fix on follow-up.
What's with |
This one, to my knowledge, is only used internally by the |
Respectively: it's only |
(in case you do a PR here, can you also update and put the code from |
Done here: #3730 |
This PR renames the trie package to mpt