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

Problem: ibc-go 7.3.0 is not used #1184

Merged
merged 11 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [cronos#1014](https://github.com/crypto-org-chain/cronos/pull/1014) Support stateful precompiled contract for relayer.
- [cronos#1165](https://github.com/crypto-org-chain/cronos/pull/1165) Icaauth module is not adjusted correctly in ibc-go v7.2.0.
- [cronos#837](https://github.com/crypto-org-chain/cronos/pull/837) Support stateful precompiled contract for bank.
- [cronos#1184](https://github.com/crypto-org-chain/cronos/pull/1184) Update ibc-go to `v7.3.1`.

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion app/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func benchmarkERC20Transfer(b *testing.B, db dbm.DB) {
ethSigner := ethtypes.LatestSignerForChainID(chainID)

signTx := func(msg *evmtypes.MsgEthereumTx) ([]byte, error) {
msg.From = address.String()
msg.From = address.Bytes()
if err := msg.Sign(ethSigner, signer); err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ require (
github.com/cometbft/cometbft v0.37.3-0.20230920093934-46df7b597e3c
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.2
github.com/cosmos/cosmos-sdk v0.47.3
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-go/v7 v7.2.0
github.com/cosmos/ibc-go/v7 v7.3.1-0.20230920070810-c3261472c815
github.com/crypto-org-chain/cronos/store v0.0.4
github.com/crypto-org-chain/cronos/versiondb v0.0.0-00010101000000-000000000000
github.com/ethereum/go-ethereum v1.10.26
Expand Down Expand Up @@ -233,7 +233,7 @@ replace (
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc1
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20230921025237-ae144329ecaf
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
github.com/cosmos/iavl v0.21.0-alpha.1.0.20230904092046-df3db2d96583 h1:3Matt7/LjZiZkIBPalYazOZcw2B05Ch14dU5TJyqJEc=
github.com/cosmos/iavl v0.21.0-alpha.1.0.20230904092046-df3db2d96583/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6cg=
github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc=
github.com/cosmos/ibc-go/v7 v7.3.1-0.20230920070810-c3261472c815 h1:raSo7w7B3IXCb7DZozHWz8ajG7HLWZw9foiyCbEgInI=
github.com/cosmos/ibc-go/v7 v7.3.1-0.20230920070810-c3261472c815/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
Expand Down Expand Up @@ -482,8 +482,8 @@ github.com/crypto-org-chain/cometbft-db v0.0.0-20230921030527-0d47d7537e32 h1:Vq
github.com/crypto-org-chain/cometbft-db v0.0.0-20230921030527-0d47d7537e32/go.mod h1:V32HRAjDsAYLfAT90mk0O9UH+sE7P5apfiCmmmVLt3Q=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20230905040840-b3af5590283b h1:d2GOFR3i3BjDlPsmJkp8Gsrt9LK2nq2IVEnE/rMv1Fo=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20230905040840-b3af5590283b/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230921025237-ae144329ecaf h1:XvwFJ6kPHOYevfNjshq4n2nazvYzoSaQ8AjSYWSfUhI=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230921025237-ae144329ecaf/go.mod h1:KtjU2MHMCTcLnAoS9C3U3f+vx4f9HHNQRcOlxXiVDxY=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32 h1:A++epzNCr3EY57dnU6UTSDwbCiPD6MjvUKHKSd/PoI8=
github.com/crypto-org-chain/ethermint v0.6.1-0.20230925072753-4062d0cc2a32/go.mod h1:wnJQyK4n0vShhL+YIAUd7XCzUhgZ9fgG6yJ14n7qefo=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e/go.mod h1:HBaDqlFjlaXJwVQtA7jHejyaA7xwjXI2o6pU/ccP3tE=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
Expand Down
8 changes: 4 additions & 4 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ schema = 3
version = "v0.21.0-alpha.1.0.20230904092046-df3db2d96583"
hash = "sha256-3Va8Ljq63IXty0oHlRpqfsC6WsMut6TWZ2R+/nYtfTU="
[mod."github.com/cosmos/ibc-go/v7"]
version = "v7.2.0"
hash = "sha256-fg+0AykvEMzqRGI5CmqwjQtSIwTyT6RuSDpp12wzReM="
version = "v7.3.1-0.20230920070810-c3261472c815"
hash = "sha256-x/D64hmU+aOc5sm8RzXMB+8y+530+CCEik/Zpj3Rf9A="
[mod."github.com/cosmos/ics23/go"]
version = "v0.10.0"
hash = "sha256-KYEv727BO/ht63JO02xiKFGFAddg41Ve9l2vSSZZBq0="
Expand Down Expand Up @@ -213,8 +213,8 @@ schema = 3
hash = "sha256-GgcReGsIIuBE2TabDYqDO9sBGogdVr9RSh4arQzdPnE="
replaced = "github.com/evmos/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20230921025237-ae144329ecaf"
hash = "sha256-ZDzwB65qROKNIB4Yv1i+5FTJoejeuRCcUzUacyuFBFw="
version = "v0.6.1-0.20230925072753-4062d0cc2a32"
hash = "sha256-8zwdHROHnAVfly2PIaNAfiXfb2fWsTqePaZ58EJtjH4="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.2"
Expand Down
4 changes: 2 additions & 2 deletions x/cronos/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
}

// populate the `From` field
if _, err := msg.GetSender(chainID); err != nil {
if _, err := msg.GetSenderLegacy(chainID); err != nil {

Check warning on line 82 in x/cronos/keeper/grpc_query.go

View check run for this annotation

Codecov / codecov/patch

x/cronos/keeper/grpc_query.go#L82

Added line #L82 was not covered by tests
return nil, err
}
fees, err := evmkeeper.VerifyFee(txData, evmDenom, baseFee, homestead, istanbul, ctx.IsCheckTx())
if err != nil {
return nil, errorsmod.Wrapf(err, "failed to verify the fees")
}
if err := k.evmKeeper.DeductTxCostsFromUserBalance(ctx, fees, common.HexToAddress(msg.From)); err != nil {
if err := k.evmKeeper.DeductTxCostsFromUserBalance(ctx, fees, common.BytesToAddress(msg.From)); err != nil {

Check warning on line 89 in x/cronos/keeper/grpc_query.go

View check run for this annotation

Codecov / codecov/patch

x/cronos/keeper/grpc_query.go#L89

Added line #L89 was not covered by tests
return nil, err
}

Expand Down
6 changes: 1 addition & 5 deletions x/cronos/keeper/precompiles/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ func (bc *BankContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) (
token := args[0].(common.Address)
addr := args[1].(common.Address)
// query from storage
balance := big.NewInt(0)
err = stateDB.ExecuteNativeAction(precompileAddr, nil, func(ctx sdk.Context) error {
balance = bc.bankKeeper.GetBalance(ctx, sdk.AccAddress(addr.Bytes()), EVMDenom(token)).Amount.BigInt()
return err
})
balance := bc.bankKeeper.GetBalance(stateDB.CacheContext(), sdk.AccAddress(addr.Bytes()), EVMDenom(token)).Amount.BigInt()
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
return method.Outputs.Pack(balance)
case "transfer":
if readonly {
Expand Down
1 change: 1 addition & 0 deletions x/cronos/keeper/precompiles/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ import (
type ExtStateDB interface {
vm.StateDB
ExecuteNativeAction(contract common.Address, converter statedb.EventConverter, action func(ctx sdk.Context) error) error
CacheContext() sdk.Context
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 2 additions & 2 deletions x/cronos/rpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (api *CronosAPI) GetTransactionReceiptsByBlock(blockNrOrHash rpctypes.Block
status = hexutil.Uint(ethtypes.ReceiptStatusSuccessful)
}

from, err := ethMsg.GetSender(api.chainIDEpoch)
from, err := ethMsg.GetSenderLegacy(api.chainIDEpoch)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -313,7 +313,7 @@ func (api *CronosAPI) ReplayBlock(blockNrOrHash rpctypes.BlockNumberOrHash, post
status = hexutil.Uint(ethtypes.ReceiptStatusSuccessful)
}

from, err := ethMsg.GetSender(api.chainIDEpoch)
from, err := ethMsg.GetSenderLegacy(api.chainIDEpoch)
if err != nil {
return nil, err
}
Expand Down
Loading