-
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
StateManager interface #763
Conversation
Codecov Report
@@ Coverage Diff @@
## master #763 +/- ##
==========================================
+ Coverage 92.01% 92.06% +0.05%
==========================================
Files 47 46 -1
Lines 3018 3025 +7
Branches 472 471 -1
==========================================
+ Hits 2777 2785 +8
Misses 145 145
+ Partials 96 95 -1
Continue to review full report at Codecov.
|
Rebased master, that should hopefully fix the codecov issue? also should I rebuild the docs in the PR or is that done at release? |
This pull request introduces 1 alert when merging 255c51f into 61c3dca - view on LGTM.com new alerts:
|
@s1na I got started late today, but it seems Codecov issue is gone. And LGTM finally finished its report. |
const trie = this.stateManager._trie | ||
const put = promisify(trie.put.bind(trie)) | ||
for (let i = 1; i <= 8; i++) { | ||
await put(new BN(i).toArrayLike(Buffer, 'be', 20), new Account().serialize()) | ||
} | ||
this.stateManager.checkpoint() | ||
Object.keys(precompiles) | ||
.map((k: string): Buffer => Buffer.from(k, 'hex')) | ||
.forEach(async (k: Buffer) => await this.stateManager.putAccount(k, new Account())) | ||
await this.stateManager.commit() |
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.
nice improvement
[key: string]: string | ||
} | ||
|
||
export interface StateManager { |
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.
👌
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.
looks great!
@s1na you can rebuild, I usually do it as a last commit. it would be a nice improvement to ensure docs automatically rebuild prior to release, @evertonfraga and I have already discussed this so it's on our (long) wishlist :)
I have a feeling it would be better in the interface, but I guess it depends how TypeDoc organizes and outputs them. Feel free to try both ways and pick which one you think results in better docs.
Seems good to me! I'll keep thinking about it. How do you anticipate future StateManagers might be named? that might give some insight. |
yeah, IMO having the docs generated for each PR change ensures the docs reflect exactly what’s on master branch. Thinking of people that land on the project to experiment, having tidy docs can only help them =) |
Note to self: |
Hi @s1na, before I move on with rebase & merge, I wanted to understand the aforementioned change. Pardon my ignorance (😄), but where exactly is this issue fixed, and what's the impact of the current state (eg: blake2f not operational)? |
Hey @evertonfraga, no it only fixes a small edge case. Contracts that call blake2f will work. For context on what Sorry I haven't the PR yet, my working tree for this branch is dirty because I just started working on the flat db without creating a new branch... will update now with re-built docs and dropping the |
@s1na thanks for the explanation! Yes, the I will now rebase and merge this PR. Sounds good? |
This pull request introduces 1 alert when merging 56a8731 into 6ac21f6 - view on LGTM.com new alerts:
|
Update: I made Oh and I'm not sure if this PR should be considered a breaking change due to Also tried rebuilding docs but couldn't get it to work, was constantly getting an error. If everything looks good the PR can be merged. |
Alright!
The VM will be bumped to v5.0.0 anyway, so we shouldn't worry much about it. I will, of course, make a note about this change in the release notes.
I'll handle it! |
This pull request introduces 1 alert when merging 282fdfb into 28b8fa4 - view on LGTM.com new alerts:
|
Short note: did a branch update here, hope that was ok, so that it might be merge-ready once CI pass. |
This pull request introduces 1 alert when merging 5ff3354 into 28b8fa4 - view on LGTM.com new alerts:
|
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.
LGTM
Thanks @holgerd77! |
So I've added an interface for the StateManager. Had to make a few other changes:
putAccount
._clearOriginalStorageCache
was private, made it public. The issue is thatStateManager
is persistent state, but the originalStorageCache should only persist for the duration of one tx.Should I move the docs to the interface or leave them in the implementation? Also please feel free to suggest better names for
DefaultStateManager
:D