Skip to content

Commit e70acc6

Browse files
authored
Merge branch 'develop' into feat-system-config-consensus
2 parents cc5c7dc + bcfdb48 commit e70acc6

File tree

110 files changed

+3027
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+3027
-377
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ test: all
4343
$(GORUN) build/ci.go test ./consensus ./core ./eth ./miner ./node ./trie ./rollup/...
4444
# RIP-7212 (secp256r1) precompiled contract test
4545
cd ${PWD}/core/vm; go test -v -run=^TestPrecompiledP256 -bench=^BenchmarkPrecompiledP256
46+
# EIP-7702 test
47+
cd ${PWD}/core/vm/runtime; go test -v -run=^TestDelegatedAccountAccessCost
48+
cd ${PWD}/core/types; go test -v -run=^TestParseDelegation
49+
cd ${PWD}/internal/ethapi; go test -v -run=^TestEstimateGas
50+
cd ${PWD}/cmd/evm; go test -v -run=^TestT8n
4651

4752
lint: ## Run linters.
4853
$(GORUN) build/ci.go lint

accounts/abi/bind/backends/simulated.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
639639
// about the transaction and calling mechanisms.
640640
vmEnv := vm.NewEVM(evmContext, txContext, stateDB, b.config, vm.Config{NoBaseFee: true})
641641
gasPool := new(core.GasPool).AddGas(math.MaxUint64)
642-
signer := types.MakeSigner(b.blockchain.Config(), head.Number)
642+
signer := types.MakeSigner(b.blockchain.Config(), head.Number, head.Time)
643643
l1DataFee, err := fees.EstimateL1DataFeeForMessage(msg, head.BaseFee, b.blockchain.Config(), signer, stateDB, head.Number)
644644
if err != nil {
645645
return nil, err
@@ -660,7 +660,7 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa
660660
panic("could not fetch parent")
661661
}
662662
// Check transaction validity
663-
signer := types.MakeSigner(b.blockchain.Config(), block.Number())
663+
signer := types.MakeSigner(b.blockchain.Config(), block.Number(), block.Time())
664664
sender, err := types.Sender(signer, tx)
665665
if err != nil {
666666
panic(fmt.Errorf("invalid transaction: %v", err))
@@ -809,19 +809,20 @@ type callMsg struct {
809809
ethereum.CallMsg
810810
}
811811

812-
func (m callMsg) From() common.Address { return m.CallMsg.From }
813-
func (m callMsg) Nonce() uint64 { return 0 }
814-
func (m callMsg) IsFake() bool { return true }
815-
func (m callMsg) To() *common.Address { return m.CallMsg.To }
816-
func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice }
817-
func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap }
818-
func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap }
819-
func (m callMsg) Gas() uint64 { return m.CallMsg.Gas }
820-
func (m callMsg) Value() *big.Int { return m.CallMsg.Value }
821-
func (m callMsg) Data() []byte { return m.CallMsg.Data }
822-
func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList }
823-
func (m callMsg) IsL1MessageTx() bool { return false }
824-
func (m callMsg) TxSize() common.StorageSize { return 0 }
812+
func (m callMsg) From() common.Address { return m.CallMsg.From }
813+
func (m callMsg) Nonce() uint64 { return 0 }
814+
func (m callMsg) IsFake() bool { return true }
815+
func (m callMsg) To() *common.Address { return m.CallMsg.To }
816+
func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice }
817+
func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap }
818+
func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap }
819+
func (m callMsg) Gas() uint64 { return m.CallMsg.Gas }
820+
func (m callMsg) Value() *big.Int { return m.CallMsg.Value }
821+
func (m callMsg) Data() []byte { return m.CallMsg.Data }
822+
func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList }
823+
func (m callMsg) IsL1MessageTx() bool { return false }
824+
func (m callMsg) TxSize() common.StorageSize { return 0 }
825+
func (m callMsg) SetCodeAuthorizations() []types.SetCodeAuthorization { return nil }
825826

826827
// filterBackend implements filters.Backend to support filtering for logs without
827828
// taking bloom-bits acceleration structures into account.

accounts/external/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
218218
switch tx.Type() {
219219
case types.LegacyTxType, types.AccessListTxType:
220220
args.GasPrice = (*hexutil.Big)(tx.GasPrice())
221-
case types.DynamicFeeTxType:
221+
case types.DynamicFeeTxType, types.SetCodeTxType:
222222
args.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap())
223223
args.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap())
224224
default:

cmd/evm/internal/t8ntool/execution.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
117117
}
118118
var (
119119
statedb = MakePreState(rawdb.NewMemoryDatabase(), pre.Pre)
120-
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number))
120+
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp)
121121
gaspool = new(core.GasPool)
122122
blockHash = common.Hash{0x13, 0x37}
123123
rejectedTxs []*rejectedTx

