Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurist-85 committed Oct 8, 2023
1 parent e3b2e53 commit 48e6928
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
14 changes: 7 additions & 7 deletions ibc/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestGetTransferSenderRecipient(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Sender: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Receiver: "haqq1",
Amount: "123456",
},
Expand All @@ -83,7 +83,7 @@ func TestGetTransferSenderRecipient(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Sender: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Receiver: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Amount: "123456",
},
Expand All @@ -99,7 +99,7 @@ func TestGetTransferSenderRecipient(t *testing.T) {
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Receiver: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Receiver: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Amount: "123456",
},
),
Expand All @@ -113,7 +113,7 @@ func TestGetTransferSenderRecipient(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "osmo1qql8ag4cluz6r4dz28p3w00dnc9w8ueuhnecd2",
Sender: "osmo1tjdjfavsy956d25hvhs3p0nw9a7pfghq3n6zdw",
Receiver: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Amount: "123456",
},
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestGetTransferAmount(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Sender: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Receiver: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Amount: "",
},
Expand All @@ -177,7 +177,7 @@ func TestGetTransferAmount(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Sender: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Receiver: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Amount: "test",
},
Expand All @@ -191,7 +191,7 @@ func TestGetTransferAmount(t *testing.T) {
channeltypes.Packet{
Data: transfertypes.ModuleCdc.MustMarshalJSON(
&transfertypes.FungibleTokenPacketData{
Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc",
Sender: "cosmos1tjdjfavsy956d25hvhs3p0nw9a7pfghqegfjmu",
Receiver: "haqq1hdr0lhv75vesvtndlh78ck4cez6esz8u2lk0hq",
Amount: "10000",
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rpc/backend/chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (suite *BackendTestSuite) TestBaseFee() {
}

func (suite *BackendTestSuite) TestChainId() {
expChainID := (*hexutil.Big)(big.NewInt(9000))
expChainID := (*hexutil.Big)(big.NewInt(54211))
testCases := []struct {
name string
registerMock func()
Expand Down
8 changes: 4 additions & 4 deletions rpc/backend/evm_query_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ var _ evmtypes.QueryClient = &mocks.EVMQueryClient{}
func RegisterTraceTransactionWithPredecessors(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx, predecessors []*evmtypes.MsgEthereumTx) {
data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}
queryClient.On("TraceTx", rpc.ContextWithHeight(1),
&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: predecessors, ChainId: 9000}).
&evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: predecessors, ChainId: 54211}).
Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil)
}

func RegisterTraceTransaction(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) {
data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}
queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: 9000}).
queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: 54211}).
Return(&evmtypes.QueryTraceTxResponse{Data: data}, nil)
}

func RegisterTraceTransactionError(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx) {
queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: 9000}).
queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, ChainId: 54211}).
Return(nil, errortypes.ErrInvalidRequest)
}

// TraceBlock
func RegisterTraceBlock(queryClient *mocks.EVMQueryClient, txs []*evmtypes.MsgEthereumTx) {
data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}
queryClient.On("TraceBlock", rpc.ContextWithHeight(1),
&evmtypes.QueryTraceBlockRequest{Txs: txs, BlockNumber: 1, TraceConfig: &evmtypes.TraceConfig{}, ChainId: 9000}).
&evmtypes.QueryTraceBlockRequest{Txs: txs, BlockNumber: 1, TraceConfig: &evmtypes.TraceConfig{}, ChainId: 54211}).
Return(&evmtypes.QueryTraceBlockResponse{Data: data}, nil)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/erc20_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (suite *TransferETHTestSuite) DoSetupTest(t require.TestingT) {
suite.app = haqqApp
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{
Height: 1,
ChainID: haqqtypes.LocalNetChainID + "-1",
ChainID: haqqtypes.MainNetChainID + "-1",
Time: time.Now().UTC(),
ProposerAddress: consAddress.Bytes(),

Expand Down
2 changes: 1 addition & 1 deletion x/erc20/keeper/ibc_callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() {
name: "no-op - sender is module account",
malleate: func() transfertypes.FungibleTokenPacketData {
// any module account can be passed here
moduleAcc := suite.app.AccountKeeper.GetModuleAccount(suite.ctx, "claims")
moduleAcc := suite.app.AccountKeeper.GetModuleAccount(suite.ctx, "distribution")

return transfertypes.NewFungibleTokenPacketData("", "10", moduleAcc.GetAddress().String(), "", "")
},
Expand Down
6 changes: 3 additions & 3 deletions x/evm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ func (suite *KeeperTestSuite) TestWithChainID() {
},
{
"fail - other chainID",
"chain_7701-1",
"chain7701-1",
0,
true,
},
{
"success - Haqq mainnet chain ID",
"haqq_11235-1",
9001,
11235,
false,
},
{
"success - Haqq testnet chain ID",
"haqq_54211-3",
9000,
54211,
false,
},
}
Expand Down
3 changes: 2 additions & 1 deletion x/vesting/keeper/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/haqq-network/haqq/testutil"
utiltx "github.com/haqq-network/haqq/testutil/tx"
haqqtypes "github.com/haqq-network/haqq/types"
"github.com/haqq-network/haqq/utils"
epochstypes "github.com/haqq-network/haqq/x/epochs/types"
evmtypes "github.com/haqq-network/haqq/x/evm/types"
"github.com/haqq-network/haqq/x/vesting/types"
Expand All @@ -54,7 +55,7 @@ func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) {

// Set Context
header := testutil.NewHeader(
1, time.Now().UTC(), "haqq_121799-1", suite.consAddress, nil, nil,
1, time.Now().UTC(), utils.MainNetChainID+"-1", suite.consAddress, nil, nil,
)
suite.ctx = suite.app.BaseApp.NewContext(false, header)

Expand Down

0 comments on commit 48e6928

Please sign in to comment.