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: estimate gas in evm tx is not accurate in relayer #1209

Merged
merged 33 commits into from
Dec 4, 2023

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Oct 16, 2023

2 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121982 121982 121102 240954 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 187154 187202 232850 808302 3684 77712 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 145980 147124 210661 725784 2116 52828 111955 12865
MsgUpdateClient+MsgChannelOpenTry 205116 205436 243672 863004 2276 55364 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 154534 153894 215421 742036 2116 52852 111574 21190
MsgUpdateClient+MsgRecvPacket 279880 280520 319204 1162056 2340 56520 112195 144025
MsgUpdateClient+MsgAcknowledgement 198245 199145 239767 835580 2346 57912 113004 61781
MsgUpdateClient+MsgTimeout 239988 254678 275726 1000120 2404 57688 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 146785 146729 210972 727314 1508 43172 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 177730 177438 228015 789202 3588 76572 111955 29603
MsgUpdateClient+MsgChannelOpenInit 196218 196215 238190 827356 1540 43924 112114 68701
MsgUpdateClient+MsgChannelOpenAck 155980 155634 216071 745712 2212 54232 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 168046 168046 216458 744582 2468 58784 112167 31199
10 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121982 121982 121112 240874 452 27152   117462
MsgUpdateClient+MsgConnectionOpenTry 205974 206082 262540 866572 5572 107656 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 164734 163580 238007 778506 3876 80868 111955 12865
MsgUpdateClient+MsgChannelOpenTry 223927 224316 272398 938056 4164 85404 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 173314 172774 244561 799180 4004 83144 111574 21190
MsgUpdateClient+MsgRecvPacket 298700 297800 340122 1236492 4068 84120 112195 144025
MsgUpdateClient+MsgAcknowledgement 216635 216745 268230 909276 4196 86024 113004 61781
MsgUpdateClient+MsgTimeout 258496 272918 296054 1071604 4228 86500 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 165142 164969 239474 782328 3332 72476 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 195931 195678 256190 843842 5412 105540 111955 29603
MsgUpdateClient+MsgChannelOpenInit 214408 214455 266427 900076 3364 73036 112114 68701
MsgUpdateClient+MsgChannelOpenAck 173330 173234 242943 800288 3940 81928 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 186027 186286 242684 800532 4292 87704 112167 31199
20 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121982 121982 121102 240954 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 229871 229762 299554 961980 7940 145832 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 188510 188540 276618 853458 6372 120732 111955 12865
MsgUpdateClient+MsgChannelOpenTry 247400 247676 308591 1032320 6500 122708 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 197061 196774 281110 870508 6404 121256 111574 21190
MsgUpdateClient+MsgRecvPacket 320349 322440 363904 1331212 6532 123592 112195 144025
MsgUpdateClient+MsgAcknowledgement 238301 241385 304841 1003636 6660 125412 113004 61781
MsgUpdateClient+MsgTimeout 279976 294358 324590 1170188 6564 124068 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 188513 188329 275839 852438 5668 109624 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 219767 217438 289430 920992 7588 140068 111955 29603
MsgUpdateClient+MsgChannelOpenInit 235315 237495 301709 984328 5668 109348 112114 68701
MsgUpdateClient+MsgChannelOpenAck 197407 197234 280349 869906 6340 120064 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 209003 209006 279942 869286 6564 124412 112167 31199
30 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121982 121982 121112 240954 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 253452 253442 335972 1055832 10308 183372 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 212279 212220 313553 925008 8740 158632 111955 12865
MsgUpdateClient+MsgChannelOpenTry 271796 271996 346362 1129176 8932 161572 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 220790 220454 313484 941590 8772 159000 111574 21190
MsgUpdateClient+MsgRecvPacket 345869 345800 391832 1424732 8868 160704 112195 144025
MsgUpdateClient+MsgAcknowledgement 264195 265065 341900 1099116 9028 163348 113004 61781
MsgUpdateClient+MsgTimeout 305666 320598 364614 1265964 8996 162320 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 211440 211369 311077 920748 7972 146368 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 242658 242398 328588 1012912 10084 180172 111955 29603
MsgUpdateClient+MsgChannelOpenInit 261445 261495 339221 1087528 8068 147844 112114 68701
MsgUpdateClient+MsgChannelOpenAck 221537 221234 317298 941498 8740 158704 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 232706 232686 316679 940104 8932 161836 112167 31199
40 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121982 121982 121102 240954 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 275882 275842 371029 1146384 12548 219248 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 235049 234940 348259 992844 11012 194972 111955 12865
MsgUpdateClient+MsgChannelOpenTry 294156 294396 381518 1219884 11172 197484 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 244040 243494 353604 1018496 11076 196164 111574 21190
MsgUpdateClient+MsgRecvPacket 368889 369160 416098 1517892 11204 198032 112195 144025
MsgUpdateClient+MsgAcknowledgement 286518 287465 376012 1188100 11268 199080 113004 61781
MsgUpdateClient+MsgTimeout 328107 342678 399246 1354832 11204 197756 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 233205 233129 345357 987408 10148 181340 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 264650 264478 362706 1101096 12292 215260 111955 29603
MsgUpdateClient+MsgChannelOpenInit 283125 283575 373361 1176248 10276 183112 112114 68701
MsgUpdateClient+MsgChannelOpenAck 243511 242994 351727 1015312 10916 193256 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 253842 254446 349196 1009932 11108 196400 112167 31199
50 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121942 121982 121112 240874 452 27152   117462
MsgUpdateClient+MsgConnectionOpenTry 299470 299202 407370 1240560 14884 256516 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 258280 258300 384986 1076252 13348 232108 111955 12865
MsgUpdateClient+MsgChannelOpenTry 317494 318076 417625 1312760 13540 235024 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 267211 267174 390362 1111176 13444 233608 111574 21190
MsgUpdateClient+MsgRecvPacket 393197 393480 459912 1614964 13636 236740 112195 144025
MsgUpdateClient+MsgAcknowledgement 311576 311785 415151 1288244 13700 237944 113004 61781
MsgUpdateClient+MsgTimeout 353366 367638 437244 1455896 13700 237584 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 256207 255849 380275 1067804 12420 217908 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 287356 286878 397642 1191660 14532 251304 111955 29603
MsgUpdateClient+MsgChannelOpenInit 306173 306295 408823 1267532 12548 219620 112114 68701
MsgUpdateClient+MsgChannelOpenAck 266264 265714 386983 1107916 13188 229752 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 279041 273966 380416 1090304 13060 227752 112167 31199
60 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121822 121982 121112 240714 452 27152   117462
MsgUpdateClient+MsgConnectionOpenTry 322946 322242 443820 1333648 17188 293536 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 281560 281980 421442 1169068 15716 269852 111955 12865
MsgUpdateClient+MsgChannelOpenTry 341007 341436 454293 1406136 15876 272640 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 290891 290534 426833 1205808 15780 270744 111574 21190
MsgUpdateClient+MsgRecvPacket 416470 417160 496462 1707032 16004 274472 112195 144025
MsgUpdateClient+MsgAcknowledgement 335316 336105 451603 1382476 16132 276388 113004 61781
MsgUpdateClient+MsgTimeout 376281 390998 474387 1549808 16036 274768 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 279084 278889 416170 1158368 14724 254220 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 310125 310238 433544 1283312 16868 288176 111955 29603
MsgUpdateClient+MsgChannelOpenInit 329042 329335 443548 1356988 14852 255992 112114 68701
MsgUpdateClient+MsgChannelOpenAck 289254 289074 421924 1197152 15524 266660 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 302048 302126 426459 1202684 15876 272880 112167 31199
70 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121862 121982 121102 240634 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 345584 344962 489600 1421792 19460 367488 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 304283 305776 467715 1260508 17956 305776 111955 12865
MsgUpdateClient+MsgChannelOpenTry 363720 364156 500767 1497456 18148 306848 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 313444 313254 472569 1296208 18052 310088 111574 21190
MsgUpdateClient+MsgRecvPacket 438957 439240 542824 1798448 18212 347380 112195 144025
MsgUpdateClient+MsgAcknowledgement 358185 359465 498499 1474696 18468 313728 113004 61781
MsgUpdateClient+MsgTimeout 399731 414038 521847 1639580 18340 311716 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 300875 300969 458576 1246648 16932 289548 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 332230 331998 475765 1371864 19044 323040 111955 29603
MsgUpdateClient+MsgChannelOpenInit 350992 351095 486855 1446772 17028 290628 112114 68701
MsgUpdateClient+MsgChannelOpenAck 310654 310514 486855 1286876 17668 301072 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 324208 323886 469281 1309640 18052 307672 112167 31199
80 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121822 121982 121102 240634 452 27164   117462
MsgUpdateClient+MsgConnectionOpenTry 368833 368642 540208 1516944 21828 367488 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 327880 343032 517905 1354176 20292 343032 111955 12865
MsgUpdateClient+MsgChannelOpenTry 387051 387516 550938 1591060 20484 346020 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 336752 344188 523268 1390224 20356 344188 111574 21190
MsgUpdateClient+MsgRecvPacket 462440 462600 592861 1892456 20548 347380 112195 144025
MsgUpdateClient+MsgAcknowledgement 381276 383145 542944 1358640 20836 351916 113004 61781
MsgUpdateClient+MsgTimeout 423901 437398 573785 1737044 20676 349296 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 323938 325828 507753 1337000 19204 325828 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 355106 359596 524538 1462420 21316 359596 111955 29603
MsgUpdateClient+MsgChannelOpenInit 373732 373815 535992 1538376 19300 327448 112114 68701
MsgUpdateClient+MsgChannelOpenAck 333994 338176 514283 1378460 19972 338176 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 354847 346926 518947 1381584 20356 344056 112167 31199
90 validtors cosmos evm adjust current input intrinsic update client 2nd method
MsgCreateClient 121862 121982 121112 240634 452 27152   117462
MsgUpdateClient+MsgConnectionOpenTry 392132 405232 590472 1611456 24196 405232 111894 38468
MsgUpdateClient+MsgConnectionOpenConfirm 351382 380572 567938 1448180 22660 380572 111955 12865
MsgUpdateClient+MsgChannelOpenTry 410670 410876 600963 1685152 22788 383492 112084 70562
MsgUpdateClient+MsgChannelOpenConfirm 360228 381836 573520 1483212 22980 381836 111574 21190
MsgUpdateClient+MsgRecvPacket 485794 486920 643117 1985912 22980 389052 112195 144025
MsgUpdateClient+MsgAcknowledgement 405319 405865 601431 1664600 23108 387980 113004 61781
MsgUpdateClient+MsgTimeout 446150 462678 624113 1829576 23204 389432 126355 104283
MsgUpdateClient+MsgConnectionOpenInit 345668 362300 554698 1425156 21476 362300 111894 19755
MsgUpdateClient+MsgConnectionOpenAck 377892 396208 573774 1560604 23620 396208 111955 29603
MsgUpdateClient+MsgChannelOpenInit 396542 396855 584381 1628624 21604 363952 112114 68701
MsgUpdateClient+MsgChannelOpenAck 356638 374384 562993 1468792 22244 374384 111707 22127
MsgUpdateClient+MsgChannelCloseConfirm 376467 369646 569446 1472944 22628 380444 112167 31199

