-
Notifications
You must be signed in to change notification settings - Fork 21k
core, params, beacon/engine: implement EIP 4788 BeaconRoot #27849
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
Changes from 11 commits
bb60b65
3d54be4
8de1782
8c0f8e0
71ade50
10b478d
746adf2
3dcfd13
f1d808f
d513b40
3b794e9
dbc1aac
2b67330
9e578a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,6 +292,14 @@ func Transition(ctx *cli.Context) error { | |
prestate.Env.Difficulty = calcDifficulty(chainConfig, env.Number, env.Timestamp, | ||
env.ParentTimestamp, env.ParentDifficulty, env.ParentUncleHash) | ||
} | ||
if chainConfig.IsCancun(big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp) { | ||
// We require EIP-4788 beacon root to be set in the env | ||
if env.ParentBeaconBlockRoot == nil { | ||
return NewError(ErrorConfig, errors.New("post-cancun env requires parentBeaconBlockRoot to be set")) | ||
} | ||
} else { | ||
env.ParentBeaconBlockRoot = nil // un-set it if it has been set too early | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be an error if beacon root is requested before the fork? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could but in go-ethereum, due to how the For t8n, I'd prefer to keep the older behaviour |
||
} | ||
// Run the test and aggregate the result | ||
s, result, err := prestate.Apply(vmConfig, chainConfig, txs, ctx.Int64(RewardFlag.Name), getTracer) | ||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { | ||
"balance" : "0x016345785d8a0000", | ||
"code" : "0x", | ||
"nonce" : "0x00", | ||
"storage" : { | ||
} | ||
}, | ||
"0xBeAC00541d49391ED88ABF392bfC1F4dEa8c4143" : { | ||
"balance" : "0x1", | ||
"code" : "0x3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b6201800042064281555f359062018000015500", | ||
"nonce" : "0x00", | ||
"storage" : { | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", | ||
"currentNumber" : "0x01", | ||
"currentTimestamp" : "0x079e", | ||
"currentGasLimit" : "0x7fffffffffffffff", | ||
"previousHash" : "0x3a9b485972e7353edd9152712492f0c58d89ef80623686b6bf947a4a6dce6cb6", | ||
"currentBlobGasUsed" : "0x00", | ||
"parentTimestamp" : "0x03b6", | ||
"parentDifficulty" : "0x00", | ||
"parentUncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"currentRandom" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"withdrawals" : [ | ||
], | ||
"parentBaseFee" : "0x0a", | ||
"parentGasUsed" : "0x00", | ||
"parentGasLimit" : "0x7fffffffffffffff", | ||
"parentExcessBlobGas" : "0x00", | ||
"parentBlobGasUsed" : "0x00", | ||
"parentBeaconBlockRoot": "0x0000beac00beac00beac00beac00beac00beac00beac00beac00beac00beac00" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"alloc": { | ||
"0xbeac00541d49391ed88abf392bfc1f4dea8c4143": { | ||
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b6201800042064281555f359062018000015500", | ||
"storage": { | ||
"0x000000000000000000000000000000000000000000000000000000000000079e": "0x000000000000000000000000000000000000000000000000000000000000079e", | ||
"0x000000000000000000000000000000000000000000000000000000000001879e": "0x0000beac00beac00beac00beac00beac00beac00beac00beac00beac00beac00" | ||
}, | ||
"balance": "0x1" | ||
}, | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { | ||
"balance": "0x16345785d871db8", | ||
"nonce": "0x1" | ||
} | ||
}, | ||
"result": { | ||
"stateRoot": "0xecde4500714cc55d9e3f13e154f6db0b21b2aad708380c39d64d5295b32af8a7", | ||
"txRoot": "0x248074fabe112f7d93917f292b64932394f835bb98da91f21501574d58ec92ab", | ||
"receiptsRoot": "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa", | ||
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"receipts": [ | ||
{ | ||
"type": "0x2", | ||
"root": "0x", | ||
"status": "0x1", | ||
"cumulativeGasUsed": "0x5208", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"logs": null, | ||
"transactionHash": "0x84f70aba406a55628a0620f26d260f90aeb6ccc55fed6ec2ac13dd4f727032ed", | ||
"contractAddress": "0x0000000000000000000000000000000000000000", | ||
"gasUsed": "0x5208", | ||
"effectiveGasPrice": null, | ||
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"transactionIndex": "0x0" | ||
} | ||
], | ||
"currentDifficulty": null, | ||
"gasUsed": "0x5208", | ||
"currentBaseFee": "0x9", | ||
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"currentExcessBlobGas": "0x0", | ||
"currentBlobGasUsed": "0x0" | ||
} | ||
} |
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.
seems like this is used a lot, might be nice to assign above ?
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.
Myeah, a couple, but I don't think it's worth it. Might do a bigger refactor later IMO
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.
I mean, some uses refer to
big.NewInt(int64(prestate.Env.Number))
, some refer toint64(prestate.Env.Number)
, and some refer toprestate.Env.Number
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.
Did the bigger refactor, ptal!