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

Open
wants to merge 6 commits into
base: celo11
Choose a base branch
from

Conversation

Kourin1996
Copy link

@Kourin1996 Kourin1996 commented Jan 8, 2025

Closes #151

This PR adds tests for json and RLP encoding/decoding of the following Celo Tx types:

  • CeloLegacyTx
  • CeloDynamicFeeTx
  • CeloDynamicFeeTxV2
  • CeloDenominatedTx

@Kourin1996 Kourin1996 changed the title Kourin1996/add celo tx encoding decoding Adding unit tests for JSON and RLP encoding/decoding of Celo Transactions Jan 8, 2025
@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one thing while I was writing a test:

Originally Celo's LegacyTx set null to gasPrice field on json marshaling. But Celo LegacyTx takes gasPrice field from JSON on unmarshaling. It causes mismatch after marshaling and unmarshaling.

Is this fix right? If no, I will remove this new line and do small fixes of unit tests

@Kourin1996 Kourin1996 marked this pull request as ready for review January 8, 2025 14:48
@Kourin1996 Kourin1996 changed the title Adding unit tests for JSON and RLP encoding/decoding of Celo Transactions Add unit tests for JSON and RLP encoding/decoding of Celo Transactions Jan 8, 2025
@Kourin1996 Kourin1996 self-assigned this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test for Handle migrated celo transactions PR
1 participant