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

Integrate promises into StateManager #719

Merged
merged 5 commits into from Apr 24, 2020

Conversation

ryanio
Copy link
Contributor

@ryanio ryanio commented Apr 16, 2020

This PR:

  • Integrates promises into StateManager, resolving the need for PStateManager.
  • Upgrades node version used for VM workflows in GH Actions from 8.x to 12.x.

Diff views: stateManager.ts, state/cache.ts

@lgtm-com

This comment has been minimized.

@holgerd77
Copy link
Member

Context: PStateManager has been introduced here #480

@ryanio ryanio force-pushed the stateManager/integratePromises branch 5 times, most recently from eb7d255 to d061157 Compare April 17, 2020 07:27
@ethereumjs ethereumjs deleted a comment from lgtm-com bot Apr 17, 2020
@ethereumjs ethereumjs deleted a comment from lgtm-com bot Apr 17, 2020
@ryanio ryanio force-pushed the stateManager/integratePromises branch from d061157 to 8a8bd4a Compare April 17, 2020 07:42
@lgtm-com

This comment has been minimized.

@ryanio ryanio force-pushed the stateManager/integratePromises branch from 8a8bd4a to d137095 Compare April 17, 2020 07:56
@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

Merging #719 into master will increase coverage by 0.65%.
The diff coverage is 93.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #719      +/-   ##
==========================================
+ Coverage   91.01%   91.66%   +0.65%     
==========================================
  Files          48       46       -2     
  Lines        3059     2998      -61     
  Branches      498      469      -29     
==========================================
- Hits         2784     2748      -36     
+ Misses        157      151       -6     
+ Partials      118       99      -19     
Flag Coverage Δ
#account 94.11% <ø> (ø)
#block 88.09% <ø> (ø)
#blockchain 88.74% <ø> (ø)
#common 94.37% <ø> (ø)
#tx 94.02% <ø> (-0.09%) ⬇️
#vm 92.53% <93.36%> (+1.02%) ⬆️
Impacted Files Coverage Δ
packages/vm/lib/evm/eei.ts 94.53% <ø> (ø)
packages/vm/lib/evm/opFns.ts 89.60% <85.71%> (+0.23%) ⬆️
packages/vm/lib/state/stateManager.ts 91.37% <91.26%> (+11.46%) ⬆️
packages/vm/lib/state/cache.ts 97.36% <97.36%> (+5.50%) ⬆️
packages/vm/lib/evm/evm.ts 91.97% <100.00%> (ø)
packages/vm/lib/evm/interpreter.ts 98.18% <100.00%> (ø)
packages/vm/lib/evm/precompiles/01-ecrecover.ts 100.00% <100.00%> (ø)
packages/vm/lib/evm/precompiles/02-sha256.ts 100.00% <100.00%> (ø)
packages/vm/lib/evm/precompiles/03-ripemd160.ts 100.00% <100.00%> (ø)
packages/vm/lib/evm/precompiles/04-identity.ts 100.00% <100.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36fde16...6b700bf. Read the comment docs.

@lgtm-com

This comment has been minimized.

@ryanio ryanio force-pushed the stateManager/integratePromises branch from d137095 to c85fc11 Compare April 17, 2020 08:02
@ryanio ryanio marked this pull request as ready for review April 17, 2020 08:03
@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request fixes 1 alert when merging c85fc11 into 9cbf19b - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@holgerd77
Copy link
Member

Thanks @ryanio, that's really great work! 😄 The "VM Test / test-api" suite is still failing, this would need some fix.

Some note: I think it would make sense (likely separate PR if we decide) to prefix the job names in the workflows with the name of the package, e.g. test-api for the VM.

These are shown in the branch protection rule settings page like this:

image

So it's not possible to differentiate or at least associate. I also not sure how this will behave on identically named jobs like test on the block workflow e.g..

I've now activated the three VM test jobs (test-api, test-state, test-blockchain) as required as a starter. Also not sure how this will behave in the new monorepo environment when these tests are not run and if GitHub will accept that.

