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

VMState doesn't handle PoA/Clique block header difficulty field #1105

Closed
jangko opened this issue May 29, 2022 · 0 comments
Closed

VMState doesn't handle PoA/Clique block header difficulty field #1105

jangko opened this issue May 29, 2022 · 0 comments

Comments

@jangko
Copy link
Contributor

jangko commented May 29, 2022

current implementation only handle PoS and PoW difficulty. PoA/Clique difficulty is not handled at all.
a call to DIFFICULTY opcode when executing clique chain will return PoW difficulty instead of Clique block header difficulty.

method difficulty*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
  if vmState.ttdReached:
    # EIP-4399/EIP-3675
    UInt256.fromBytesBE(vmState.prevRandao.data, allowPadding = false)
  else:
    vmState.chainDB.config.calcDifficulty(vmState.timestamp, vmState.parent)

EVMC handle this situation better as it just copy the difficulty from block header instead of calculating it.

jangko added a commit that referenced this issue Jun 14, 2022
- in vmState
- in txpool
- in sealing engine

fix #1105
jangko added a commit that referenced this issue Jun 14, 2022
- in vmState
- in txpool
- in sealing engine

fix #1105
@jangko jangko closed this as completed in 77be2f6 Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant