Skip to content

Commit 7375384

Browse files
committed
set chain cfg in precompile
1 parent db72e6d commit 7375384

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ replace (
233233
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
234234
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
235235
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
236-
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231122021350-f905c2ec3570
237-
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20231122101434-6f3ad29bf943
236+
github.com/ethereum/go-ethereum => github.com/mmsqe/go-ethereum v1.10.24-0.20231123010828-56c2cc86af1d
237+
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20231123013901-b3fcb10994ac
238238
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
239239
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
240240
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,8 @@ github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1
484484
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24=
485485
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467 h1:m0/aHPIJAzi2MSP3TXzzbLTFf+koRFQiaYmerRZUtK4=
486486
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20231013072415-eec017435467/go.mod h1:G384omH7cXgm90xXR7xpHvsKG7vdBaDuz4To6GpTHUU=
487-
github.com/crypto-org-chain/ethermint v0.6.1-0.20231122101434-6f3ad29bf943 h1:3mISHcgWKssG+gnZAd6a718zeDgKckvNYLuAAka/dkM=
488-
github.com/crypto-org-chain/ethermint v0.6.1-0.20231122101434-6f3ad29bf943/go.mod h1:y8DDupItqxfGglMpak/ow8E7qvqXM2Vb7t6kdb6s96Q=
489-
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231122021350-f905c2ec3570 h1:GukXF6eVCJZbK5pgTF+SHJoY9Wr0mPh95/LIOUQNMMM=
490-
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231122021350-f905c2ec3570/go.mod h1:DuefStAgaxoaYGLR0FueVcVbehmn5n9QUcVrMCuOvuc=
487+
github.com/crypto-org-chain/ethermint v0.6.1-0.20231123013901-b3fcb10994ac h1:RYfWubmvbdkSIBgnbeYejywU+S3692RUrCDpa2lCHH4=
488+
github.com/crypto-org-chain/ethermint v0.6.1-0.20231123013901-b3fcb10994ac/go.mod h1:y8DDupItqxfGglMpak/ow8E7qvqXM2Vb7t6kdb6s96Q=
491489
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
492490
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e/go.mod h1:HBaDqlFjlaXJwVQtA7jHejyaA7xwjXI2o6pU/ccP3tE=
493491
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
@@ -1145,6 +1143,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
11451143
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
11461144
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
11471145
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
1146+
github.com/mmsqe/go-ethereum v1.10.24-0.20231123010828-56c2cc86af1d h1:6GILBx2knt7OC4z1NlYcKQeONn33d2AE676tBILmtOI=
1147+
github.com/mmsqe/go-ethereum v1.10.24-0.20231123010828-56c2cc86af1d/go.mod h1:DuefStAgaxoaYGLR0FueVcVbehmn5n9QUcVrMCuOvuc=
11481148
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
11491149
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
11501150
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=

gomod2nix.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ schema = 3
212212
version = "v1.1.0"
213213
hash = "sha256-LFcJue98awAFkSPRc93tVvon3kWS7AvumrluxxRzt4c="
214214
[mod."github.com/ethereum/go-ethereum"]
215-
version = "v1.10.20-0.20231122021350-f905c2ec3570"
216-
hash = "sha256-1LRIM5dPmwjBxd57c9Y+2mZuBrbGWfMvEIlqYpdVBPA="
217-
replaced = "github.com/crypto-org-chain/go-ethereum"
215+
version = "v1.10.24-0.20231123010828-56c2cc86af1d"
216+
hash = "sha256-c+LsJ/l1sKEBQVGejSAYlHSMsHWYCnE3Xce5jYioLvo="
217+
replaced = "github.com/mmsqe/go-ethereum"
218218
[mod."github.com/evmos/ethermint"]
219-
version = "v0.6.1-0.20231122101434-6f3ad29bf943"
220-
hash = "sha256-gt8+TkOU9Rg9YjT+ZquRrgxFyCHibLRm27rzuRirpW4="
219+
version = "v0.6.1-0.20231123013901-b3fcb10994ac"
220+
hash = "sha256-9MxoxtYMnK7WswZeBO9RErKG/31E7t9QYig81aLZUlA="
221221
replaced = "github.com/crypto-org-chain/ethermint"
222222
[mod."github.com/felixge/httpsnoop"]
223223
version = "v1.0.2"

x/cronos/keeper/precompiles/relayer.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ func init() {
4545
type RelayerContract struct {
4646
BaseContract
4747

48-
cdc codec.Codec
49-
ibcKeeper types.IbcKeeper
50-
logger log.Logger
48+
cdc codec.Codec
49+
ibcKeeper types.IbcKeeper
50+
logger log.Logger
51+
isHomestead bool
52+
isIstanbul bool
53+
isShanghai bool
5154
}
5255

5356
func NewRelayerContract(ibcKeeper types.IbcKeeper, cdc codec.Codec, logger log.Logger) vm.PrecompiledContract {
@@ -63,13 +66,19 @@ func (bc *RelayerContract) Address() common.Address {
6366
return relayerContractAddress
6467
}
6568

69+
func (bc *RelayerContract) SetChainConfig(isHomestead, isIstanbul, isShanghai bool) {
70+
bc.isHomestead = isHomestead
71+
bc.isIstanbul = isIstanbul
72+
bc.isShanghai = isShanghai
73+
}
74+
6675
// RequiredGas calculates the contract gas use
6776
// `max(0, len(input) * DefaultTxSizeCostPerByte + requiredGasTable[methodPrefix] - intrinsicGas)`
6877
func (bc *RelayerContract) RequiredGas(input []byte) (gas uint64) {
6978
if len(input) < prefixSize4Bytes {
7079
return 0
7180
}
72-
intrinsicGas, err := core.IntrinsicGas(input, nil, false, true, true, true)
81+
intrinsicGas, err := core.IntrinsicGas(input, nil, false, bc.isHomestead, bc.isIstanbul, bc.isShanghai)
7382
if err != nil {
7483
return 0
7584
}

0 commit comments

Comments
 (0)