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

vm: add tx receipt to RunTxResult, allow BlockBuilder to build a block with zero txs #1185

Merged
merged 18 commits into from
Apr 9, 2021

Conversation

ryanio
Copy link
Contributor

@ryanio ryanio commented Apr 5, 2021

This PR:

  • Adds receipt to RunTxResult
    • Moves the tx receipt generation logic from runBlock to runTx
    • Requested by @alcuadrado
  • Fixes BlockBuilder to allow building a block with zero txs
  • AccessListEIP2930Transaction: adds alias type for transactionType so it can be interpreted correctly when passed to fromTxData
  • TransactionFactory: For extra safety, adds toBuffer on txData.type in case a 0x-prefixed hex string is passed in
  • Adds types test from @alcuadrado to ensure that the actual objects can be safely used as their data types
  • Adds test cases for legacy and access list transactions to runBlock
  • BlockBuilder: Moves the stateManager.commit to after putting the block in blockchain in case it throws on validating

@codecov
Copy link

codecov bot commented Apr 5, 2021

Codecov Report

Merging #1185 (582ed17) into master (36e7396) will decrease coverage by 0.18%.
The diff coverage is 82.14%.

Impacted file tree graph

Flag Coverage Δ
block 82.25% <ø> (+0.20%) ⬆️
blockchain 84.23% <ø> (+0.06%) ⬆️
client 84.03% <ø> (ø)
common 87.39% <ø> (ø)
devp2p 83.96% <ø> (-0.17%) ⬇️
ethash 82.08% <ø> (ø)
tx 81.98% <61.53%> (+0.22%) ⬆️
vm 81.97% <88.37%> (-1.67%) ⬇️

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

packages/vm/lib/runTx.ts Outdated Show resolved Hide resolved
@alcuadrado
Copy link
Member

I'd also add a test that does runBlock with a legacy and an access list transaction. That would help ensure that the problem with recreating txs doesn't come back.

@holgerd77
Copy link
Member

Updated the branch here (have tested locally with a rebase before).

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.

Great PR in general 😀 , have some further remarks though which needs to be addressed.

Realistically I think it is too rushed to still do a release here (and also including the tx bug reports) still until the end of the week, but we can target early next week for a new release.

packages/tx/src/eip2930Transaction.ts Outdated Show resolved Hide resolved
packages/vm/lib/runBlock.ts Show resolved Hide resolved
packages/vm/lib/runTx.ts Outdated Show resolved Hide resolved
packages/vm/tests/api/types.spec.ts Show resolved Hide resolved
packages/vm/lib/runBlock.ts Show resolved Hide resolved
await simpleRun(vm, [tx])
t.end()
})
})
Copy link
Member

Choose a reason for hiding this comment

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

So, for the release notes: did runBlock() previously not work with typed txs or are these just additional tests for safety reasons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there was a bug in the block constructor would recreate a AccessListEIP2930Transaction as a legacy transaction (due to the missing type field, solved by the newly introduced alias). these tests were added to ensure the bug was fixed, and so it won't be reintroduced in the future (#1185 (comment))

packages/vm/lib/buildBlock.ts Show resolved Hide resolved
@holgerd77
Copy link
Member

Update: ah, took a step back here. Maybe we can do a release tomorrow, but very much depends on the subsequent discussion and decisions here.

Generally #1189 is a lot more pressing, in doubt we should do a bugfix release in between tomorrow.

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.

LGTM, thanks a lot! 😄

@holgerd77 holgerd77 merged commit d34ba90 into master Apr 9, 2021
@holgerd77 holgerd77 deleted the vm-updates branch April 9, 2021 07:59
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.

3 participants