@evertonfraga
Copy link
Contributor

evertonfraga commented Apr 17, 2020

GitHub UI is quite inconsistent now. All the four checks are from VM, yet the required ones does now show [logo] VM Test / as prefix.

image

@ryanio ryanio force-pushed the stateManager/integratePromises branch from c85fc11 to 437053d Compare April 17, 2020 18:48
@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request fixes 1 alert when merging 437053d into 8310617 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request fixes 1 alert when merging 3a3b69c into 8310617 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@ryanio
Copy link
Contributor Author

ryanio commented Apr 17, 2020

@holgerd77 great thanks I have resolved the failing build, so this PR is now ready for review :)

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.

Just some short starter, one change request, one question.

.github/workflows/vm-lint.yml Show resolved Hide resolved
packages/vm/package.json Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request fixes 1 alert when merging 26a9585 into 8310617 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@ryanio ryanio force-pushed the stateManager/integratePromises branch from 26a9585 to 073c358 Compare April 17, 2020 23:52
@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request fixes 1 alert when merging 073c358 into 8310617 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@holgerd77
Copy link
Member

@ryanio: just for info, @PhilippLgh will continue the review here.

Copy link
Contributor

@evertonfraga evertonfraga left a comment

Choose a reason for hiding this comment

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

Commits are not so easy to review, given the amount of linting changes. For the future, I propose to pack them in groups such as:

  1. Linting code
  2. VM docs
  3. Fix A
  4. Integrate B

@lgtm-com
Copy link

lgtm-com bot commented Apr 21, 2020

This pull request fixes 1 alert when merging 6b700bf into 36fde16 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

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.

Have continued here a bit. Short progress update: now at 34 / 51 files viewed. 😄

@@ -73,7 +71,7 @@ async function runTx(vm: VM, rawTx: any, privateKey: Buffer) {

main()
.then(() => process.exit(0))
.catch(error => {
.catch((error) => {
console.error(error)
process.exit(1)
})
Copy link
Member

Choose a reason for hiding this comment

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

Ok, all example changes look good.

return { current, original }
} else {
return current
}
Copy link
Member

Choose a reason for hiding this comment

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

Ok.

@@ -186,7 +184,7 @@ async function _runTx(this: VM, opts: RunTxOpts): Promise<RunTxResult> {
*/
if (results.execResult.selfdestruct) {
const keys = Object.keys(results.execResult.selfdestruct)
for (const k of keys) {
for await (const k of keys) {
Copy link
Member

Choose a reason for hiding this comment

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

Just for understanding: what is this double-await changing here?

Copy link
Member

Choose a reason for hiding this comment

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

@holgerd77 for await is for async iterators, but Object.keys does not return an async iterator, so this is a mistake

Copy link
Member

Choose a reason for hiding this comment

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

@ryanio nit ^

Copy link
Contributor Author

@ryanio ryanio Apr 25, 2020

Choose a reason for hiding this comment

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

@holgerd77 @kumavis noted, thanks, I will address in a follow-up PR.

edit: here it is #728

Copy link
Member

Choose a reason for hiding this comment

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

@kumavis thanks for having another look here! 🙂

const account = await this._lookupAccount(address)
this._update(address, account, false, false)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Phew. Nice. 😄

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.

Ok, just was on it and directly finished going through, thanks @ryanio, fantastic work done here 😄 🎉, looks good, will merge.

this._cache.del(address)
}
}
this._touched.clear()
Copy link
Member

Choose a reason for hiding this comment

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

Looks good. 😄 👍

@holgerd77 holgerd77 merged commit 2209887 into master Apr 24, 2020
@holgerd77 holgerd77 deleted the stateManager/integratePromises branch April 24, 2020 20:34
@holgerd77 holgerd77 mentioned this pull request May 11, 2020
27 tasks
@evertonfraga evertonfraga added this to the VM v5 milestone Jun 12, 2020
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.

None yet

4 participants