@@ -13,8 +13,6 @@ import (
13
13
"github.com/ethereum/go-ethereum/params"
14
14
15
15
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
16
- ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
17
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
18
16
cronosevents "github.com/crypto-org-chain/cronos/v2/x/cronos/events"
19
17
"github.com/crypto-org-chain/cronos/v2/x/cronos/events/bindings/cosmos/precompile/relayer"
20
18
"github.com/crypto-org-chain/cronos/v2/x/cronos/types"
@@ -60,10 +58,6 @@ const (
60
58
UpdateClientAndAcknowledgement = "updateClientAndAcknowledgement"
61
59
UpdateClientAndTimeout = "updateClientAndTimeout"
62
60
UpdateClientAndTimeoutOnClose = "updateClientAndTimeoutOnClose"
63
-
64
- GasForUpdateClient = 111894
65
- GasWhenReceiverChainIsSource = 51705
66
- GasWhenReceiverChainIsNotSource = 144025
67
61
)
68
62
69
63
func init () {
@@ -99,7 +93,7 @@ func init() {
99
93
case ChannelCloseConfirm :
100
94
relayerGasRequiredByMethod [methodID ] = 31199
101
95
case RecvPacket :
102
- relayerGasRequiredByMethod [methodID ] = GasWhenReceiverChainIsNotSource
96
+ relayerGasRequiredByMethod [methodID ] = 144025
103
97
case Acknowledgement :
104
98
relayerGasRequiredByMethod [methodID ] = 61781
105
99
case Timeout :
@@ -113,7 +107,7 @@ func init() {
113
107
case UpdateClientAndChannelOpenConfirm :
114
108
relayerGasRequiredByMethod [methodID ] = 132734
115
109
case UpdateClientAndRecvPacket :
116
- relayerGasRequiredByMethod [methodID ] = GasForUpdateClient + GasWhenReceiverChainIsNotSource
110
+ relayerGasRequiredByMethod [methodID ] = 257120
117
111
case UpdateClientAndConnectionOpenInit :
118
112
relayerGasRequiredByMethod [methodID ] = 131649
119
113
case UpdateClientAndConnectionOpenAck :
@@ -171,34 +165,6 @@ func (bc *RelayerContract) RequiredGas(input []byte) (gas uint64) {
171
165
var methodID [4 ]byte
172
166
copy (methodID [:], input [:4 ])
173
167
requiredGas , ok := relayerGasRequiredByMethod [methodID ]
174
- method , err := irelayerABI .MethodById (methodID [:])
175
- if err != nil {
176
- panic (err )
177
- }
178
- if method .Name == RecvPacket || method .Name == UpdateClientAndRecvPacket {
179
- args , err := method .Inputs .Unpack (input [4 :])
180
- if err != nil {
181
- panic (err )
182
- }
183
- i := args [0 ].([]byte )
184
- if method .Name == UpdateClientAndRecvPacket {
185
- i = args [1 ].([]byte )
186
- }
187
- var msg channeltypes.MsgRecvPacket
188
- if err = bc .cdc .Unmarshal (i , & msg ); err != nil {
189
- panic (err )
190
- }
191
- var data ibctransfertypes.FungibleTokenPacketData
192
- if err = ibctransfertypes .ModuleCdc .UnmarshalJSON (msg .Packet .GetData (), & data ); err != nil {
193
- panic (err )
194
- }
195
- if ibctransfertypes .ReceiverChainIsSource (msg .Packet .GetSourcePort (), msg .Packet .GetSourceChannel (), data .Denom ) {
196
- requiredGas = GasWhenReceiverChainIsSource
197
- if method .Name == UpdateClientAndRecvPacket {
198
- requiredGas += GasForUpdateClient
199
- }
200
- }
201
- }
202
168
intrinsicGas , _ := core .IntrinsicGas (input , nil , false , bc .isHomestead , bc .isIstanbul , bc .isShanghai )
203
169
defer func () {
204
170
methodName := relayerMethodNamedByMethod [methodID ]
0 commit comments