Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for JSON and RLP encoding/decoding of Celo Transactions #306

Merged
merged 7 commits into from
Jan 14, 2025
7 changes: 7 additions & 0 deletions core/types/celo_transaction_marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func celoTransactionMarshal(tx *Transaction) ([]byte, bool, error) {
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
enc.To = tx.To()
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
enc.GasPrice = (*hexutil.Big)(itx.GasPrice)
Kourin1996 marked this conversation as resolved.
Show resolved Hide resolved
enc.Value = (*hexutil.Big)(itx.Value)
enc.Input = (*hexutil.Bytes)(&itx.Data)
enc.V = (*hexutil.Big)(itx.V)
Expand Down Expand Up @@ -340,7 +341,13 @@ func celoTransactionUnmarshal(dec txJSON, inner *TxData) (bool, error) {
}
}
// Celo specific fields
if dec.FeeCurrency == nil {
return true, errors.New("missing required field 'feeCurrency' in transaction")
}
itx.FeeCurrency = dec.FeeCurrency
if dec.MaxFeeInFeeCurrency == nil {
return true, errors.New("missing required field 'maxFeeInFeeCurrency' in transaction")
}
itx.MaxFeeInFeeCurrency = (*big.Int)(dec.MaxFeeInFeeCurrency)
default:
return false, nil
Expand Down
Loading
Loading