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

all: implement eip-7702 set code tx #30078

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7a4bafa
all: impl eip-7702
lightclient Jun 26, 2024
8a49fd8
cmd/evm: add 7702 test for t8n
lightclient Oct 18, 2024
a173914
internal/ethapi: add 7702 tests to eth_estimateGas
lightclient Oct 29, 2024
7dceb35
core/vm: make 7702 variants of EXT* ops
lightclient Nov 21, 2024
f9e0222
core: remove resolve code mechanism from statedb, put in vm
lightclient Nov 27, 2024
f32e9bf
core: use parse delegation for code check in state transition
lightclient Nov 27, 2024
48ef8da
legacypool: don't allow 7702 txs in pool yet
lightclient Nov 27, 2024
f709826
common: remove zero address
lightclient Nov 27, 2024
630b42c
accounts/external: handle set code tx type in backend
lightclient Nov 27, 2024
bebcdd8
internal/ethapi: handle set code tx type in transaction args
lightclient Nov 27, 2024
d3e82b4
core: clarify test a bit
holiman Nov 27, 2024
b8fb4d6
core/types: remove AuthorizationList and use Authorization as value i…
fjl Dec 2, 2024
1506e06
core/types: change Authorization signature value to uint256
fjl Dec 2, 2024
09d1a16
core/types: change Authority method to pointer receiver
fjl Dec 2, 2024
ab2f070
core: fix account reference
fjl Dec 2, 2024
e137c47
internal/ethapi: remove reference to blob fields in setcode tx
fjl Dec 2, 2024
bb182a6
core/types: improve authority signature handling
fjl Dec 2, 2024
0926de3
core: track validation error for authorizations
fjl Dec 2, 2024
0f85021
core: style improvement in applyAuthorization
fjl Dec 2, 2024
bf01e0d
core: add comment about nonce update order
fjl Dec 2, 2024
a1c1860
core/vm: add comment about chained EIP-7702 delegations
fjl Dec 2, 2024
23baaee
core: remove debug print
fjl Dec 2, 2024
a0274e0
cmd/evm: update testdata
fjl Dec 2, 2024
33888a9
graphql: add support for fee parameters of SetCodeTx
fjl Dec 2, 2024
e7c0f80
core: improve checks for 7702
fjl Dec 2, 2024
bd36423
core: add comment about 7702 state transition error
fjl Dec 2, 2024
3764d42
core/state: fix hooks to account for setcode on non-empty code
holiman Dec 2, 2024
5fccdfb
core/state: fix journal to account for setcode over non-empty code
holiman Dec 2, 2024
ace3a3f
core: reformat comment
fjl Dec 2, 2024
1110fc5
core: clarify delegation deletion flow
fjl Dec 2, 2024
9b94402
core: more comment
fjl Dec 2, 2024
9ee0d10
core: lift convenience warming of tx destination from per auth to pos…
lightclient Dec 5, 2024
f4b5798
core: refactor non-create processing flow
lightclient Dec 5, 2024
eda288c
internal/ethapi: removed commented out code from test
lightclient Dec 5, 2024
0a129da
core/vm: direct check code hash during creation instead of resolving
lightclient Dec 6, 2024
6505e50
tests: use big int for stAuthorization because eest needs math.HexOrD…
lightclient Dec 6, 2024
46a6482
core: rm extra whitespace
lightclient Dec 9, 2024
7ecda7d
t8n: do not omit requests when empty
lightclient Dec 10, 2024
fdfc159
core/vm: return delegation designator prefix for code reading ops
lightclient Dec 10, 2024
e98e686
core/vm: report gas used warming 7702 delegation targets correctly in…
lightclient Dec 10, 2024
aed705b
eth/tracers: add support for setcode tx in prestate tracer
lightclient Dec 10, 2024
034f897
core: mod errors + add test
holiman Dec 12, 2024
857641d
core: create official prague instruction set, name eof set
lightclient Dec 12, 2024
f33b87a
cmd/evm: fix expected output for 7702 t8n test
lightclient Dec 12, 2024
f3a427e
internal/ethapi: rename authlist to authorizationList in transaction …
lightclient Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts/external/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
switch tx.Type() {
case types.LegacyTxType, types.AccessListTxType:
args.GasPrice = (*hexutil.Big)(tx.GasPrice())
case types.DynamicFeeTxType, types.BlobTxType:
case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType:
args.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap())
args.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap())
default:
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/eofparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var jt vm.JumpTable
const initcode = "INITCODE"

