Skip to content

Commit

Permalink
chore: uncomment or fix necessary parts
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jan 15, 2024
1 parent 915ed04 commit 5bbc773
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 304 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/deploy-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ jobs:
go.sum
- name: Test contract
run: |
sudo env "PATH=$PATH" go version
sudo env "PATH=$PATH" go env
sudo env "PATH=$PATH" make contract-tools
sudo env "PATH=$PATH" make test-solidity
if: env.GIT_DIFF
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ run:
linters:
enable:
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
Expand Down
2 changes: 1 addition & 1 deletion .semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node_modules/
build/
dist/
vendor/
env/
.env/
.venv/
.tox/
*.min.js
Expand Down
1 change: 1 addition & 0 deletions app/ante/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
Txs: [][]byte{bz},
},
)
suite.Require().Equal(len(resFinalizeBlock.TxResults), 1)
suite.Require().Equal(resFinalizeBlock.TxResults[0].Code, tc.expectedCode, resFinalizeBlock.TxResults[0].Log)
})
}
Expand Down
295 changes: 150 additions & 145 deletions ethereum/eip712/eip712_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ import (

"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/cosmos/cosmos-sdk/x/bank"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/distribution"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/suite"
)

Expand Down Expand Up @@ -144,156 +149,156 @@ func (suite *EIP712TestSuite) TestEIP712() {
timeoutHeight uint64
expectSuccess bool
}{
// {
// title: "Succeeds - Standard MsgSend",
// msgs: []sdk.Msg{
// banktypes.NewMsgSend(
// suite.createTestAddress(),
// suite.createTestAddress(),
// suite.makeCoins(suite.denom, math.NewInt(1)),
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Standard MsgVote",
// msgs: []sdk.Msg{
// govtypes.NewMsgVote(
// suite.createTestAddress(),
// 5,
// govtypes.OptionNo,
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Standard MsgDelegate",
// msgs: []sdk.Msg{
// stakingtypes.NewMsgDelegate(
// suite.createTestAddress().String(),
// sdk.ValAddress(suite.createTestAddress()).String(),
// suite.makeCoins(suite.denom, math.NewInt(1))[0],
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Standard MsgWithdrawDelegationReward",
// msgs: []sdk.Msg{
// distributiontypes.NewMsgWithdrawDelegatorReward(
// suite.createTestAddress().String(),
// sdk.ValAddress(suite.createTestAddress()).String(),
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Two Single-Signer MsgDelegate",
// msgs: []sdk.Msg{
// stakingtypes.NewMsgDelegate(
// params.address.String(),
// sdk.ValAddress(suite.createTestAddress()).String(),
// suite.makeCoins(suite.denom, math.NewInt(1))[0],
// ),
// stakingtypes.NewMsgDelegate(
// params.address.String(),
// sdk.ValAddress(suite.createTestAddress()).String(),
// suite.makeCoins(suite.denom, math.NewInt(5))[0],
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Single-Signer MsgVote V1 with Omitted Value",
// msgs: []sdk.Msg{
// govtypesv1.NewMsgVote(
// params.address,
// 5,
// govtypesv1.VoteOption_VOTE_OPTION_NO,
// "",
// ),
// },
// expectSuccess: true,
// },
// {
// title: "Succeeds - Single-Signer MsgSend + MsgVote",
// msgs: []sdk.Msg{
// govtypes.NewMsgVote(
// params.address,
// 5,
// govtypes.OptionNo,
// ),
// banktypes.NewMsgSend(
// params.address,
// suite.createTestAddress(),
// suite.makeCoins(suite.denom, math.NewInt(50)),
// ),
// },
// expectSuccess: !suite.useLegacyEIP712TypedData,
// },
// {
// title: "Succeeds - Single-Signer 2x MsgVoteV1 with Different Schemas",
// msgs: []sdk.Msg{
// govtypesv1.NewMsgVote(
// params.address,
// 5,
// govtypesv1.VoteOption_VOTE_OPTION_NO,
// "",
// ),
// govtypesv1.NewMsgVote(
// params.address,
// 10,
// govtypesv1.VoteOption_VOTE_OPTION_YES,
// "Has Metadata",
// ),
// },
// expectSuccess: !suite.useLegacyEIP712TypedData,
// },
// {
// title: "Fails - Two MsgVotes with Different Signers",
// msgs: []sdk.Msg{
// govtypes.NewMsgVote(
// suite.createTestAddress(),
// 5,
// govtypes.OptionNo,
// ),
// govtypes.NewMsgVote(
// suite.createTestAddress(),
// 25,
// govtypes.OptionAbstain,
// ),
// },
// expectSuccess: false,
// },
{
title: "Succeeds - Standard MsgSend",
msgs: []sdk.Msg{
banktypes.NewMsgSend(
suite.createTestAddress(),
suite.createTestAddress(),
suite.makeCoins(suite.denom, math.NewInt(1)),
),
},
expectSuccess: true,
},
{
title: "Succeeds - Standard MsgVote",
msgs: []sdk.Msg{
govtypes.NewMsgVote(
suite.createTestAddress(),
5,
govtypes.OptionNo,
),
},
expectSuccess: true,
},
{
title: "Succeeds - Standard MsgDelegate",
msgs: []sdk.Msg{
stakingtypes.NewMsgDelegate(
suite.createTestAddress().String(),
sdk.ValAddress(suite.createTestAddress()).String(),
suite.makeCoins(suite.denom, math.NewInt(1))[0],
),
},
expectSuccess: true,
},
{
title: "Succeeds - Standard MsgWithdrawDelegationReward",
msgs: []sdk.Msg{
distributiontypes.NewMsgWithdrawDelegatorReward(
suite.createTestAddress().String(),
sdk.ValAddress(suite.createTestAddress()).String(),
),
},
expectSuccess: true,
},
{
title: "Succeeds - Two Single-Signer MsgDelegate",
msgs: []sdk.Msg{
stakingtypes.NewMsgDelegate(
params.address.String(),
sdk.ValAddress(suite.createTestAddress()).String(),
suite.makeCoins(suite.denom, math.NewInt(1))[0],
),
stakingtypes.NewMsgDelegate(
params.address.String(),
sdk.ValAddress(suite.createTestAddress()).String(),
suite.makeCoins(suite.denom, math.NewInt(5))[0],
),
},
expectSuccess: true,
},
{
title: "Succeeds - Single-Signer MsgVote V1 with Omitted Value",
msgs: []sdk.Msg{
govtypesv1.NewMsgVote(
params.address,
5,
govtypesv1.VoteOption_VOTE_OPTION_NO,
"",
),
},
expectSuccess: true,
},
{
title: "Succeeds - Single-Signer MsgSend + MsgVote",
msgs: []sdk.Msg{
govtypes.NewMsgVote(
params.address,
5,
govtypes.OptionNo,
),
banktypes.NewMsgSend(
params.address,
suite.createTestAddress(),
suite.makeCoins(suite.denom, math.NewInt(50)),
),
},
expectSuccess: !suite.useLegacyEIP712TypedData,
},
{
title: "Succeeds - Single-Signer 2x MsgVoteV1 with Different Schemas",
msgs: []sdk.Msg{
govtypesv1.NewMsgVote(
params.address,
5,
govtypesv1.VoteOption_VOTE_OPTION_NO,
"",
),
govtypesv1.NewMsgVote(
params.address,
10,
govtypesv1.VoteOption_VOTE_OPTION_YES,
"Has Metadata",
),
},
expectSuccess: !suite.useLegacyEIP712TypedData,
},
{
title: "Fails - Two MsgVotes with Different Signers",
msgs: []sdk.Msg{
govtypes.NewMsgVote(
suite.createTestAddress(),
5,
govtypes.OptionNo,
),
govtypes.NewMsgVote(
suite.createTestAddress(),
25,
govtypes.OptionAbstain,
),
},
expectSuccess: false,
},
{
title: "Fails - Empty Transaction",
msgs: []sdk.Msg{},
expectSuccess: false,
},
// {
// title: "Fails - Invalid ChainID",
// chainID: "invalidchainid",
// msgs: []sdk.Msg{
// govtypes.NewMsgVote(
// suite.createTestAddress(),
// 5,
// govtypes.OptionNo,
// ),
// },
// expectSuccess: false,
// },
// {
// title: "Fails - Includes TimeoutHeight",
// msgs: []sdk.Msg{
// govtypes.NewMsgVote(
// suite.createTestAddress(),
// 5,
// govtypes.OptionNo,
// ),
// },
// timeoutHeight: 1000,
// expectSuccess: false,
// },
{
title: "Fails - Invalid ChainID",
chainID: "invalidchainid",
msgs: []sdk.Msg{
govtypes.NewMsgVote(
suite.createTestAddress(),
5,
govtypes.OptionNo,
),
},
expectSuccess: false,
},
{
title: "Fails - Includes TimeoutHeight",
msgs: []sdk.Msg{
govtypes.NewMsgVote(
suite.createTestAddress(),
5,
govtypes.OptionNo,
),
},
timeoutHeight: 1000,
expectSuccess: false,
},
}

for _, tc := range testCases {
Expand Down
1 change: 0 additions & 1 deletion ethereum/eip712/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func SetEncodingConfig(cfg params.EncodingConfig) {
func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error) {
typedData, err := GetEIP712TypedDataForMsg(signDocBytes)
if err != nil {
_, err := GetEIP712TypedDataForMsg(signDocBytes)
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/backend/tx_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNum

// GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash
// TODO: Don't need to convert once hashing is fixed on Tendermint
// https://github.com/cometbft/cometbft/issues/6539
// https://github.com/tendermint/tendermint/issues/6539
func (b *Backend) GetTxByEthHash(hash common.Hash) (*ethermint.TxResult, error) {
if b.indexer != nil {
return b.indexer.GetByTxHash(hash)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/hardhat/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
env
.env
coverage
coverage.json
typechain
Expand Down
Loading

0 comments on commit 5bbc773

Please sign in to comment.