Skip to content

Commit

Permalink
Problem: require gas for single method in relayer precompile is less …
Browse files Browse the repository at this point in the history
…than consumed

missing gas consume in ante handlers
  • Loading branch information
mmsqe committed May 31, 2024
1 parent d41d670 commit eb54636
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [#1407](https://github.com/crypto-org-chain/cronos/pull/1407) Add end-to-end encryption module.
* [#1414](https://github.com/crypto-org-chain/cronos/pull/1414) Integrate new evm tx format.
* [#1458](https://github.com/crypto-org-chain/cronos/pull/1458) Adjust require gas for recvPacket when ReceiverChainIsSource.
* [#1462](https://github.com/crypto-org-chain/cronos/pull/1462) Adjust require gas in relayer precompile to be closed with actual consumed.

### Improvements

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_ibc_rly_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_ibc(ibc):
cli = ibc.cronos.cosmos_cli()
wait_for_new_blocks(cli, 1)
rly_transfer(ibc)
diff = 0.15
diff = 0.6
record = log_gas_records(cli)
if record:
records.append(record)
Expand Down
30 changes: 15 additions & 15 deletions x/cronos/keeper/precompiles/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const (
Timeout = "timeout"
TimeoutOnClose = "timeoutOnClose"

GasWhenReceiverChainIsSource = 51705
GasWhenReceiverChainIsNotSource = 144025
GasWhenReceiverChainIsSource = 121578
GasWhenReceiverChainIsNotSource = 215038
)

func init() {
Expand All @@ -60,35 +60,35 @@ func init() {
copy(methodID[:], irelayerABI.Methods[methodName].ID[:4])
switch methodName {
case CreateClient:
relayerGasRequiredByMethod[methodID] = 117462
relayerGasRequiredByMethod[methodID] = 114990
case UpdateClient:
relayerGasRequiredByMethod[methodID] = 111894
relayerGasRequiredByMethod[methodID] = 109689
case UpgradeClient:
relayerGasRequiredByMethod[methodID] = 400000
case ConnectionOpenInit:
relayerGasRequiredByMethod[methodID] = 19755
relayerGasRequiredByMethod[methodID] = 89589
case ConnectionOpenTry:
relayerGasRequiredByMethod[methodID] = 38468
relayerGasRequiredByMethod[methodID] = 108323
case ConnectionOpenAck:
relayerGasRequiredByMethod[methodID] = 29603
relayerGasRequiredByMethod[methodID] = 99446
case ConnectionOpenConfirm:
relayerGasRequiredByMethod[methodID] = 12865
relayerGasRequiredByMethod[methodID] = 82735
case ChannelOpenInit:
relayerGasRequiredByMethod[methodID] = 68701
relayerGasRequiredByMethod[methodID] = 138568
case ChannelOpenTry:
relayerGasRequiredByMethod[methodID] = 70562
relayerGasRequiredByMethod[methodID] = 140432
case ChannelOpenAck:
relayerGasRequiredByMethod[methodID] = 22127
relayerGasRequiredByMethod[methodID] = 92000
case ChannelOpenConfirm:
relayerGasRequiredByMethod[methodID] = 21190
relayerGasRequiredByMethod[methodID] = 91060
case ChannelCloseConfirm:
relayerGasRequiredByMethod[methodID] = 31199
relayerGasRequiredByMethod[methodID] = 101072
case RecvPacket:
relayerGasRequiredByMethod[methodID] = GasWhenReceiverChainIsNotSource
case Acknowledgement:
relayerGasRequiredByMethod[methodID] = 61781
relayerGasRequiredByMethod[methodID] = 131657
case Timeout:
relayerGasRequiredByMethod[methodID] = 104283
relayerGasRequiredByMethod[methodID] = 174147
default:
relayerGasRequiredByMethod[methodID] = 100000
}
Expand Down

0 comments on commit eb54636

Please sign in to comment.