Skip to content

Commit

Permalink
Update e2e_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
DeVikingMark authored Jan 25, 2025
1 parent accd997 commit 608f6cf
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package e2e

import "fmt"
import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank/types"

Check failure on line 7 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

"github.com/cosmos/cosmos-sdk/x/bank/types" imported and not used

Check failure on line 7 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

"github.com/cosmos/cosmos-sdk/x/bank/types" imported and not used

Check failure on line 7 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

"github.com/cosmos/cosmos-sdk/x/bank/types" imported and not used
)

var (
runBankTest = true
Expand Down Expand Up @@ -86,7 +91,40 @@ func (s *IntegrationTestSuite) TestSlashing() {
s.testSlashing(chainAPI)
}

// todo add fee test with wrong denom order
func (s *IntegrationTestSuite) TestFeeWithWrongDenomOrder() {
chainAPI := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))

Check failure on line 95 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

chainAPI declared and not used

Check failure on line 95 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

chainAPI declared and not used

Check failure on line 95 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

chainAPI declared and not used

// Get the first validator's address
val1 := s.chainA.validators[0]
valAddr := val1.keyInfo.GetAddress()

Check failure on line 99 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

assignment mismatch: 1 variable but val1.keyInfo.GetAddress returns 2 values

Check failure on line 99 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

assignment mismatch: 1 variable but val1.keyInfo.GetAddress returns 2 values

Check failure on line 99 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

assignment mismatch: 1 variable but val1.keyInfo.GetAddress returns 2 values

// Create a transaction with fees in wrong denom order
fees := sdk.NewCoins(
sdk.NewCoin("stake", sdk.NewInt(1000)),

Check failure on line 103 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: sdk.NewInt

Check failure on line 103 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

undefined: sdk.NewInt

Check failure on line 103 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

undefined: sdk.NewInt
sdk.NewCoin("atom", sdk.NewInt(100)),

Check failure on line 104 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: sdk.NewInt

Check failure on line 104 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

undefined: sdk.NewInt

Check failure on line 104 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

undefined: sdk.NewInt
)

msg := banktypes.NewMsgSend(

Check failure on line 107 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: banktypes

Check failure on line 107 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

undefined: banktypes

Check failure on line 107 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

undefined: banktypes
valAddr,
valAddr,
sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1))),

Check failure on line 110 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: sdk.NewInt

Check failure on line 110 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

undefined: sdk.NewInt

Check failure on line 110 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

undefined: sdk.NewInt
)

// Build and sign the transaction
txBuilder := s.chainA.clientCtx.TxConfig.NewTxBuilder()

Check failure on line 114 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.chainA.clientCtx undefined (type *chain has no field or method clientCtx)

Check failure on line 114 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

s.chainA.clientCtx undefined (type *chain has no field or method clientCtx)

Check failure on line 114 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

s.chainA.clientCtx undefined (type *chain has no field or method clientCtx)
err := txBuilder.SetMsgs(msg)
s.Require().NoError(err)

txBuilder.SetFeeAmount(fees)
txBuilder.SetGasLimit(200000)

// The transaction should still be accepted and processed correctly
// despite the fees being in a different order
tx, err := s.chainA.SignAndBroadcastTx(val1.keyInfo, txBuilder)

Check failure on line 123 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.chainA.SignAndBroadcastTx undefined (type *chain has no field or method SignAndBroadcastTx) (typecheck)

Check failure on line 123 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

s.chainA.SignAndBroadcastTx undefined (type *chain has no field or method SignAndBroadcastTx)

Check failure on line 123 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

s.chainA.SignAndBroadcastTx undefined (type *chain has no field or method SignAndBroadcastTx) (typecheck)
s.Require().NoError(err)
s.Require().Equal(uint32(0), tx.Code)
}

func (s *IntegrationTestSuite) TestStakingAndDistribution() {
if !runStakingAndDistributionTest {
s.T().Skip()
Expand Down

0 comments on commit 608f6cf

Please sign in to comment.