Summary by CodeRabbit

  • New Features

    • Enhanced gas estimation for EVM transactions to improve accuracy.
    • Upgraded websocket/subscription system for better performance and stability.
    • Introduced new Solidity interface IRelayerFunctions for advanced relayer operations.
  • Improvements

    • Optimized the parallelization process for memiavl restoration.
    • Adjusted gas multiplier settings for more efficient relayer operations.
  • Bug Fixes

    • Fixed an issue with balance change calculations in integration tests.
    • Refined the precision of gas usage comparison in test_ibc_rly_gas.py.
  • Refactor

    • Refactored the relayer precompile system to utilize a new Executor struct for enhanced execution of actions.
    • Streamlined the execution of multiple actions with or without pre-action hooks.
  • Documentation

    • Updated CHANGELOG.md to reflect recent changes and improvements.
  • Chores

    • Updated vendorSha256 for the "rly" package to reflect new vendor source.
    • Added new environment variables for mnemonic phrases to support additional validators and community operations.

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #1209 (ec8bf4b) into main (2c5d3fc) will increase coverage by 19.50%.
The diff coverage is 14.02%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1209       +/-   ##
===========================================
+ Coverage   16.31%   35.82%   +19.50%     
===========================================
  Files          79      116       +37     
  Lines        5816    10638     +4822     