func init() {
jt = vm.NewPragueEOFInstructionSetForTesting()
jt = vm.NewEOFInstructionSetForTesting()
}

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/eofparse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func FuzzEofParsing(f *testing.F) {
// And do the fuzzing
f.Fuzz(func(t *testing.T, data []byte) {
var (
jt = vm.NewPragueEOFInstructionSetForTesting()
jt = vm.NewEOFInstructionSetForTesting()
c vm.Container
)
cpy := common.CopyBytes(data)
Expand Down
4 changes: 2 additions & 2 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ type ExecutionResult struct {
CurrentExcessBlobGas *math.HexOrDecimal64 `json:"currentExcessBlobGas,omitempty"`
CurrentBlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
Requests [][]byte `json:"requests,omitempty"`
Requests [][]byte `json:"requests"`
}

type executionResultMarshaling struct {
Requests []hexutil.Bytes `json:"requests,omitempty"`
Requests []hexutil.Bytes `json:"requests"`
}

type ommer struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/evm/internal/t8ntool/gen_execresult.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/evm/internal/t8ntool/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func Transaction(ctx *cli.Context) error {
r.Address = sender
}
// Check intrinsic gas
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil,
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil {
r.Error = err
results = append(results, r)
Expand Down
8 changes: 8 additions & 0 deletions cmd/evm/t8n_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ func TestT8n(t *testing.T) {
output: t8nOutput{alloc: true, result: true},
expOut: "exp.json",
},
{ // Prague test, EIP-7702 transaction
base: "./testdata/33",
input: t8nInput{
"alloc.json", "txs.json", "env.json", "Prague", "",
},
output: t8nOutput{alloc: true, result: true},
expOut: "exp.json",
},
} {
args := []string{"t8n"}
args = append(args, tc.output.get()...)
Expand Down
3 changes: 2 additions & 1 deletion cmd/evm/testdata/1/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0x5208"
"gasUsed": "0x5208",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/13/exp2.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
],
"currentDifficulty": "0x20000",
"gasUsed": "0x109a0",
"currentBaseFee": "0x36b"
"currentBaseFee": "0x36b",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/14/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"currentDifficulty": "0x2000020000000",
"receipts": [],
"gasUsed": "0x0",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/14/exp2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"receipts": [],
"currentDifficulty": "0x1ff8020000000",
"gasUsed": "0x0",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/14/exp_berlin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"receipts": [],
"currentDifficulty": "0x1ff9000000000",
"gasUsed": "0x0",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/19/exp_arrowglacier.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"currentDifficulty": "0x2000000200000",
"receipts": [],
"gasUsed": "0x0",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
25 changes: 13 additions & 12 deletions cmd/evm/testdata/19/exp_grayglacier.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"result": {
"stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"currentDifficulty": "0x2000000004000",
"gasUsed": "0x0",
"currentBaseFee": "0x500"
}
}
"result": {
"stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"currentDifficulty": "0x2000000004000",
"gasUsed": "0x0",
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/19/exp_london.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"currentDifficulty": "0x2000080000000",
"receipts": [],
"gasUsed": "0x0",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/23/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0x520b"
"gasUsed": "0x520b",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/24/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
],
"currentDifficulty": null,
"gasUsed": "0x10306",
"currentBaseFee": "0x500"
"currentBaseFee": "0x500",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/25/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
],
"currentDifficulty": null,
"gasUsed": "0x5208",
"currentBaseFee": "0x460"
"currentBaseFee": "0x460",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/26/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"currentDifficulty": null,
"gasUsed": "0x0",
"currentBaseFee": "0x500",
"withdrawalsRoot": "0x4921c0162c359755b2ae714a0978a1dad2eb8edce7ff9b38b9b6fc4cbc547eb5"
"withdrawalsRoot": "0x4921c0162c359755b2ae714a0978a1dad2eb8edce7ff9b38b9b6fc4cbc547eb5",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/28/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"currentBaseFee": "0x9",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"currentExcessBlobGas": "0x0",
"blobGasUsed": "0x20000"
"blobGasUsed": "0x20000",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/29/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"currentBaseFee": "0x9",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"currentExcessBlobGas": "0x0",
"blobGasUsed": "0x0"
"blobGasUsed": "0x0",
"requests": null
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/3/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0x521f"
"gasUsed": "0x521f",
"requests": null
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/30/exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"currentBaseFee": "0x7",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"currentExcessBlobGas": "0x0",
"blobGasUsed": "0x0"
"blobGasUsed": "0x0",
"requests": null
}
}
}
1 change: 1 addition & 0 deletions cmd/evm/testdata/33/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This test sets some EIP-7702 delegations and calls them.
30 changes: 30 additions & 0 deletions cmd/evm/testdata/33/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"0x8a0a19589531694250d570040a0c4b74576919b8": {
"nonce": "0x00",
"balance": "0x0de0b6b3a7640000",
"code": "0x600060006000600060007310000000000000000000000000000000000000015af1600155600060006000600060007310000000000000000000000000000000000000025af16002553d600060003e600051600355",
"storage": {
"0x01": "0x0100",
"0x02": "0x0100",
"0x03": "0x0100"
}
},
"0x000000000000000000000000000000000000aaaa": {
"nonce": "0x00",
"balance": "0x4563918244f40000",
"code": "0x58808080600173703c4b2bd70c169f5717101caee543299fc946c75af100",
"storage": {}
},
"0x000000000000000000000000000000000000bbbb": {
"nonce": "0x00",
"balance": "0x29a2241af62c0000",
"code": "0x6042805500",
"storage": {}
},
"0x71562b71999873DB5b286dF957af199Ec94617F7": {
"nonce": "0x00",
"balance": "0x6124fee993bc0000",
"code": "0x",
"storage": {}
}
}
14 changes: 14 additions & 0 deletions cmd/evm/testdata/33/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "71794957647893862",
"currentNumber": "1",
"currentTimestamp": "1000",
"currentRandom": "0",
"currentDifficulty": "0",
"blockHashes": {},
"ommers": [],
"currentBaseFee": "7",
"parentUncleHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"withdrawals": [],
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
62 changes: 62 additions & 0 deletions cmd/evm/testdata/33/exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"alloc": {
"0x000000000000000000000000000000000000aaaa": {
"code": "0x58808080600173703c4b2bd70c169f5717101caee543299fc946c75af100",
"balance": "0x4563918244f40000"
},
"0x000000000000000000000000000000000000bbbb": {
"code": "0x6042805500",
"balance": "0x29a2241af62c0000"
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x2bf52"
},
"0x703c4b2bd70c169f5717101caee543299fc946c7": {
"code": "0xef0100000000000000000000000000000000000000bbbb",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000042": "0x0000000000000000000000000000000000000000000000000000000000000042"
},
"balance": "0x1",
"nonce": "0x1"
},
"0x71562b71999873db5b286df957af199ec94617f7": {
"code": "0xef0100000000000000000000000000000000000000aaaa",
"balance": "0x6124fee993afa30e",
"nonce": "0x2"
},
"0x8a0a19589531694250d570040a0c4b74576919b8": {
"code": "0x600060006000600060007310000000000000000000000000000000000000015af1600155600060006000600060007310000000000000000000000000000000000000025af16002553d600060003e600051600355",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000100",
"0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000100",
"0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000000000000000000000000100"
},
"balance": "0xde0b6b3a7640000"
}
},
"result": {
"stateRoot": "0x9fdcacd4510e93c4488e537dc51578b5c6d505771db64a2610036eeb4be7b26f",
"txRoot": "0x5d13a0b074e80388dc754da92b22922313a63417b3e25a10f324935e09697a53",
"receiptsRoot": "0x504c5d86c34391f70d210e6c482615b391db4bdb9f43479366399d9c5599850a",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","receipts": [{
"type": "0x4",
"root": "0x",
"status": "0x1",
"cumulativeGasUsed": "0x15fa9",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs": null,"transactionHash": "0x0417aab7c1d8a3989190c3167c132876ce9b8afd99262c5a0f9d06802de3d7ef",
"contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x15fa9",
"effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex": "0x0"
}
],
"currentDifficulty": null,
"gasUsed": "0x15fa9",
"currentBaseFee": "0x7",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"requests": []
}
}
37 changes: 37 additions & 0 deletions cmd/evm/testdata/33/txs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"type": "0x4",
"chainId": "0x1",
"nonce": "0x0",
"to": "0x71562b71999873db5b286df957af199ec94617f7",
"gas": "0x7a120",
"gasPrice": null,
"maxPriorityFeePerGas": "0x2",
"maxFeePerGas": "0x12a05f200",
"value": "0x0",
"input": "0x",
"accessList": [],
"authorizationList": [
{
"chainId": "0x1",
"address": "0x000000000000000000000000000000000000aaaa",
"nonce": "0x1",
"v": "0x1",
"r": "0xf7e3e597fc097e71ed6c26b14b25e5395bc8510d58b9136af439e12715f2d721",
"s": "0x6cf7c3d7939bfdb784373effc0ebb0bd7549691a513f395e3cdabf8602724987"
},
{
"chainId": "0x0",
"address": "0x000000000000000000000000000000000000bbbb",
"nonce": "0x0",
"v": "0x1",
"r": "0x5011890f198f0356a887b0779bde5afa1ed04e6acb1e3f37f8f18c7b6f521b98",
"s": "0x56c3fa3456b103f3ef4a0acb4b647b9cab9ec4bc68fbcdf1e10b49fb2bcbcf61"
}
],
"secretKey": "0xb71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291",
"v": "0x0",
"r": "0x0",
"s": "0x0"
}
]
Loading