Skip to content

Commit 009cc4b

Browse files
authored
Merge branch 'master' into use-cloudflare-bn256
2 parents 5bea6f3 + 5657139 commit 009cc4b

File tree

26 files changed

+104
-73
lines changed

26 files changed

+104
-73
lines changed

arbitrum/conditionaltx.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func SubmitConditionalTransaction(ctx context.Context, b *APIBackend, tx *types.
4444
return common.Hash{}, err
4545
}
4646
// Print a log with full tx details for manual investigations and interventions
47-
signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number, b.CurrentBlock().Time)
47+
arbosVersion := types.DeserializeHeaderExtraInformation(b.CurrentBlock()).ArbOSFormatVersion
48+
signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number, b.CurrentBlock().Time, arbosVersion)
4849
from, err := types.Sender(signer, tx)
4950
if err != nil {
5051
return common.Hash{}, err

cmd/evm/internal/t8ntool/execution.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
147147
}
148148
var (
149149
statedb = MakePreState(rawdb.NewMemoryDatabase(), pre.Pre)
150-
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp)
150+
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp, params.MaxArbosVersionSupported)
151151
gaspool = new(core.GasPool)
152152
blockHash = common.Hash{0x13, 0x37}
153153
rejectedTxs []*rejectedTx
@@ -216,7 +216,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
216216
if beaconRoot := pre.Env.ParentBeaconBlockRoot; beaconRoot != nil {
217217
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
218218
}
219-
if pre.Env.BlockHashes != nil && chainConfig.IsPrague(new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp) {
219+
if pre.Env.BlockHashes != nil && chainConfig.IsPrague(new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp, vmContext.ArbOSVersion) {
220220
var (
221221
prevNumber = pre.Env.Number - 1
222222
prevHash = pre.Env.BlockHashes[math.HexOrDecimal64(prevNumber)]
@@ -355,7 +355,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
355355

356356
// Gather the execution-layer triggered requests.
357357
var requests [][]byte
358-
if chainConfig.IsPrague(vmContext.BlockNumber, vmContext.Time) {
358+
// Arbitrum doesn't support Deposit/Withdrawal/Consolidation requests.
359+
if !chainConfig.IsArbitrum() && chainConfig.IsPrague(vmContext.BlockNumber, vmContext.Time, vmContext.ArbOSVersion) {
359360
requests = [][]byte{}
360361
// EIP-6110
361362
var allLogs []*types.Log

cmd/evm/internal/t8ntool/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func Transaction(ctx *cli.Context) error {
105105
return NewError(ErrorIO, errors.New("only rlp supported"))
106106
}
107107
}
108-
signer := types.MakeSigner(chainConfig, new(big.Int), 0)
108+
signer := types.MakeSigner(chainConfig, new(big.Int), 0, params.MaxArbosVersionSupported)
109109

110110
// We now have the transactions in 'body', which is supposed to be an
111111
// rlp list of transactions

consensus/misc/eip4844/eip4844.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
107107
switch {
108108
case cfg.IsOsaka(london, time) && s.Osaka != nil:
109109
return s.Osaka.Max
110-
case cfg.IsPrague(london, time) && s.Prague != nil:
110+
// we can use 0 here because arbitrum doesn't support Blob transactions.
111+
case cfg.IsPrague(london, time, 0) && s.Prague != nil:
111112
return s.Prague.Max
112113
// we can use 0 here because arbitrum doesn't support Blob transactions.
113114
case cfg.IsCancun(london, time, 0) && s.Cancun != nil:
@@ -153,7 +154,8 @@ func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
153154
switch {
154155
case cfg.IsOsaka(london, time) && s.Osaka != nil:
155156
return s.Osaka.Target
156-
case cfg.IsPrague(london, time) && s.Prague != nil:
157+
// we can use 0 here because arbitrum doesn't support Blob transactions.
158+
case cfg.IsPrague(london, time, 0) && s.Prague != nil:
157159
return s.Prague.Target
158160
// we can use 0 here because arbitrum doesn't support Blob transactions.
159161
case cfg.IsCancun(london, time, 0) && s.Cancun != nil:

core/blockchain.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
17431743
return nil, 0, nil
17441744
}
17451745
// Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss)
1746-
SenderCacher().RecoverFromBlocks(types.MakeSigner(bc.chainConfig, chain[0].Number(), chain[0].Time()), chain)
1746+
arbosVersion := types.DeserializeHeaderExtraInformation(chain[0].Header()).ArbOSFormatVersion
1747+
SenderCacher().RecoverFromBlocks(types.MakeSigner(bc.chainConfig, chain[0].Number(), chain[0].Time(), arbosVersion), chain)
17471748

17481749
var (
17491750
stats = insertStats{startTime: mclock.Now()}

core/chain_makers.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ func (b *BlockGen) Gas() uint64 {
201201

202202
// Signer returns a valid signer instance for the current block.
203203
func (b *BlockGen) Signer() types.Signer {
204-
return types.MakeSigner(b.cm.config, b.header.Number, b.header.Time)
204+
arbosVersion := types.DeserializeHeaderExtraInformation(b.header).ArbOSFormatVersion
205+
return types.MakeSigner(b.cm.config, b.header.Number, b.header.Time, arbosVersion)
205206
}
206207

207208
// AddUncheckedReceipt forcefully adds a receipts to the block without a
@@ -314,7 +315,9 @@ func (b *BlockGen) collectRequests(readonly bool) (requests [][]byte) {
314315
statedb = statedb.Copy()
315316
}
316317

317-
if b.cm.config.IsPrague(b.header.Number, b.header.Time) {
318+
arbosVersion := types.DeserializeHeaderExtraInformation(b.header).ArbOSFormatVersion
319+
// Arbitrum doesn't support Deposit, Withdrawal, or Consolidation requests.
320+
if !b.cm.config.IsArbitrum() && b.cm.config.IsPrague(b.header.Number, b.header.Time, arbosVersion) {
318321
requests = [][]byte{}
319322
// EIP-6110 deposits
320323
var blockLogs []*types.Log
@@ -386,9 +389,9 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
386389
misc.ApplyDAOHardFork(statedb)
387390
}
388391

389-
if config.IsPrague(b.header.Number, b.header.Time) || config.IsVerkle(b.header.Number, b.header.Time) {
392+
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
393+
if config.IsPrague(b.header.Number, b.header.Time, blockContext.ArbOSVersion) || config.IsVerkle(b.header.Number, b.header.Time) {
390394
// EIP-2935
391-
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
392395
blockContext.Random = &common.Hash{} // enable post-merge instruction set
393396
evm := vm.NewEVM(blockContext, statedb, cm.config, vm.Config{})
394397
ProcessParentBlockHash(b.header.ParentHash, evm)

core/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ func (g *Genesis) toBlockWithRoot(root common.Hash) *types.Block {
508508
head.BlobGasUsed = new(uint64)
509509
}
510510
}
511-
if conf.IsPrague(num, g.Timestamp) {
511+
if conf.IsPrague(num, g.Timestamp, arbosVersion) {
512512
head.RequestsHash = &types.EmptyRequestsHash
513513
}
514514
}

core/state_prefetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
5050
gaspool = new(GasPool).AddGas(block.GasLimit())
5151
blockContext = NewEVMBlockContext(header, p.chain, nil)
5252
evm = vm.NewEVM(blockContext, statedb, p.config, cfg)
53-
signer = types.MakeSigner(p.config, header.Number, header.Time)
53+
signer = types.MakeSigner(p.config, header.Number, header.Time, blockContext.ArbOSVersion)
5454
)
5555
// Iterate over and process the individual transactions
5656
byzantium := p.config.IsByzantium(block.Number())

core/state_processor.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
7070
}
7171
var (
7272
context vm.BlockContext
73-
signer = types.MakeSigner(p.config, header.Number, header.Time)
7473
)
7574

7675
// Apply pre-execution system calls.
@@ -81,10 +80,12 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
8180
context = NewEVMBlockContext(header, p.chain, nil)
8281
evm := vm.NewEVM(context, tracingStateDB, p.config, cfg)
8382

83+
signer := types.MakeSigner(p.config, header.Number, header.Time, context.ArbOSVersion)
84+
8485
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
8586
ProcessBeaconBlockRoot(*beaconRoot, evm)
8687
}
87-
if p.config.IsPrague(block.Number(), block.Time()) || p.config.IsVerkle(block.Number(), block.Time()) {
88+
if p.config.IsPrague(block.Number(), block.Time(), context.ArbOSVersion) || p.config.IsVerkle(block.Number(), block.Time()) {
8889
ProcessParentBlockHash(block.ParentHash(), evm)
8990
}
9091

@@ -106,7 +107,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
106107

107108
// Read requests if Prague is enabled.
108109
var requests [][]byte
109-
if p.config.IsPrague(block.Number(), block.Time()) {
110+
// Arbitrum has no Deposit, Witdrawal, or Consolidation requests.
111+
if !p.config.IsArbitrum() && p.config.IsPrague(block.Number(), block.Time(), context.ArbOSVersion) {
110112
requests = [][]byte{}
111113
// EIP-6110
112114
if err := ParseDepositLogs(&requests, allLogs, p.config); err != nil {
@@ -213,7 +215,7 @@ func ApplyTransaction(evm *vm.EVM, gp *GasPool, statedb *state.StateDB, header *
213215
}
214216

215217
func ApplyTransactionWithResultFilter(evm *vm.EVM, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, runMode MessageRunMode, resultFilter func(*ExecutionResult) error) (*types.Receipt, *ExecutionResult, error) {
216-
msg, err := TransactionToMessage(tx, types.MakeSigner(evm.ChainConfig(), header.Number, header.Time), header.BaseFee, runMode)
218+
msg, err := TransactionToMessage(tx, types.MakeSigner(evm.ChainConfig(), header.Number, header.Time, evm.Context.ArbOSVersion), header.BaseFee, runMode)
217219
if err != nil {
218220
return nil, nil, err
219221
}

core/txpool/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
121121
return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), intrGas)
122122
}
123123
// Ensure the transaction can cover floor data gas.
124-
if opts.Config.IsPrague(head.Number, head.Time) {
124+
if opts.Config.IsPrague(head.Number, head.Time, arbosVersion) {
125125
floorDataGas, err := core.FloorDataGas(tx.Data())
126126
if err != nil {
127127
return err

0 commit comments

Comments
 (0)