Skip to content

Commit

Permalink
cip66 fixes (#2310)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
piersy authored Jun 11, 2024
1 parent 06eee2c commit 6319769
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions core/types/celo_denominated_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ type CeloDenominatedTx struct {
GasTipCap *big.Int
GasFeeCap *big.Int
Gas uint64
FeeCurrency *common.Address `rlp:"nil"` // nil means native currency
To *common.Address `rlp:"nil"` // nil means contract creation
Value *big.Int
Data []byte
AccessList AccessList
FeeCurrency *common.Address `rlp:"nil"` // nil means native currency
MaxFeeInFeeCurrency *big.Int

// Signature values
Expand All @@ -39,14 +39,15 @@ func (tx *CeloDenominatedTx) copy() TxData {
Gas: tx.Gas,
FeeCurrency: copyAddressPtr(tx.FeeCurrency),
// These are copied below.
AccessList: make(AccessList, len(tx.AccessList)),
Value: new(big.Int),
ChainID: new(big.Int),
GasTipCap: new(big.Int),
GasFeeCap: new(big.Int),
V: new(big.Int),
R: new(big.Int),
S: new(big.Int),
AccessList: make(AccessList, len(tx.AccessList)),
Value: new(big.Int),
ChainID: new(big.Int),
GasTipCap: new(big.Int),
GasFeeCap: new(big.Int),
MaxFeeInFeeCurrency: new(big.Int),
V: new(big.Int),
R: new(big.Int),
S: new(big.Int),
}
copy(cpy.AccessList, tx.AccessList)
if tx.Value != nil {
Expand All @@ -61,6 +62,9 @@ func (tx *CeloDenominatedTx) copy() TxData {
if tx.GasFeeCap != nil {
cpy.GasFeeCap.Set(tx.GasFeeCap)
}
if tx.MaxFeeInFeeCurrency != nil {
cpy.MaxFeeInFeeCurrency.Set(tx.MaxFeeInFeeCurrency)
}
if tx.V != nil {
cpy.V.Set(tx.V)
}
Expand Down

0 comments on commit 6319769

Please sign in to comment.