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

allforks: Hive withdrawal fixes #2529

Merged
merged 13 commits into from
Feb 14, 2023
Merged

allforks: Hive withdrawal fixes #2529

merged 13 commits into from
Feb 14, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Feb 10, 2023

Fixes regarding failing hive testvectors

Closes #2498

  • tx hardfork mismatch fix where the starting client hardfork was not being properly set as the timestamp was not being used, fixed
  • check for withdrawals/excessdatagas missing on newPayload
  • Skip altering the canonical chain number to hash mapping on runWithoutSetHead / newPayload
  • Fix setting the hardfork on vm in getTransactionReceipt
  • Fix setting evm hardfork on copy
  • fix loading block/header which might not be in canonical chain

@g11tech g11tech added type: test all hardforks This special label enables VM state and blockchain tests for all hardforks on the respective PR. PR state: WIP target: master Work to be done towards master branch labels Feb 10, 2023
@g11tech g11tech force-pushed the hive-withdrawals-fx branch from 408660d to 369b642 Compare February 10, 2023 17:23
@g11tech g11tech changed the title allforks: Hive fixes regarding withdrawal test vectors allforks: Hive withdrawal fixes Feb 10, 2023
@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #2529 (858b8bd) into master (562b0ff) will increase coverage by 0.00%.
The diff coverage is 89.36%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 90.10% <ø> (ø)
blockchain 90.19% <100.00%> (+0.02%) ⬆️
client 87.79% <70.58%> (-0.03%) ⬇️
common 95.82% <ø> (ø)
devp2p 91.73% <ø> (+0.05%) ⬆️
ethash ∅ <ø> (∅)
evm 83.36% <100.00%> (+<0.01%) ⬆️
rlp ∅ <ø> (?)
statemanager 89.61% <ø> (ø)
trie 90.36% <ø> (ø)
tx 93.71% <ø> (ø)
util 84.48% <ø> (ø)
vm 84.05% <100.00%> (+0.05%) ⬆️

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

@jochem-brouwer
Copy link
Member

Some (more) fixes might be in this PR: #2507

(I honestly thought this was merged already)

Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

LGTM

@g11tech
Copy link
Contributor Author

g11tech commented Feb 14, 2023

Some (more) fixes might be in this PR: #2507

(I honestly thought this was merged already)

thanks @jochem-brouwer , yea we had incorporated fixes from there into this 👍

@g11tech g11tech merged commit 0cf9654 into master Feb 14, 2023
@holgerd77 holgerd77 deleted the hive-withdrawals-fx branch February 15, 2023 13:37
@@ -94,6 +94,8 @@ export class EEI extends VmState implements EEIInterface {
}

public copy() {
return new EEI(this._stateManager.copy(), this._common.copy(), this._blockchain.copy())
const common = this._common.copy()
common.setHardfork(this._common.hardfork())
Copy link
Member

Choose a reason for hiding this comment

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

Valid solution here, but I guess this hardfork setting should be functionality directly integrated into the Common copy() function? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't sure on this one. It might warrant further research on whether or not there is other "state" inside of common that needs to be copied along with the current hardfork. That is the most impactful one (as identified by our failing tests) but I'm not sure if there's more to be thought through here.

Copy link
Member

Choose a reason for hiding this comment

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

This got me a bit curious and a had another look, since on second thought it seemed extremely unlikely to me that our libraries would work at all if in the former setup Common.copy() wouldn't preserve the hardfork state. Tested this out and it turns out that it does, since it does copy property values as well in Common.copy().

You can test out the following code:

import { Common, Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Shanghai, eips: [4844] })
const common2 = common.copy()
common2.hardfork() // 'shanghai'

So seems we can delete these additional lines here again, the fixes seem to come from some other code changes in this PR. 🙂

EIPs are actually preserved as well, common2.eips() // [ 4844 ].

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, okay. That makes sense. I wasn't sure if the EEI was impacted or not. We certainly had a bug where copying VM resulted in separate common instances being created for the internal evm and EEI but maybe that was the limit of the issue.

@holgerd77
Copy link
Member

Had another look here, thanks🙏, this all looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: client package: evm package: vm PR state: needs review target: master Work to be done towards master branch type: test all hardforks This special label enables VM state and blockchain tests for all hardforks on the respective PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hive tests failing
4 participants