-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
core: fix pre-check for account balance under EIP-1559 #23244
Merged
+84
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d5af3f0
core: check that account has enough balance for value + ggas * asFeeCap
MariusVanDerWijden d72b7a0
core: nit
MariusVanDerWijden 61d9e37
eth/tracers: fixed test to expect different error
MariusVanDerWijden 7a803fa
core: fix new expected error
MariusVanDerWijden bd7a1fe
cmd/evm: add repro example
holiman df8a10f
core/state: fix aliasing issue with mgval
holiman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { | ||
"balance" : "84000000", | ||
"code" : "0x", | ||
"nonce" : "0x00", | ||
"storage" : { | ||
"0x00" : "0x00" | ||
} | ||
} | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", | ||
"currentDifficulty" : "0x020000", | ||
"currentNumber" : "0x01", | ||
"currentTimestamp" : "0x03e8", | ||
"previousHash" : "0xfda4419b3660e99f37e536dae1ab081c180136bb38c837a93e93d9aab58553b2", | ||
"currentGasLimit" : "0x0f4240", | ||
"currentBaseFee" : "0x20" | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## Test 1559 balance + gasCap | ||
|
||
This test contains an EIP-1559 consensus issue which happened on Ropsten, where | ||
`geth` did not properly account for the value transfer while doing the check on `max_fee_per_gas * gas_limit`. | ||
|
||
Before the issue was fixed, this invocation allowed the transaction to pass into a block: | ||
``` | ||
dir=./testdata/12 && ./evm t8n --state.fork=London --input.alloc=$dir/alloc.json --input.txs=$dir/txs.json --input.env=$dir/env.json --output.alloc=stdout --output.result=stdout | ||
``` | ||
|
||
With the fix applied, the result is: | ||
``` | ||
dir=./testdata/12 && ./evm t8n --state.fork=London --input.alloc=$dir/alloc.json --input.txs=$dir/txs.json --input.env=$dir/env.json --output.alloc=stdout --output.result=stdout | ||
INFO [07-21|19:03:50.276] rejected tx index=0 hash=ccc996..d83435 from=0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B error="insufficient funds for gas * price + value: address 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B have 84000000 want 84000032" | ||
INFO [07-21|19:03:50.276] Trie dumping started root=e05f81..6597a5 | ||
INFO [07-21|19:03:50.276] Trie dumping complete accounts=1 elapsed="39.549µs" | ||
{ | ||
"alloc": { | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { | ||
"balance": "0x501bd00" | ||
} | ||
}, | ||
"result": { | ||
"stateRoot": "0xe05f81f8244a76503ceec6f88abfcd03047a612a1001217f37d30984536597a5", | ||
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"receipts": [], | ||
"rejected": [ | ||
{ | ||
"index": 0, | ||
"error": "insufficient funds for gas * price + value: address 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B have 84000000 want 84000032" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
The transaction is rejected. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"input" : "0x", | ||
"gas" : "0x5208", | ||
"nonce" : "0x0", | ||
"to" : "0x1111111111111111111111111111111111111111", | ||
"value" : "0x20", | ||
"v" : "0x0", | ||
"r" : "0x0", | ||
"s" : "0x0", | ||
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", | ||
"chainId" : "0x1", | ||
"type" : "0x2", | ||
"maxFeePerGas" : "0xfa0", | ||
"maxPriorityFeePerGas" : "0x20", | ||
"accessList" : [ | ||
] | ||
} | ||
] | ||
|
This file contains 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
This file contains 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
This file contains 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
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.
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.
Just FYI this change makes this comment stale
go-ethereum/core/state_transition.go
Line 267 in f68a68a