cmd/evm: add difficulty calculation to t8n tool#23353
Merged
holiman merged 3 commits intoethereum:masterfrom Aug 25, 2021
Merged
cmd/evm: add difficulty calculation to t8n tool#23353holiman merged 3 commits intoethereum:masterfrom
holiman merged 3 commits intoethereum:masterfrom
Conversation
Contributor
Author
|
@winsvega does this work for you? |
|
|
||
| import ( | ||
| "fmt" | ||
| "github.com/ethereum/go-ethereum/consensus/ethash" |
c9900f7 to
17cc201
Compare
Contributor
Author
|
@winsvega ping -- does this fit your needs? |
Contributor
|
I guess. I can chek tomorrow. |
Contributor
|
we used to treat every field as string. like on the input: this started because there was some team. like JS implementation and they complained that it is difficult to parse different types in test jsons. so we have all the types in jsons as string. |
17cc201 to
fa218f1
Compare
Contributor
Author
|
@winsvega fixed: |
MariusVanDerWijden
approved these changes
Aug 25, 2021
Member
MariusVanDerWijden
left a comment
There was a problem hiding this comment.
LGTM, just a tiny question
74f716f to
04a7c52
Compare
sidhujag
pushed a commit
to sidhujag/go-ethereum
that referenced
this pull request
Aug 25, 2021
This PR adds functionality to the evm t8n to calculate ethash difficulty. If the caller does not provide a currentDifficulty, but instead provides the parentTimestamp (well, semi-optional, will default to 0 if not given), and parentDifficulty, we can calculate it for him. The caller can also provide a parentUncleHash. In most, but not all cases, the parent uncle hash also affects the formula. If no such hash is provided (or, if the empty all-zero hash is provided), it's assumed that there were no uncles.
This was referenced Sep 23, 2022
yongjun925
pushed a commit
to DODOEX/go-ethereum
that referenced
this pull request
Dec 3, 2022
This PR adds functionality to the evm t8n to calculate ethash difficulty. If the caller does not provide a currentDifficulty, but instead provides the parentTimestamp (well, semi-optional, will default to 0 if not given), and parentDifficulty, we can calculate it for him. The caller can also provide a parentUncleHash. In most, but not all cases, the parent uncle hash also affects the formula. If no such hash is provided (or, if the empty all-zero hash is provided), it's assumed that there were no uncles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds functionality to the
evm t8nto calculate ethash difficulty. If the caller does not provide acurrentDifficulty, but instead provides theparentTimestamp(well, semi-optional, will default to0if not given), andparentDifficulty, we can calculate it for him.The caller can also provide a
parentUncleHash. In most, but not all cases, the parent uncle hash also affects the formula. If no such hash is provided (or, if the empty all-zero hash is provided), it's assumed that there were no uncles.Documented in
testdata/14/readme.md.Closes #23249
Example run