Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Update preprocess_test
Browse files Browse the repository at this point in the history
  • Loading branch information
austinchandra committed Aug 31, 2022
1 parent ac17f58 commit bbcec73
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ethereum/eip712/preprocess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
evmtypes "github.com/evmos/ethermint/x/evm/types"
)

// Test standard payload preprocessing for Ledger EIP-712-signed transactions
func TestPreprocessLedger(t *testing.T) {
encodingConfig := encoding.MakeConfig(app.ModuleBasics)
ctx := client.Context{}.WithTxConfig(encodingConfig.TxConfig)
Expand Down Expand Up @@ -138,4 +139,27 @@ func TestPreprocessLedger(t *testing.T) {
if len(formattedSig.Signature) != 0 {
t.Errorf("Expected blank signature, but got %v", formattedSig)
}

// Verify tx fields are unchanged
tx := txBuilder.GetTx()

if tx.FeePayer().String() != feePayer.String() {
t.Errorf("Fee payer changed in Tx Builder")
}

if tx.GetGas() != 200000 {
t.Errorf("Gas field changed in Tx Builder")
}

if tx.GetFee().AmountOf("aphoton") != math.NewInt(2000) {
t.Errorf("Fee amount changed in Tx Builder")
}

if tx.GetMemo() != "" {
t.Errorf("Memo changed in Tx Builder")
}

if len(tx.GetMsgs()) != 1 || tx.GetMsgs()[0].String() != msgSend.String() {
t.Errorf("Messages changed in Tx Builder")
}
}

0 comments on commit bbcec73

Please sign in to comment.