-
Notifications
You must be signed in to change notification settings - Fork 765
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
Update merkle-patricia-tree to v4, move account trie-related methods to StateManager #787
Conversation
Codecov Report
@@ Coverage Diff @@
## master #787 +/- ##
==========================================
- Coverage 84.40% 84.34% -0.07%
==========================================
Files 19 17 -2
Lines 1257 1233 -24
Branches 249 246 -3
==========================================
- Hits 1061 1040 -21
+ Misses 126 125 -1
+ Partials 70 68 -2
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
Just had a first look, phew, nice PR! 😄 |
60b5f5c
to
67a85b2
Compare
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 looks good, phew, great work! 👍 😄 🎉
@@ -141,7 +144,7 @@ export default class DefaultStateManager implements StateManager { | |||
async _lookupStorageTrie(address: Buffer): Promise<Trie> { | |||
// from state trie | |||
const account = await this.getAccount(address) | |||
const storageTrie = this._trie.copy() | |||
const storageTrie = this._trie.copy(false) |
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, this one was important to maintain the original behavior.
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.
Late review — I see the code was merged while I was reviewing. Good work, though. I like how the new syntax looks like and the test suite improvements.
@@ -48,7 +48,6 @@ | |||
"@types/bn.js": "^4.11.6", | |||
"@types/node": "^11.13.4", | |||
"@types/tape": "^4.13.0", | |||
"merkle-patricia-tree": "^3.0.0", |
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.
👍
@@ -43,7 +43,7 @@ | |||
"@ethereumjs/tx": "^2.1.2", | |||
"@types/bn.js": "^4.11.6", | |||
"ethereumjs-util": "^7.0.2", | |||
"merkle-patricia-tree": "^2.3.2" | |||
"merkle-patricia-tree": "^4.0.0" |
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.
👍
} | ||
}) | ||
}) | ||
await this.txTrie.put(rlp.encode(txIndex), tx.serialize()) |
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.
yeah, that's much better :)
account.balance.toString('hex') === '' && | ||
account.codeHash.toString('hex') === KECCAK256_NULL_S | ||
) | ||
return account.isEmpty() | ||
} | ||
|
||
/** |
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 PR:
merkle-patricia-tree
to v4getCode
,setCode
,getStorage
,setStorage
promisify
s