-
Notifications
You must be signed in to change notification settings - Fork 241
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: ica packet callback doesn't contain channel detail #1235
Conversation
The existing content is comprehensive and aligns with the provided instructions. Therefore, no modifications are necessary. TipsChat with CodeRabbit Bot (
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1235 +/- ##
===========================================
+ Coverage 16.67% 36.81% +20.13%
===========================================
Files 79 115 +36
Lines 5786 10287 +4501
===========================================
+ Hits 965 3787 +2822
- Misses 4743 6126 +1383
- Partials 78 374 +296
|
There was a problem hiding this 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
Files selected for processing (6)
- CHANGELOG.md (1 hunks)
- integration_tests/contracts/contracts/TestICA.sol (2 hunks)
- integration_tests/test_ica_precompile.py (6 hunks)
- x/cronos/events/bindings/cosmos/precompile/icacallback/i_ica_callback.abigen.go (2 hunks)
- x/cronos/events/bindings/src/ICACallback.sol (1 hunks)
- x/cronos/keeper/keeper.go (1 hunks)
Additional comments: 14
x/cronos/keeper/keeper.go (1)
- 292-298: The
onPacketResult
function has been updated to includepacket.SourceChannel
as a parameter in theOnPacketResultCallback
function call. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.CHANGELOG.md (1)
- 16-16: The change log entry is clear and links to the relevant pull request. Ensure that the pull request contains all the necessary information for future reference.
x/cronos/events/bindings/src/ICACallback.sol (1)
- 2-6: The change in the function signature of
onPacketResultCallback
is correctly reflected. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.integration_tests/contracts/contracts/TestICA.sol (3)
15-19: The change from a single mapping to a nested mapping allows tracking of packet status across multiple channels. This is a significant change and should be tested thoroughly to ensure it works as expected.
105-107: The
getStatus
function is a new addition that retrieves the status of a packet based on its source channel and sequence number. Ensure that it is being used correctly in the rest of the codebase.109-118: The
onPacketResultCallback
function now includespacketSrcChannel
as a parameter and updates the status accordingly. This is a significant change and should be tested thoroughly to ensure it works as expected.integration_tests/test_ica_precompile.py (4)
170-178: The
wait_for_status_change
function now accepts a new parameterchannel_id
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.198-210: The
register_acc
function call now includeschannel_id
as a parameter. Ensure that the function definition has been updated to accept this new parameter.316-317: The
wait_for_status_change
function calls now includechannel_id
as a parameter. This is consistent with the updated function definition.271-272: The
submit_msgs_ro
function calls have been updated to include thechannel_id
parameter. Ensure that the function definition has been updated to accept this new parameter.x/cronos/events/bindings/cosmos/precompile/icacallback/i_ica_callback.abigen.go (4)
30-34: The ABI for the
onPacketResultCallback
function has been updated to include thepacketSrcChannel
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.182-187: The
OnPacketResultCallback
function in theICACallbackTransactor
struct has been updated to include thepacketSrcChannel
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.189-194: The
OnPacketResultCallback
function in theICACallbackSession
struct has been updated to include thepacketSrcChannel
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.196-201: The
OnPacketResultCallback
function in theICACallbackTransactorSession
struct has been updated to include thepacketSrcChannel
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.
There was a problem hiding this 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
Files selected for processing (2)
- integration_tests/contracts/contracts/TestICA.sol (2 hunks)
- integration_tests/test_ica_precompile.py (6 hunks)
Additional comments: 8
integration_tests/contracts/contracts/TestICA.sol (5)
15-17: The
Status
enum has been defined correctly and is being used appropriately in the code.18-18: The
statusMap
has been updated to use a nested mapping with a string key. This allows for tracking the status of packets across multiple channels.19-19: The
OnPacketResult
event now includes a string parameter for packet source channel. This allows for better tracking of packet statuses across multiple channels.105-107: The
getStatus
function has been added to retrieve the status based on the packet source channel and sequence number. This function is correctly implemented and should work as expected.109-119: The
onPacketResultCallback
function has been updated to includepacketSrcChannel
as a parameter and update the status accordingly. This function is correctly implemented and should work as expected.integration_tests/test_ica_precompile.py (3)
171-179: The
wait_for_status_change
function now includes achannel_id
parameter. This change seems to be related to incorporating channel-specific information into the function for handling status changes.182-185: The
assert_packet_result
function's signature has been updated to include thechannel_id
parameter. This change seems to be related to incorporating channel-specific information into the function for handling packet results.198-210: The
channel_id
is now passed to theregister_acc
function. This change seems to be related to incorporating channel-specific information into the function for registering accounts.
There was a problem hiding this 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
Files selected for processing (1)
- integration_tests/test_ica_precompile.py (6 hunks)
Additional comments: 7
integration_tests/test_ica_precompile.py (7)
171-179: The
wait_for_status_change
function now accepts achannel_id
parameter and uses it to check the status. This change is likely to support multiple channels.182-186: The
assert_packet_result
function now accepts achannel_id
parameter and includes it in the expected result. This change is likely to support assertions for multiple channels.199-211: The
channel_id
parameter is now included in theregister_acc
function call within thetest_sc_call
function. This change is likely to support testing for multiple channels.254-260: The
channel_id
parameter is now included in thewait_for_status_change
,getStatus
, andassert_packet_result
function calls within thetest_sc_call
function. These changes are likely to support testing for multiple channels.274-281: The
channel_id
parameter is now included in thewait_for_status_change
,getStatus
, andassert_packet_result
function calls within thetest_sc_call
function. These changes are likely to support testing for multiple channels.296-303: The
channel_id
parameter is now included in thewait_for_status_change
,getStatus
, andassert_packet_result
function calls within thetest_sc_call
function. These changes are likely to support testing for multiple channels.317-323: The
channel_id
parameter is now included in thewait_for_status_change
,getStatus
, andassert_packet_result
function calls within thetest_sc_call
function. These changes are likely to support testing for multiple channels.
There was a problem hiding this 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
Files selected for processing (1)
- integration_tests/test_ica_precompile.py (6 hunks)
Additional comments: 8
integration_tests/test_ica_precompile.py (8)
172-180: The
wait_for_status_change
function has been updated to include achannel_id
parameter, which is used to check the status of a packet based on the channel. This is a necessary change to accommodate the new functionality of tracking packets across multiple channels.183-188: The
wait_for_packet_log
function has also been updated to include achannel_id
parameter. This change ensures that the function waits for a packet log that matches both the sequence number and the channel, aligning with the new event structure.260-266: The
wait_for_status_change
andwait_for_packet_log
functions are called with thechannel_id
parameter, reflecting the changes made to their definitions. This is consistent with the pull request's goal to include channel information in the packet callback functionality.281-287: Similar to the previous hunk, the
wait_for_status_change
andwait_for_packet_log
functions are called with thechannel_id
parameter. The assertions check that the sequence number and status are as expected, which is crucial for the integrity of the packet handling logic.303-308: Again, the
wait_for_status_change
andwait_for_packet_log
functions are used correctly with thechannel_id
parameter. The assertion that the status isStatus.FAIL
indicates that the test is checking for a failure condition, which is an important part of testing the robustness of the system.326-332: The
wait_for_status_change
,wait_for_packet_log
, andwait_for_check_channel_ready
functions are called with thechannel_id
parameter. The assertion that the status isStatus.FAIL
and the check for the channel state being closed are important validations for the test.334-345: A new
channel_id2
variable is introduced and used in thesubmit_msgs
function call. This is consistent with the pull request's description, which mentions the introduction of a new variable to handle multiple channels. The assertions ensure that the new channel ID is different from the previous one and that the ICA address remains the same, which is a logical expectation for the test scenario.359-364: The
wait_for_packet_log
function is called withchannel_id2
, which is the new channel variable introduced earlier. This ensures that the test is waiting for the packet log on the correct channel. The balance assertion checks that the funds have been correctly processed, which is a key part of the test.
There was a problem hiding this 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
Files selected for processing (1)
- integration_tests/test_ica_precompile.py (6 hunks)
Additional comments: 6
integration_tests/test_ica_precompile.py (6)
172-179: The
wait_for_status_change
function now requires achannel_id
parameter to check the status for a specific channel. This is a logical change given the context of IBC where multiple channels can exist. Ensure that all calls to this function have been updated to pass thechannel_id
parameter.182-187: The
wait_for_packet_log
function has been updated to include achannel_id
parameter, which is used to filter the logs for a specific channel. This change is consistent with the need to handle multiple channels in IBC. However, the actual filtering logic based onchannel_id
is not visible in the provided hunk. Ensure that the implementation ofcheck_log
withinwait_for_packet_log
correctly filters logs based on thechannel_id
.256-265: The
submit_msgs_ro
function is called with astr
parameter, which is expected to be the packet data. Thewait_for_status_change
andwait_for_packet_log
functions are then used to wait for the status change and packet log, respectively. The balance is checked after these operations to ensure it matches the expected balance. This hunk shows the correct usage of the newchannel_id
parameter in thewait_for_status_change
andwait_for_packet_log
functions.277-286: Similar to the previous hunk, this hunk also demonstrates the correct usage of the
channel_id
parameter in thewait_for_status_change
andwait_for_packet_log
functions. The assertions check that the sequence and status are as expected, and the balance is verified.299-307: This hunk handles the case where a transaction fails. The
wait_for_status_change
andwait_for_packet_log
functions are used to wait for the status change and packet log, respectively, and the balance is checked to ensure it has not changed due to the failed transaction. This is the correct behavior as the balance should remain the same if the transaction fails.322-345: This hunk shows the handling of a timeout scenario and the registration of a new channel with
channel_id2
. It is important to ensure that theget_next_channel
function correctly retrieves a new channel ID and that theregister_acc
function behaves as expected with the new channel. The assertions check that the new channel ID is different from the previous one and that the ICA address remains the same, which may or may not be the intended behavior depending on the system's design. Verify that the ICA address should indeed be the same for different channels.
There was a problem hiding this 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
Files selected for processing (1)
- integration_tests/test_ica_precompile.py (7 hunks)
Additional comments: 8
integration_tests/test_ica_precompile.py (8)
173-180: The
wait_for_status_change
function now accepts achannel_id
parameter, which is used to check the status for a specific channel. This is a good update for handling multiple channels. However, ensure that all calls to this function have been updated to pass the newchannel_id
parameter.183-193: The
wait_for_packet_log
function has been updated to include thechannel_id
parameter. Thekeccak
function is used to hash thechannel_id
before comparing it with the expected log. This change is consistent with the need to handle channel-specific logs. Ensure that the hashing ofchannel_id
is the expected behavior and that all consumers of this function are aware of this change.---end hunk 1---
---start hunk 2---
- 266-272: The
wait_for_status_change
andwait_for_packet_log
functions are called with thechannel_id
andlast_seq
to wait for the status change and packet log, respectively. The assertions check if the status isStatus.SUCCESS
and if the balance after the transaction matches the expected balance. This hunk shows the correct usage of the updated functions with the newchannel_id
parameter.---end hunk 2---
---start hunk 3---
- 289-293: Similar to the previous hunk, this code block is using the updated functions with the
channel_id
parameter correctly. The assertions ensure the status and balance are as expected.---end hunk 3---
---start hunk 4---
- 312-314: The
wait_for_status_change
andwait_for_packet_log
functions are used to check for aStatus.FAIL
after submitting messages that are expected to fail. The balance check ensures that the balance remains unchanged, which is the expected behavior in case of failure. This hunk is consistent with the intended functionality.---end hunk 4---
---start hunk 5---
335-337: The code waits for a
Status.FAIL
due to a timeout and checks that the balance remains unchanged. This is consistent with the expected behavior when a timeout occurs.338-351: The
wait_for_check_channel_ready
function is called with a newchannel_id2
, which is obtained by callingget_next_channel
. Theregister_acc
function is then called withchannel_id2
, and assertions are made to ensure thatchannel_id2
is different from the originalchannel_id
and that theica_address2
is the same as the originalica_address
. This suggests that the same ICA account is expected to be used across different channels. Ensure that this is the intended behavior and that theregister_acc
function is designed to handle this scenario.---end hunk 5---
---start hunk 6---
- 363-370: The
wait_for_status_change
andwait_for_packet_log
functions are called withchannel_id2
, which is the new channel ID introduced in the previous hunk. The assertions check forStatus.SUCCESS
and the expected balance, indicating that the functions are being used correctly with the new channel ID.---end hunk 6---
There was a problem hiding this 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: 2
Configuration used: CodeRabbit UI
Files selected for processing (8)
- app/app.go (2 hunks)
- integration_tests/test_ica_precompile.py (11 hunks)
- x/cronos/events/bindings/cosmos/precompile/ica/i_ica_module.abigen.go (3 hunks)
- x/cronos/events/bindings/src/ICA.sol (1 hunks)
- x/cronos/events/events.go (1 hunks)
- x/cronos/keeper/precompiles/ica.go (3 hunks)
- x/cronos/types/interfaces.go (1 hunks)
- x/icaauth/keeper/keeper.go (5 hunks)
Files skipped from review due to trivial changes (1)
- x/cronos/events/bindings/src/ICA.sol
Additional comments: 28
x/cronos/types/interfaces.go (1)
- 87-91: The
SubmitTxWithArgs
method signature has been updated to return an additional string value. Ensure that all implementations of theIcaauthkeeper
interface and calls toSubmitTxWithArgs
are updated to handle the new return value. This change may have implications on error handling and result processing logic in the code that uses this interface.x/cronos/events/events.go (1)
- 35-40: The addition of
channeltypes.AttributeKeySrcChannel
toIcaValueDecoders
map is consistent with the pull request's goal to track channel-specific packet status. This change will allow the system to decode the source channel attribute from ICA packets.x/cronos/keeper/precompiles/ica.go (3)
11-17: The import section has been updated to include the
channeltypes
package, which is used for handling IBC channel-related information. This change is consistent with the pull request's goal of enhancing ICA packet handling by incorporating channel details.182-188: The
SubmitTxWithArgs
function call has been modified to return an additional value,activeChannelID
. This change should be verified across the codebase to ensure that all calls to this function handle the new return value correctly.194-200: The event emitted now includes a new attribute for the source channel (
channeltypes.AttributeKeySrcChannel
). This is a key change that aligns with the pull request's objective to include channel information in packet status tracking. Ensure that the event consumers are updated to handle this new attribute.app/app.go (2)
- 637-643: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [637-651]
The changes to the
App
struct initialization include the addition ofscopedICAControllerKeeper
to theICAAuthKeeper
and the use ofWithICS4Wrapper
method withicaControllerStack
. These changes are critical for the correct initialization of theicaauthkeeper
module with the new channel information. Ensure that theicaControllerStack
is correctly initialized and that theWithICS4Wrapper
method is called with the appropriate arguments. Also, verify that theicaControllerStack
is being used correctly in the IBC router setup.
- 646-651: The middleware stack for the ICA controller is being set up with the
ibcfee
middleware and theibccallbacks
middleware. It is important to ensure that the middleware stack is correctly configured and that the order of middleware is appropriate for the desired behavior. The use ofmath.MaxUint64
as the gas limit for theibccallbacks
middleware should be reviewed to ensure it aligns with the intended gas usage policies.x/cronos/events/bindings/cosmos/precompile/ica/i_ica_module.abigen.go (4)
31-34: The ABI string has been updated to reflect the new event signature with the
packetSrcChannel
parameter. This change should be verified to ensure that it matches the actual smart contract ABI after the contract has been deployed or updated.330-343: The
FilterSubmitMsgsResult
function has been updated to filter logs based on thepacketSrcChannel
. Ensure that the providedpacketSrcChannel
slice is correctly handled and that the filtering works as expected with the updated event signature.346-359: The
WatchSubmitMsgsResult
function has been updated similarly toFilterSubmitMsgsResult
. It should be verified that the subscription to the event logs works correctly with the newpacketSrcChannel
parameter.388-393: The
ParseSubmitMsgsResult
function has been updated to parse logs for theSubmitMsgsResult
event. It is important to verify that the log parsing correctly handles the newpacketSrcChannel
parameter and that the function behaves as expected when invoked.x/icaauth/keeper/keeper.go (5)
28-34: The addition of
ics4Wrapper
andcontrollerScopedKeeper
fields to theKeeper
struct is consistent with the need to handle channel information. Ensure that all necessary nil checks and initializations for these new fields are in place wherever theKeeper
struct is used.56-58: The
WithICS4Wrapper
method is a good use of the builder pattern, allowing for theics4Wrapper
to be set post-construction of theKeeper
object. This can be useful for dependency injection and testing.73-125: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [60-77]
The
SubmitTx
method has been updated to return a response and an error, which is a good practice for error handling. Ensure that all callers of this method handle the returned error appropriately.
80-104: The
sendTx
method includes comprehensive error handling and returns detailed errors, which is good for debugging and error tracking. However, ensure that the error messages do not expose sensitive information that could be a security risk.106-125: The
SubmitTxWithArgs
method now returns an additional string representing the active channel ID, which is necessary for the new channel-specific packet status tracking. Ensure that all callers of this method are updated to handle the new return value.General note:
Ensure that the new error handling and return values do not introduce any breaking changes to existing functionality and that all dependent modules are updated accordingly.integration_tests/test_ica_precompile.py (12)
3-9: The import of
keccak
frometh_utils
is correctly placed according to PEP 8 import order standards, which recommend standard library imports first, followed by third-party imports, and then local application/library specific imports.80-84: The
channel_id
parameter has been correctly added to thesubmit_msgs
function signature to accommodate the new requirement for channel-specific packet status tracking. However, ensure that all calls to this function are updated to pass thechannel_id
argument.120-131: The use of
keccak
to hash thechannel_id
is appropriate if the intention is to have a fixed-length, unique identifier for the channel in the logs. However, ensure that theexpected_seq
is being correctly set and used in the context where this function is called. Also, verify that theevent.getLogs()
method is compatible with the expected structure of the logs after the addition of thepacketSrcChannel
parameter.140-152: The
register_acc
function has been updated to accept thechannel_id
parameter. This is consistent with the pull request's goal to include channel information in the ICA packet handling. Ensure that thechannel_id
is being correctly retrieved and passed to this function in all relevant parts of the code.160-166: The
submit_msgs
function is called with the newchannel_id
parameter, which is correctly passed to the function. This change is necessary for the function to work with the updated logic that includes channel information.173-179: Again, the
submit_msgs
function is called with thechannel_id
parameter. It's important to ensure that theexpected_seq
is managed correctly across different calls to maintain the integrity of the sequence tracking.182-202: The new
wait_for_status_change
andwait_for_packet_log
functions are introduced to wait for a status change and packet log, respectively, with thechannel_id
parameter included. This is a necessary addition to handle the channel-specific packet status tracking. Ensure that thetcontract.caller.getStatus
andevent.getLogs()
methods are correctly implemented to handle thechannel_id
parameter.268-282: The
submit_msgs_ro
function is called with thechannel_id
parameter, which is correctly passed to the function. This change is necessary for the function to work with the updated logic that includes channel information.290-304: The
submit_msgs_ro
function is called again with thechannel_id
parameter. Ensure that theexpected_seq
is managed correctly across different calls to maintain the integrity of the sequence tracking.315-326: The
submit_msgs
function is called with a largeamount
parameter, which seems to be intended to test the failure case. Ensure that theStatus.FAIL
is the expected status when theamount
exceeds a certain threshold and that this behavior is documented and tested.339-365: The
submit_msgs
function is called with atimeout
parameter to test the timeout case. Ensure that theStatus.FAIL
is the expected status when a timeout occurs and that this behavior is documented and tested. Also, verify that thewait_for_check_channel_ready
function correctly handles thechannel_id
parameter and that theSTATE_CLOSED
state is the expected state after a timeout.371-384: The
submit_msgs
function is called with a newchannel_id2
parameter, which is correctly passed to the function. This change is necessary for the function to work with the updated logic that includes channel information. Ensure that thechannel_id2
is being correctly retrieved and passed to this function in all relevant parts of the code.
There was a problem hiding this 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: 3
Configuration used: CodeRabbit UI
Files selected for processing (8)
- app/app.go (2 hunks)
- integration_tests/test_ica_precompile.py (11 hunks)
- x/cronos/events/bindings/cosmos/precompile/ica/i_ica_module.abigen.go (3 hunks)
- x/cronos/events/bindings/src/ICA.sol (1 hunks)
- x/cronos/events/events.go (1 hunks)
- x/cronos/keeper/precompiles/ica.go (3 hunks)
- x/cronos/types/interfaces.go (1 hunks)
- x/icaauth/keeper/keeper.go (5 hunks)
Additional comments: 28
x/cronos/events/bindings/cosmos/precompile/ica/i_ica_module.abigen.go (1)
- 31-34: The ABI string for the
SubmitMsgsResult
event has been updated to include thepacketSrcChannel
parameter. Ensure that all dependent systems and integrations are updated to handle the new event structure.x/cronos/events/bindings/src/ICA.sol (1)
- 2-8: The addition of
packetSrcChannel
to theSubmitMsgsResult
event is a significant change that will affect any off-chain services or contracts that listen to this event. Ensure that all listeners are updated to handle the new indexed parameter.x/cronos/events/events.go (1)
- 35-40: The addition of
channeltypes.AttributeKeySrcChannel
toIcaValueDecoders
aligns with the pull request's goal to include channel information in the ICA packet callback. This change ensures that the source channel attribute is correctly decoded when ICA events are processed.x/cronos/keeper/precompiles/ica.go (3)
11-17: The import section has been updated to include the
channeltypes
package, which is necessary for the new functionality related to channel information in IBC packets.182-188: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [182-200]
The
Run
function within theIcaContract
type has been updated to handle theSubmitMsgsMethodName
case. It now captures theactiveChannelID
from theSubmitTxWithArgs
function call and emits it as part of an event. This change is crucial for tracking the channel information of IBC packets and aligns with the pull request's goal to include channel detail in the ICA packet callback.However, ensure that the
activeChannelID
is being correctly retrieved and that theSubmitTxWithArgs
function is updated accordingly to return this new piece of information.
- 194-200: The event emission has been modified to include the
channeltypes.AttributeKeySrcChannel
attribute with theactiveChannelID
. This is a necessary change for the event to carry the new channel information. Ensure that all event consumers are updated to handle this new attribute.app/app.go (3)
- 637-643: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [637-651]
The
WithICS4Wrapper
method is now being used to set theics4Wrapper
for bothICAControllerKeeper
andICAAuthKeeper
. This is a significant change as it affects the middleware stack for IBC transactions. Ensure that the middleware stack is correctly configured and that theics4Wrapper
is properly integrated into the IBC transaction flow.
646-651: The
WithICS4Wrapper
method is being called with a type assertion toporttypes.Middleware
. Ensure that theicaControllerStack
is guaranteed to implementporttypes.Middleware
to prevent potential runtime panics due to failed type assertions.651-651: The
math.MaxUint64
is being used to indicate no gas limit for theibccallbacks.NewIBCMiddleware
. This could potentially allow transactions to consume an unlimited amount of gas, which may not be desirable. Verify that this is the intended behavior and consider implementing a reasonable gas limit if necessary.x/icaauth/keeper/keeper.go (7)
14-22: The addition of
clienttypes
andporttypes
packages indicates new dependencies for theKeeper
struct. Ensure that these new dependencies are properly managed and do not introduce any circular dependencies.28-34: The introduction of
ics4Wrapper
andcontrollerScopedKeeper
fields to theKeeper
struct suggests an expansion of theKeeper
's responsibilities. Verify that these fields are being used appropriately and that their lifecycle is managed correctly.41-53: The
NewKeeper
function's signature has been modified to include thecontrollerScopedKeeper
parameter. Ensure that all instantiations ofKeeper
throughout the codebase are updated to provide this new argument.56-58: The
WithICS4Wrapper
method has been added to set theics4Wrapper
field on theKeeper
struct. This method should be called before theKeeper
is used if theics4Wrapper
is required for its operations.73-141: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [60-94]
The
SubmitTx
method has been updated to include theportID
parameter and use theics4Wrapper
field. Ensure that theportID
is being validated before use and that error handling is robust, especially since this method interacts with external systems (IBC packets).
96-120: The new
sendTx
method handles the sending of transactions. It's important to ensure that the error handling is comprehensive, given that this method interacts with IBC and capabilities which can fail in various ways.122-141: The
SubmitTxWithArgs
method now returns an additional string representing the active channel ID. Ensure that the return value is being handled correctly wherever this method is called.General:
The changes made across the file are significant and touch on several core functionalities of theKeeper
. It's crucial to ensure that these changes are accompanied by thorough testing, especially integration tests that can simulate real-world usage of the IBC and capability features.integration_tests/test_ica_precompile.py (12)
6-6: The import of
keccak
frometh_utils
is correct and relevant for the cryptographic operations being performed in the code.80-84: The
channel_id
parameter has been added to thesubmit_msgs
function signature to accommodate the new requirement for channel information. This is consistent with the pull request summary.120-130: The use of
keccak
to hash thechannel_id
when asserting the log arguments is correct and ensures that the channel ID is being processed in a consistent manner throughout the system. However, ensure that thechannel_id
is in the correct format before hashing, askeccak
expects a string input.140-152: The
register_acc
function has been updated to include thechannel_id
parameter, which is used in the registration process. This change is in line with the pull request summary.160-166: The
submit_msgs
function call now includes thechannel_id
parameter, which is passed to the function correctly.173-179: Again, the
submit_msgs
function call includes thechannel_id
parameter, indicating that the changes are consistently applied across the test cases.182-202: The new
wait_for_status_change
andwait_for_packet_log
functions are designed to wait for a status change and packet log based on thechannel_id
and sequence number. This is a necessary addition to handle the new channel-based packet tracking.268-282: The
submit_msgs_ro
function is correctly called with thechannel_id
parameter, and the subsequent logic checks for the expected sequence and status, which is consistent with the changes described in the pull request summary.290-304: The
submit_msgs_ro
function is called again with thechannel_id
parameter, and the logic is consistent with the previous test case.315-326: The test case here is checking for a failure condition, and the
channel_id
parameter is used as expected. The balance check at the end ensures that the balance remains unchanged in case of failure, which is the correct behavior.339-365: The
submit_msgs
function is called with a timeout and a larger number of messages, and thechannel_id
parameter is used as expected. The subsequent checks for the last sequence and status are consistent with the other test cases.371-384: The
submit_msgs
function is called with a differentchannel_id2
, and the test case ensures that the new channel ID is different from the previous one and that the status change and packet log are handled correctly.
} | ||
minTimeoutDuration := k.MinTimeoutDuration(ctx) | ||
// timeoutDuration should be constraited by MinTimeoutDuration parameter. | ||
timeoutTimestamp := ctx.BlockTime().Add( | ||
types.MsgSubmitTx{ | ||
TimeoutDuration: &timeoutDuration, | ||
}.CalculateTimeoutDuration(minTimeoutDuration)).UnixNano() | ||
res, err := k.icaControllerKeeper.SendTx(ctx, nil, connectionId, portID, packetData, uint64(timeoutTimestamp)) //nolint:staticcheck | ||
activeChannelID, res, err := k.sendTx(ctx, connectionId, portID, packetData, uint64(timeoutTimestamp)) |
Check failure
Code scanning / gosec
Potential integer overflow by integer type conversion Error
return "", 0, errorsmod.Wrapf(capabilitytypes.ErrCapabilityNotFound, "failed to find capability: %s", host.ChannelCapabilityPath(portID, activeChannelID)) | ||
} | ||
|
||
if uint64(ctx.BlockTime().UnixNano()) >= timeoutTimestamp { |
Check failure
Code scanning / gosec
Potential integer overflow by integer type conversion Error
There was a problem hiding this 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: 3
Configuration used: CodeRabbit UI
Files selected for processing (4)
- CHANGELOG.md (1 hunks)
- app/app.go (1 hunks)
- x/icaauth/keeper/keeper.go (5 hunks)
- x/icaauth/module.go (2 hunks)
Additional comments: 8
CHANGELOG.md (1)
- 13-17: The changelog correctly documents the state machine breaking changes for the pull requests Problem: require gas in relayer precompile is higher than consumed #1232 and Problem: ica packet callback doesn't contain channel detail #1235. It is important to ensure that these changes are communicated clearly to developers and users since they may require actions like updating client code or performing network upgrades.
x/icaauth/module.go (2)
11-17: The import statement for
porttypes
has been added correctly. Ensure that the package is used elsewhere in the codebase to justify the import.105-113: The
NewAppModule
function now takes an additionalics4Wrapper
parameter of typeporttypes.ICS4Wrapper
. This change requires that all instantiations ofAppModule
throughout the codebase be updated to provide this new argument. Additionally, thekeeper.WithICS4Wrapper(ics4Wrapper)
method call is made before theAppModule
struct is returned, which is a good practice to ensure that the keeper is properly configured before use.x/icaauth/keeper/keeper.go (3)
56-58: The
WithICS4Wrapper
method is a good example of the builder pattern, allowing for the optional setting of theics4Wrapper
. This is a common pattern in Go for configuring objects after instantiation.80-104: The
sendTx
function correctly checks for the existence of an active channel and the capability before sending a packet. It also validates the timeout timestamp and packet data, which are good practices for error handling and data validation.106-125: The
SubmitTxWithArgs
function now returns an additional string representing the active channel ID. Ensure that all callers of this function are updated to handle the new return value.app/app.go (2)
637-653: The staking hooks are being set up, and the
ICAAuthKeeper
andICAControllerKeeper
are being configured with an ICS4 wrapper. This is part of the middleware stack for IBC (Inter-Blockchain Communication) which is crucial for the correct functioning of the IBC modules. It's important to ensure that the middleware stack is correctly configured and that the order of middleware is appropriate for the application's requirements.640-652: The
ICAAuthKeeper
is being initialized with thescopedICAAuthKeeper
andscopedICAControllerKeeper
. TheicaControllerStack
is being wrapped with theibcfee
middleware and theics4Wrapper
is being set for both theICAAuthKeeper
andICAControllerKeeper
. This is a critical part of the IBC middleware setup and should be reviewed carefully to ensure that the middleware is correctly applied and that theics4Wrapper
is correctly implemented.The code is complex and touches on many aspects of the Cosmos SDK and IBC module. It's important to ensure that the changes are thoroughly tested, especially since they involve critical functionality like IBC which is used for communication between different blockchain networks. Additionally, the changes should be reviewed for security, performance, and correctness by someone with expertise in Cosmos SDK and IBC development.
There was a problem hiding this 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
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
- 13-17: The changelog entries for pull requests Problem: require gas in relayer precompile is higher than consumed #1232 and Problem: ica packet callback doesn't contain channel detail #1235 correctly reflect the changes made to the system. It's important to ensure that the descriptions are accurate and provide enough context for users to understand the impact of the changes. If these pull requests introduce breaking changes, it would be beneficial to highlight this in the changelog for users to take necessary precautions when updating.
There was a problem hiding this 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
Files selected for processing (1)
- integration_tests/test_ica_precompile.py (12 hunks)
Additional comments: 10
integration_tests/test_ica_precompile.py (10)
120-130: The logic here is checking for the presence of logs and then asserting that the first log matches the expected
packetSrcChannel
andseq
. However, there is a potential issue with the use ofkeccak(text=channel_id)
; ifchannel_id
is an empty string (which is the default value from the previous hunk), this will always hash to the same value, which might not be the intended behavior. Ensure thatchannel_id
is always a meaningful string when calling this function.140-152: The
register_acc
function is updated to includechannel_id
as a parameter, which is good for supporting multiple channels. However, ensure that all calls to this function have been updated accordingly to pass the newchannel_id
parameter.160-166: The
submit_msgs
function is called with thechannel_id
parameter, which is correctly passed down to handle multiple channels. This is a good update for supporting multi-channel functionality.182-203: The
wait_for_status_change
andwait_for_packet_log
functions have been updated to include thechannel_id
parameter. This is necessary for the functions to work with the updatedsubmit_msgs
function and to support multiple channels. Ensure that all calls to these functions are updated to include the newchannel_id
parameter.260-265: The
submit_msgs_ro
function is introduced, which seems to be a read-only version ofsubmit_msgs
. However, the function is not defined in the provided code. Ensure that this function is defined elsewhere in the codebase and that it behaves as expected for read-only operations.270-284: The
submit_msgs_ro
function is called twice with differentfunc
parameters. This is likely intended to test different read-only submission methods. Ensure that thefunc
parameters passed here are intended to be read-only and that thesubmit_msgs_ro
function is defined and behaves correctly.293-307: The
submit_msgs
function is called again with different parameters, and thesubmit_msgs_ro
function is called twice more. This pattern is consistent with the previous hunk, suggesting that these calls are part of a test sequence. Ensure that the test sequence is complete and covers all necessary cases.319-330: The
submit_msgs
function is called with a very largeamount
parameter, which seems to be intended to test the failure case. This is a good test to ensure that the system behaves correctly when transactions fail due to insufficient funds.344-370: The
submit_msgs
function is called with atimeout
parameter to test the timeout behavior. This is another good test case. However, ensure that thetimeout
value is appropriate for the test environment and that thewait_for_status_change
andwait_for_packet_log
functions are capable of handling the timeout case correctly.377-390: The
submit_msgs
function is called with a newchannel_id2
, which seems to be testing the behavior of the system with a different channel. This is a good test to ensure that the system can handle multiple channels correctly. Ensure thatchannel_id2
is correctly initialized and different fromchannel_id
to properly test multi-channel functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
New Features
Style