Skip to content

Commit 6319769

Browse files
authored
cip66 fixes (#2310)
* Fix rlp serailisation of cip66 tx to match cip definition https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0066.md * Ensure cip66 tx MaxFeeInFeeCurrency is copied The field was not being copied by the copy method.
1 parent 06eee2c commit 6319769

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

core/types/celo_denominated_tx.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ type CeloDenominatedTx struct {
1717
GasTipCap *big.Int
1818
GasFeeCap *big.Int
1919
Gas uint64
20-
FeeCurrency *common.Address `rlp:"nil"` // nil means native currency
2120
To *common.Address `rlp:"nil"` // nil means contract creation
2221
Value *big.Int
2322
Data []byte
2423
AccessList AccessList
24+
FeeCurrency *common.Address `rlp:"nil"` // nil means native currency
2525
MaxFeeInFeeCurrency *big.Int
2626

2727
// Signature values
@@ -39,14 +39,15 @@ func (tx *CeloDenominatedTx) copy() TxData {
3939
Gas: tx.Gas,
4040
FeeCurrency: copyAddressPtr(tx.FeeCurrency),
4141
// These are copied below.
42-
AccessList: make(AccessList, len(tx.AccessList)),
43-
Value: new(big.Int),
44-
ChainID: new(big.Int),
45-
GasTipCap: new(big.Int),
46-
GasFeeCap: new(big.Int),
47-
V: new(big.Int),
48-
R: new(big.Int),
49-
S: new(big.Int),
42+
AccessList: make(AccessList, len(tx.AccessList)),
43+
Value: new(big.Int),
44+
ChainID: new(big.Int),
45+
GasTipCap: new(big.Int),
46+
GasFeeCap: new(big.Int),
47+
MaxFeeInFeeCurrency: new(big.Int),
48+
V: new(big.Int),
49+
R: new(big.Int),
50+
S: new(big.Int),
5051
}
5152
copy(cpy.AccessList, tx.AccessList)
5253
if tx.Value != nil {
@@ -61,6 +62,9 @@ func (tx *CeloDenominatedTx) copy() TxData {
6162
if tx.GasFeeCap != nil {
6263
cpy.GasFeeCap.Set(tx.GasFeeCap)
6364
}
65+
if tx.MaxFeeInFeeCurrency != nil {
66+
cpy.MaxFeeInFeeCurrency.Set(tx.MaxFeeInFeeCurrency)
67+
}
6468
if tx.V != nil {
6569
cpy.V.Set(tx.V)
6670
}

0 commit comments

Comments
 (0)