===========================================
+ Hits          949     3811     +2862     
- Misses       4789     6452     +1663     
- Partials       78      375      +297     
Files Coverage Δ
x/cronos/keeper/precompiles/utils.go 0.00% <0.00%> (ø)
x/cronos/keeper/precompiles/relayer.go 31.47% <37.19%> (+14.19%) ⬆️
...s/precompile/relayer/i_relayer_functions.abigen.go 0.00% <0.00%> (ø)

... and 54 files with indirect coverage changes

Comment on lines 51 to 64
for methodName := range irelayerABI.Methods {
var methodID [4]byte
copy(methodID[:], irelayerABI.Methods[methodName].ID[:4])
switch methodName {
case CreateClient:
relayerGasRequiredByMethod[methodID] = 200000
case RecvPacket, Acknowledgement:
relayerGasRequiredByMethod[methodID] = 250000
case UpdateClient, UpgradeClient:
relayerGasRequiredByMethod[methodID] = 400000
default:
relayerGasRequiredByMethod[methodID] = 100000
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m Error

expected exactly 1 statement (either append, delete, or copying to another map) in a range with a map, got 4
Comment on lines 51 to 64
for methodName := range irelayerABI.Methods {
var methodID [4]byte
copy(methodID[:], irelayerABI.Methods[methodName].ID[:4])
switch methodName {
case CreateClient:
relayerGasRequiredByMethod[methodID] = 200000
case RecvPacket, Acknowledgement:
relayerGasRequiredByMethod[methodID] = 250000
case UpdateClient, UpgradeClient:
relayerGasRequiredByMethod[methodID] = 400000
default:
relayerGasRequiredByMethod[methodID] = 100000
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
CHANGELOG.md Outdated Show resolved Hide resolved
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2023

Walkthrough

The recent updates focus on refining the gas estimation and execution processes within the EVM and IBC relayer components. Pull requests have introduced more accurate gas estimation, improved the websocket system, and enhanced the parallelization of data restoration. A new Solidity interface and corresponding Go bindings have been added to streamline relayer operations. Additionally, the test suite has been updated to reflect these changes with more precise assertions and updated configurations.

Changes

File(s) Change Summary
CHANGELOG.md Updated with PRs enhancing gas estimation, websocket performance, and memiavl parallelization.
integration_tests/configs/.../ibc_rly.jsonnet Adjusted gas_multiplier from 1.2 to 1.1.
integration_tests/.../ibc_utils.py, integration_tests/.../test_ibc_rly_gas.py Updated gas usage logging and precision in assertions.
nix/default.nix Updated vendorSha256 for the "rly" package.
scripts/.env Added new environment variables with mnemonic phrases.
scripts/gen-bindings-contracts Added compilation steps for RelayerFunctions.sol.
x/cronos/events/bindings/src/RelayerFunctions.sol Introduced IRelayerFunctions interface with 21 new functions.
x/cronos/keeper/precompiles/... Major refactoring with new irelayerABI variable, Executor struct, and execution functions.

"In the code's woven tapestry, threads of change are spun,
Gas refined, and functions bind, the rabbit's work is done. 🐇
Through the blockchain's burrowed paths, the packets now will flow,
With every hop and every leap, the rabbit's pride will grow."


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

}
return baseCost
// base cost to prevent large input size
baseCost := uint64(inputLen) * authtypes.DefaultTxSizeCostPerByte

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion Error

Potential integer overflow by integer type conversion
@mmsqe mmsqe requested review from calvinaco and devashishdxt and removed request for a team November 27, 2023 10:08
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 9

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 44b58f9 and 1ae9638.
Files ignored due to filter (1)
  • nix/sources.json
Files selected for processing (11)
  • CHANGELOG.md (1 hunks)
  • integration_tests/configs/ibc_rly.jsonnet (1 hunks)
  • integration_tests/ibc_utils.py (2 hunks)
  • integration_tests/test_ibc_rly_gas.py (1 hunks)
  • nix/default.nix (1 hunks)
  • scripts/.env (1 hunks)
  • scripts/gen-bindings-contracts (1 hunks)
  • x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go (1 hunks)
  • x/cronos/events/bindings/src/RelayerFunctions.sol (1 hunks)
  • x/cronos/keeper/precompiles/relayer.go (3 hunks)
  • x/cronos/keeper/precompiles/utils.go (1 hunks)
Files not summarized due to errors (1)
  • x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go: Error: Message exceeds token limit
Files skipped from review due to trivial changes (2)
  • nix/default.nix
  • scripts/.env
Additional comments: 11
CHANGELOG.md (2)
integration_tests/configs/ibc_rly.jsonnet (1)
  • 18-23: The change in the gas_multiplier from 1.2 to 1.1 is noted. Ensure that this change aligns with the intended improvements in gas estimation accuracy and that it has been tested to not adversely affect the relayer's operations.
integration_tests/ibc_utils.py (2)
  • 268-270: The removal of the balance assertion on line 269 should be verified to ensure that the test still correctly validates the IBC transfer's effects on the balance. If this assertion is critical for the test's correctness, its removal might introduce a risk of missing a regression.

  • 665-670: The simplification of the log_gas_records function to append gas usage records only if gas_used is present is a good practice to ensure that only valid gas usage data is recorded.

integration_tests/test_ibc_rly_gas.py (1)
  • 24-31: The change in the diff variable significantly tightens the tolerance for the assertion check. Verify that this new level of precision is supported by the underlying system and that it does not introduce flakiness in the tests due to rounding or minor fluctuations.

The use of int() for division in line 30 may lead to loss of precision. If the intention is to compare floating-point ratios, consider using float division instead. Verify that integer division aligns with the intended precision and functionality of the test.

x/cronos/events/bindings/cosmos/precompile/relayer/i_relayer_functions.abigen.go (1)
  • 1-831: The auto-generated Go bindings for the Ethereum contract appear to be correctly set up and match the Solidity contract's methods. No manual changes should be made to this file, as they will be lost when the code is re-generated.
x/cronos/events/bindings/src/RelayerFunctions.sol (3)
  • 5-35: The functions in IRelayerFunctions all return bytes calldata. Verify that this is intentional and that the consuming code can handle such generic return types. Typically, Solidity functions return bytes memory or more specific types.

  • 23-35: The functions updateClientAnd... return bool while all other functions return bytes calldata. Ensure that this inconsistency is intentional and aligns with the design of the interface and its usage.

  • 5-35: All functions in IRelayerFunctions are marked as external payable. Confirm that it is necessary for all these functions to accept Ether, as making functions payable without need can introduce security risks.

x/cronos/keeper/precompiles/utils.go (1)
  • 107-108: In execMultipleWithHooks, the second action is only executed if err from the first action is nil and len(e.input2) > 0. However, the result of the second action is not used or returned. If the second action is intended to produce a result, this should be handled appropriately.

scripts/gen-bindings-contracts Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Outdated Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Outdated Show resolved Hide resolved
x/cronos/keeper/precompiles/relayer.go Outdated Show resolved Hide resolved
x/cronos/keeper/precompiles/relayer.go Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1ae9638 and 5e91c62.
Files selected for processing (1)
  • integration_tests/test_ibc_rly_gas.py (1 hunks)

integration_tests/test_ibc_rly_gas.py Outdated Show resolved Hide resolved
Signed-off-by: mmsqe <mavis@crypto.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5e91c62 and 42125a9.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 42125a9 and 2dea6f4.
Files selected for processing (3)
  • integration_tests/test_ibc_rly_gas.py (1 hunks)
  • x/cronos/keeper/precompiles/relayer.go (3 hunks)
  • x/cronos/keeper/precompiles/utils.go (1 hunks)
Additional comments: 6
integration_tests/test_ibc_rly_gas.py (2)
  • 24-24: The change in the diff value from 0.5 to 0.004 significantly increases the precision of the gas consumption assertions. Ensure that this level of precision is supported by the underlying gas consumption measurements and that it does not lead to flaky tests due to minor fluctuations in gas usage.

  • 30-30: The explicit casting of e2 and e1 to float before performing division is a good practice to avoid integer division, which can lead to incorrect results in Python 2 or when operands are integers. This change ensures that the division operation results in a floating-point number as expected.

x/cronos/keeper/precompiles/relayer.go (3)
  • 62-129: Initialization of irelayerABI and the mappings in the init function appears to be correct and follows the new dynamic approach using ABI and method names.

  • 184-185: The check for input length in the Run function is a good practice to prevent slice bounds out of range panic.

  • 214-280: The use of a switch case to handle different method executions in the Run function is appropriate and aligns with standard smart contract practices.

x/cronos/keeper/precompiles/utils.go (1)
  • 44-44: The error message "don't support multi-signers message" has been updated as previously suggested to include the number of signers found in the error message.

x/cronos/keeper/precompiles/relayer.go Outdated Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Show resolved Hide resolved
x/cronos/keeper/precompiles/utils.go Show resolved Hide resolved
@mmsqe mmsqe enabled auto-merge December 4, 2023 08:31
@mmsqe mmsqe added this pull request to the merge queue Dec 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Dec 4, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2dea6f4 and ec8bf4b.
Files selected for processing (2)
  • CHANGELOG.md (2 hunks)
  • x/cronos/keeper/precompiles/relayer.go (2 hunks)
Additional comments: 5
CHANGELOG.md (2)
  • 15-18: The changes listed under "State Machine Breaking" align with the PR objectives, specifically addressing the accurate gas estimation in EVM transactions and updates to dependencies that could affect gas estimation logic.

  • 22-23: The improvements listed, such as the refactor of the websocket/subscription system and the parallelization of memiavl restoration, are likely to contribute to the overall system performance enhancements mentioned in the PR objectives.

x/cronos/keeper/precompiles/relayer.go (3)
  • 63-130: Initialization of irelayerABI and the gas requirement maps appears to be correct and aligns with the PR objectives to refine gas estimation.

  • 159-181: The RequiredGas method has been updated to calculate gas based on the method ID and input arguments, and includes a check to prevent integer overflow.

  • 183-285: The Run method has been refactored to handle method execution based on the method ID and input arguments, and includes a length check to prevent slice bounds out of range panic.

var methodID [4]byte
copy(methodID[:], input[:4])
requiredGas, ok := relayerGasRequiredByMethod[methodID]
intrinsicGas, _ := core.IntrinsicGas(input, nil, false, bc.isHomestead, bc.isIstanbul, bc.isShanghai)

Check warning

Code scanning / gosec

Returned error is not propagated up the stack. Warning

Returned error is not propagated up the stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants