Skip to content

Commit e55e631

Browse files
Merge branch 'master' into l2-tips
2 parents 555c97f + b34151e commit e55e631

File tree

2 files changed

+70
-63
lines changed

2 files changed

+70
-63
lines changed

arbitrum/recordingdb.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,21 @@ func PrepareRecording(blockchain *core.BlockChain, lastBlockHeader *types.Header
134134
rawTrie := blockchain.StateCache().TrieDB()
135135
recordingKeyValue := NewRecordingKV(rawTrie)
136136
recordingStateDatabase := state.NewDatabase(rawdb.NewDatabase(recordingKeyValue))
137-
recordingStateDb, err := state.New(lastBlockHeader.Root, recordingStateDatabase, nil)
137+
var prevRoot common.Hash
138+
if lastBlockHeader != nil {
139+
prevRoot = lastBlockHeader.Root
140+
}
141+
recordingStateDb, err := state.New(prevRoot, recordingStateDatabase, nil)
138142
if err != nil {
139143
return nil, nil, nil, fmt.Errorf("failed to create recordingStateDb: %w", err)
140144
}
141-
if !lastBlockHeader.Number.IsUint64() {
142-
return nil, nil, nil, errors.New("block number not uint64")
145+
var recordingChainContext *RecordingChainContext
146+
if lastBlockHeader != nil {
147+
if !lastBlockHeader.Number.IsUint64() {
148+
return nil, nil, nil, errors.New("block number not uint64")
149+
}
150+
recordingChainContext = NewRecordingChainContext(blockchain, lastBlockHeader.Number.Uint64())
143151
}
144-
recordingChainContext := NewRecordingChainContext(blockchain, lastBlockHeader.Number.Uint64())
145152
return recordingStateDb, recordingChainContext, recordingKeyValue, nil
146153
}
147154

core/types/arb_types.go

+59-59
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ type ArbitrumUnsignedTx struct {
1616
ChainId *big.Int
1717
From common.Address
1818

19-
Nonce uint64 // nonce of sender account
20-
GasPrice *big.Int // wei per gas
21-
Gas uint64 // gas limit
22-
To *common.Address `rlp:"nil"` // nil means contract creation
23-
Value *big.Int // wei amount
24-
Data []byte // contract invocation input data
19+
Nonce uint64 // nonce of sender account
20+
GasFeeCap *big.Int // wei per gas
21+
Gas uint64 // gas limit
22+
To *common.Address `rlp:"nil"` // nil means contract creation
23+
Value *big.Int // wei amount
24+
Data []byte // contract invocation input data
2525
}
2626

2727
func (tx *ArbitrumUnsignedTx) txType() byte { return ArbitrumUnsignedTxType }
2828

2929
func (tx *ArbitrumUnsignedTx) copy() TxData {
3030
cpy := &ArbitrumUnsignedTx{
31-
ChainId: new(big.Int),
32-
Nonce: tx.Nonce,
33-
GasPrice: new(big.Int),
34-
Gas: tx.Gas,
35-
From: tx.From,
36-
To: nil,
37-
Value: new(big.Int),
38-
Data: common.CopyBytes(tx.Data),
31+
ChainId: new(big.Int),
32+
Nonce: tx.Nonce,
33+
GasFeeCap: new(big.Int),
34+
Gas: tx.Gas,
35+
From: tx.From,
36+
To: nil,
37+
Value: new(big.Int),
38+
Data: common.CopyBytes(tx.Data),
3939
}
4040
if tx.ChainId != nil {
4141
cpy.ChainId.Set(tx.ChainId)
4242
}
43-
if tx.GasPrice != nil {
44-
cpy.GasPrice.Set(tx.GasPrice)
43+
if tx.GasFeeCap != nil {
44+
cpy.GasFeeCap.Set(tx.GasFeeCap)
4545
}
4646
if tx.To != nil {
4747
tmp := *tx.To
@@ -57,9 +57,9 @@ func (tx *ArbitrumUnsignedTx) chainID() *big.Int { return tx.ChainId }
5757
func (tx *ArbitrumUnsignedTx) accessList() AccessList { return nil }
5858
func (tx *ArbitrumUnsignedTx) data() []byte { return tx.Data }
5959
func (tx *ArbitrumUnsignedTx) gas() uint64 { return tx.Gas }
60-
func (tx *ArbitrumUnsignedTx) gasPrice() *big.Int { return tx.GasPrice }
61-
func (tx *ArbitrumUnsignedTx) gasTipCap() *big.Int { return tx.GasPrice }
62-
func (tx *ArbitrumUnsignedTx) gasFeeCap() *big.Int { return tx.GasPrice }
60+
func (tx *ArbitrumUnsignedTx) gasPrice() *big.Int { return tx.GasFeeCap }
61+
func (tx *ArbitrumUnsignedTx) gasTipCap() *big.Int { return bigZero }
62+
func (tx *ArbitrumUnsignedTx) gasFeeCap() *big.Int { return tx.GasFeeCap }
6363
func (tx *ArbitrumUnsignedTx) value() *big.Int { return tx.Value }
6464
func (tx *ArbitrumUnsignedTx) nonce() uint64 { return tx.Nonce }
6565
func (tx *ArbitrumUnsignedTx) to() *common.Address { return tx.To }
@@ -78,11 +78,11 @@ type ArbitrumContractTx struct {
7878
RequestId common.Hash
7979
From common.Address
8080

81-
GasPrice *big.Int // wei per gas
82-
Gas uint64 // gas limit
83-
To *common.Address `rlp:"nil"` // nil means contract creation
84-
Value *big.Int // wei amount
85-
Data []byte // contract invocation input data
81+
GasFeeCap *big.Int // wei per gas
82+
Gas uint64 // gas limit
83+
To *common.Address `rlp:"nil"` // nil means contract creation
84+
Value *big.Int // wei amount
85+
Data []byte // contract invocation input data
8686
}
8787

8888
func (tx *ArbitrumContractTx) txType() byte { return ArbitrumContractTxType }
@@ -91,7 +91,7 @@ func (tx *ArbitrumContractTx) copy() TxData {
9191
cpy := &ArbitrumContractTx{
9292
ChainId: new(big.Int),
9393
RequestId: tx.RequestId,
94-
GasPrice: new(big.Int),
94+
GasFeeCap: new(big.Int),
9595
Gas: tx.Gas,
9696
From: tx.From,
9797
To: nil,
@@ -101,8 +101,8 @@ func (tx *ArbitrumContractTx) copy() TxData {
101101
if tx.ChainId != nil {
102102
cpy.ChainId.Set(tx.ChainId)
103103
}
104-
if tx.GasPrice != nil {
105-
cpy.GasPrice.Set(tx.GasPrice)
104+
if tx.GasFeeCap != nil {
105+
cpy.GasFeeCap.Set(tx.GasFeeCap)
106106
}
107107
if tx.To != nil {
108108
tmp := *tx.To
@@ -118,9 +118,9 @@ func (tx *ArbitrumContractTx) chainID() *big.Int { return tx.ChainId }
118118
func (tx *ArbitrumContractTx) accessList() AccessList { return nil }
119119
func (tx *ArbitrumContractTx) data() []byte { return tx.Data }
120120
func (tx *ArbitrumContractTx) gas() uint64 { return tx.Gas }
121-
func (tx *ArbitrumContractTx) gasPrice() *big.Int { return tx.GasPrice }
122-
func (tx *ArbitrumContractTx) gasTipCap() *big.Int { return tx.GasPrice }
123-
func (tx *ArbitrumContractTx) gasFeeCap() *big.Int { return tx.GasPrice }
121+
func (tx *ArbitrumContractTx) gasPrice() *big.Int { return tx.GasFeeCap }
122+
func (tx *ArbitrumContractTx) gasTipCap() *big.Int { return bigZero }
123+
func (tx *ArbitrumContractTx) gasFeeCap() *big.Int { return tx.GasFeeCap }
124124
func (tx *ArbitrumContractTx) value() *big.Int { return tx.Value }
125125
func (tx *ArbitrumContractTx) nonce() uint64 { return 0 }
126126
func (tx *ArbitrumContractTx) to() *common.Address { return tx.To }
@@ -135,35 +135,35 @@ type ArbitrumRetryTx struct {
135135
Nonce uint64
136136
From common.Address
137137

138-
GasPrice *big.Int // wei per gas
139-
Gas uint64 // gas limit
140-
To *common.Address `rlp:"nil"` // nil means contract creation
141-
Value *big.Int // wei amount
142-
Data []byte // contract invocation input data
143-
TicketId common.Hash
144-
RefundTo common.Address
138+
GasFeeCap *big.Int // wei per gas
139+
Gas uint64 // gas limit
140+
To *common.Address `rlp:"nil"` // nil means contract creation
141+
Value *big.Int // wei amount
142+
Data []byte // contract invocation input data
143+
TicketId common.Hash
144+
RefundTo common.Address
145145
}
146146

147147
func (tx *ArbitrumRetryTx) txType() byte { return ArbitrumRetryTxType }
148148

149149
func (tx *ArbitrumRetryTx) copy() TxData {
150150
cpy := &ArbitrumRetryTx{
151-
ChainId: new(big.Int),
152-
Nonce: tx.Nonce,
153-
GasPrice: new(big.Int),
154-
Gas: tx.Gas,
155-
From: tx.From,
156-
To: nil,
157-
Value: new(big.Int),
158-
Data: common.CopyBytes(tx.Data),
159-
TicketId: tx.TicketId,
160-
RefundTo: tx.RefundTo,
151+
ChainId: new(big.Int),
152+
Nonce: tx.Nonce,
153+
GasFeeCap: new(big.Int),
154+
Gas: tx.Gas,
155+
From: tx.From,
156+
To: nil,
157+
Value: new(big.Int),
158+
Data: common.CopyBytes(tx.Data),
159+
TicketId: tx.TicketId,
160+
RefundTo: tx.RefundTo,
161161
}
162162
if tx.ChainId != nil {
163163
cpy.ChainId.Set(tx.ChainId)
164164
}
165-
if tx.GasPrice != nil {
166-
cpy.GasPrice.Set(tx.GasPrice)
165+
if tx.GasFeeCap != nil {
166+
cpy.GasFeeCap.Set(tx.GasFeeCap)
167167
}
168168
if tx.To != nil {
169169
tmp := *tx.To
@@ -179,9 +179,9 @@ func (tx *ArbitrumRetryTx) chainID() *big.Int { return tx.ChainId }
179179
func (tx *ArbitrumRetryTx) accessList() AccessList { return nil }
180180
func (tx *ArbitrumRetryTx) data() []byte { return tx.Data }
181181
func (tx *ArbitrumRetryTx) gas() uint64 { return tx.Gas }
182-
func (tx *ArbitrumRetryTx) gasPrice() *big.Int { return tx.GasPrice }
183-
func (tx *ArbitrumRetryTx) gasTipCap() *big.Int { return tx.GasPrice }
184-
func (tx *ArbitrumRetryTx) gasFeeCap() *big.Int { return tx.GasPrice }
182+
func (tx *ArbitrumRetryTx) gasPrice() *big.Int { return tx.GasFeeCap }
183+
func (tx *ArbitrumRetryTx) gasTipCap() *big.Int { return bigZero }
184+
func (tx *ArbitrumRetryTx) gasFeeCap() *big.Int { return tx.GasFeeCap }
185185
func (tx *ArbitrumRetryTx) value() *big.Int { return tx.Value }
186186
func (tx *ArbitrumRetryTx) nonce() uint64 { return tx.Nonce }
187187
func (tx *ArbitrumRetryTx) to() *common.Address { return tx.To }
@@ -197,7 +197,7 @@ type ArbitrumSubmitRetryableTx struct {
197197
From common.Address
198198

199199
DepositValue *big.Int
200-
GasPrice *big.Int // wei per gas
200+
GasFeeCap *big.Int // wei per gas
201201
Gas uint64 // gas limit
202202
To *common.Address `rlp:"nil"` // nil means contract creation
203203
Value *big.Int // wei amount
@@ -214,7 +214,7 @@ func (tx *ArbitrumSubmitRetryableTx) copy() TxData {
214214
ChainId: new(big.Int),
215215
RequestId: tx.RequestId,
216216
DepositValue: new(big.Int),
217-
GasPrice: new(big.Int),
217+
GasFeeCap: new(big.Int),
218218
Gas: tx.Gas,
219219
From: tx.From,
220220
To: tx.To,
@@ -230,8 +230,8 @@ func (tx *ArbitrumSubmitRetryableTx) copy() TxData {
230230
if tx.DepositValue != nil {
231231
cpy.DepositValue.Set(tx.DepositValue)
232232
}
233-
if tx.GasPrice != nil {
234-
cpy.GasPrice.Set(tx.GasPrice)
233+
if tx.GasFeeCap != nil {
234+
cpy.GasFeeCap.Set(tx.GasFeeCap)
235235
}
236236
if tx.To != nil {
237237
tmp := *tx.To
@@ -250,9 +250,9 @@ func (tx *ArbitrumSubmitRetryableTx) chainID() *big.Int { return tx.ChainId
250250
func (tx *ArbitrumSubmitRetryableTx) accessList() AccessList { return nil }
251251
func (tx *ArbitrumSubmitRetryableTx) data() []byte { return tx.Data }
252252
func (tx *ArbitrumSubmitRetryableTx) gas() uint64 { return tx.Gas }
253-
func (tx *ArbitrumSubmitRetryableTx) gasPrice() *big.Int { return tx.GasPrice }
254-
func (tx *ArbitrumSubmitRetryableTx) gasTipCap() *big.Int { return tx.GasPrice }
255-
func (tx *ArbitrumSubmitRetryableTx) gasFeeCap() *big.Int { return tx.GasPrice }
253+
func (tx *ArbitrumSubmitRetryableTx) gasPrice() *big.Int { return tx.GasFeeCap }
254+
func (tx *ArbitrumSubmitRetryableTx) gasTipCap() *big.Int { return big.NewInt(0) }
255+
func (tx *ArbitrumSubmitRetryableTx) gasFeeCap() *big.Int { return tx.GasFeeCap }
256256
func (tx *ArbitrumSubmitRetryableTx) value() *big.Int { return tx.Value }
257257
func (tx *ArbitrumSubmitRetryableTx) nonce() uint64 { return 0 }
258258
func (tx *ArbitrumSubmitRetryableTx) to() *common.Address { return tx.To }

0 commit comments

Comments
 (0)