cmd/evm/internal/t8ntool/transaction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func Transaction(ctx *cli.Context) error {
113113
return NewError(ErrorIO, errors.New("only rlp supported"))
114114
}
115115
}
116-
signer := types.MakeSigner(chainConfig, new(big.Int))
116+
signer := types.MakeSigner(chainConfig, new(big.Int), 0)
117117
// We now have the transactions in 'body', which is supposed to be an
118118
// rlp list of transactions
119119
it, err := rlp.NewListIterator([]byte(body))
@@ -140,7 +140,7 @@ func Transaction(ctx *cli.Context) error {
140140
r.Address = sender
141141
}
142142
// Check intrinsic gas
143-
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil,
143+
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil,
144144
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int))); err != nil {
145145
r.Error = err
146146
results = append(results, r)

cmd/evm/internal/t8ntool/transition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func Transition(ctx *cli.Context) error {
241241
}
242242
}
243243
// We may have to sign the transactions.
244-
signer := types.MakeSigner(chainConfig, big.NewInt(int64(prestate.Env.Number)))
244+
signer := types.MakeSigner(chainConfig, big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp)
245245

246246
if txs, err = signUnsignedTransactions(txsWithKeys, signer); err != nil {
247247
return NewError(ErrorJson, fmt.Errorf("failed signing transactions: %v", err))

cmd/evm/t8n_test.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ func TestT8n(t *testing.T) {
124124
output: t8nOutput{alloc: true, result: true},
125125
expOut: "exp.json",
126126
},
127-
{ // missing blockhash test
128-
base: "./testdata/4",
129-
input: t8nInput{
130-
"alloc.json", "txs.json", "env.json", "Berlin", "",
131-
},
132-
output: t8nOutput{alloc: true, result: true},
133-
expExitCode: 4,
134-
},
127+
//{ // missing blockhash test
128+
// base: "./testdata/4",
129+
// input: t8nInput{
130+
// "alloc.json", "txs.json", "env.json", "Berlin", "",
131+
// },
132+
// output: t8nOutput{alloc: true, result: true},
133+
// expExitCode: 4,
134+
//},
135135
{ // Uncle test
136136
base: "./testdata/5",
137137
input: t8nInput{
@@ -204,6 +204,14 @@ func TestT8n(t *testing.T) {
204204
output: t8nOutput{result: true},
205205
expOut: "exp.json",
206206
},
207+
{ // EuclidV2 test, EIP-7702 transaction
208+
base: "./testdata/33",
209+
input: t8nInput{
210+
"alloc.json", "txs.json", "env.json", "EuclidV2", "",
211+
},
212+
output: t8nOutput{alloc: true, result: true},
213+
expOut: "exp.json",
214+
},
207215
} {
208216

209217
args := []string{"t8n"}

cmd/evm/testdata/33/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This test sets some EIP-7702 delegations and calls them.

cmd/evm/testdata/33/alloc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"0x8a0a19589531694250d570040a0c4b74576919b8": {
3+
"nonce": "0x00",
4+
"balance": "0x0de0b6b3a7640000",
5+
"code": "0x600060006000600060007310000000000000000000000000000000000000015af1600155600060006000600060007310000000000000000000000000000000000000025af16002553d600060003e600051600355",
6+
"storage": {
7+
"0x01": "0x0100",
8+
"0x02": "0x0100",
9+
"0x03": "0x0100"
10+
}
11+
},
12+
"0x000000000000000000000000000000000000aaaa": {
13+
"nonce": "0x00",
14+
"balance": "0x4563918244f40000",
15+
"code": "0x58808080600173703c4b2bd70c169f5717101caee543299fc946c75af100",
16+
"storage": {}
17+
},
18+
"0x000000000000000000000000000000000000bbbb": {
19+
"nonce": "0x00",
20+
"balance": "0x29a2241af62c0000",
21+
"code": "0x6042805500",
22+
"storage": {}
23+
},
24+
"0x71562b71999873DB5b286dF957af199Ec94617F7": {
25+
"nonce": "0x00",
26+
"balance": "0x6124fee993bc0000",
27+
"code": "0x",
28+
"storage": {}
29+
}
30+
}

cmd/evm/testdata/33/env.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
3+
"currentGasLimit": "71794957647893862",
4+
"currentNumber": "1",
5+
"currentTimestamp": "1000",
6+
"currentRandom": "0",
7+
"currentDifficulty": "0",
8+
"blockHashes": {},
9+
"ommers": [],
10+
"currentBaseFee": "7",
11+
"parentUncleHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
12+
"withdrawals": [],
13+
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000"
14+
}

0 commit comments

Comments
 (0)