-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
cmd/evm: add difficulty calculation to t8n tool #23353
Conversation
@winsvega does this work for you? |
@@ -18,6 +18,7 @@ package t8ntool | |||
|
|||
import ( | |||
"fmt" | |||
"github.com/ethereum/go-ethereum/consensus/ethash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please gofmt it
c9900f7
to
17cc201
Compare
@winsvega ping -- does this fit your needs? |
I guess. I can chek tomorrow. |
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
@winsvega fixed:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a tiny question
74f716f
to
04a7c52
Compare
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 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 PR adds functionality to the
evm t8n
to calculate ethash difficulty. If the caller does not provide acurrentDifficulty
, but instead provides theparentTimestamp
(well, semi-optional, will default to0
if 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