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

refactor(trie): store opts in private property with defaults #2224

Merged
merged 38 commits into from
Aug 24, 2022

Conversation

faustbrian
Copy link
Contributor

Leaving as draft until #2215 is merged

Instead of having separate properties for everything we can use a default object, merge properties and then access everything through that object.

holgerd77 and others added 30 commits August 23, 2022 12:32
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
Signed-off-by: Brian Faust <[email protected]>
@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Merging #2224 (2993f6e) into master (fffe4ab) will increase coverage by 0.17%.
The diff coverage is 100.00%.

❗ Current head 2993f6e differs from pull request most recent head 789c7fe. Consider uploading reports for the commit 789c7fe to get more accurate results

Impacted file tree graph

Flag Coverage Δ
block 92.98% <ø> (ø)
blockchain 88.88% <ø> (?)
client 87.00% <ø> (ø)
common 59.55% <ø> (ø)
devp2p 92.25% <ø> (-0.09%) ⬇️
ethash ∅ <ø> (∅)
evm 79.07% <ø> (ø)
rlp ∅ <ø> (∅)
statemanager 88.15% <ø> (ø)
trie 89.94% <100.00%> (-0.01%) ⬇️
tx 97.98% <ø> (ø)
util 92.33% <ø> (ø)
vm 85.24% <ø> (ø)

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

Base automatically changed from trie-checkpoint-option to master August 24, 2022 09:46
@faustbrian
Copy link
Contributor Author

@holgerd77 conflicts resolved

@faustbrian faustbrian marked this pull request as ready for review August 24, 2022 10:03
@faustbrian faustbrian requested a review from holgerd77 August 24, 2022 10:27
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Oh this is a beauty, wonder if we want to last-minute do for the other libraries too? 🤔 (some substantial amount of work though, so at least 1 person, 1 day, but might be worth it, eventually we can also still be doing between RC and final but before would likely be better).

Anyhow, so would give an approval here as well (not formally yet).

@@ -35,38 +35,39 @@ interface Path {
* The API for the base and the secure interface are about the same.
*/
export class Trie {
#opts: TrieOptsWithDefaults = {
Copy link
Member

Choose a reason for hiding this comment

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

What is this # standing for respectively doing? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The TLDR is a real private property, not just a visibility modifier like private which has no effect at runtime. Visibility modifiers other than # don't actually make those properties inaccessible once the code is turned into JS.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, just googled a bit, this is an ES2022 property which is beyond our build target, let's please not introduce any new language constructs here last minute.

This property is super useful, but not anything any more for this round of breaking releases. I can very well imagine a broad set of refactoring around this along the next breaking release round. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@holgerd77
Copy link
Member

So I could take this in for inclusion as well.

@faustbrian faustbrian changed the base branch from master to big-messy-bunch August 24, 2022 11:43
@faustbrian faustbrian merged commit b982dd5 into big-messy-bunch Aug 24, 2022
@faustbrian faustbrian deleted the opts-default-prop branch August 24, 2022 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants