-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Law-stone] Remove instantiate context state and use reply payload #607
Conversation
WalkthroughThe changes streamline the smart contract's handling of instantiation and reply processes in Rust. The removal of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Contract
participant Storage
User->>Contract: Instantiate Contract
Contract->>Storage: Store Address
Contract-->>User: Send Submessage
User->>Contract: Reply with Payload
Contract->>Storage: Process Payload
Contract-->>User: Response
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
size-limit report 📦
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- contracts/axone-law-stone/src/contract.rs (13 hunks)
- contracts/axone-law-stone/src/state.rs (1 hunks)
Additional comments not posted (6)
contracts/axone-law-stone/src/state.rs (1)
Line range hint
1-14
:
Removal ofINSTANTIATE_CONTEXT
constant.The constant
INSTANTIATE_CONTEXT
has been removed, indicating a shift in how instantiation context is managed. Ensure that this aligns with the new payload mechanism introduced in CosmWasm 2.x.x.contracts/axone-law-stone/src/contract.rs (5)
46-49
: Streamlined instantiation process.The
instantiate
function now directly adds a submessage with the storage address as a payload, enhancing clarity and reducing state management overhead. Ensure that the payload handling is correct and aligns with the new payload mechanism.
222-232
: Improved reply handling and error management.The
reply
function now handles the conversion of the payload from the submessage into a string address with added error handling. This improves robustness and simplifies the reply logic by removingINSTANTIATE_CONTEXT
.
360-368
: Updated tests for new instantiation logic.The tests have been updated to check for the correct payload in submessages and verify that
INSTANTIATE_CONTEXT
is no longer used. These updates ensure robustness and correctness in the new logic.
698-700
: Updated tests for reply handling.The tests now include checks for the correct handling of the payload in the reply function, ensuring robustness and correctness in the new logic.
Line range hint
786-826
:
New test cases for error handling.New test cases have been added to validate error handling for invalid UTF-8 sequences in the reply function. These tests ensure that the function correctly handles conversion failures.
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
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 👍
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.
Perfect thx :)
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.
Nice
On the
law-stone
contract, replace current instantiation context state by the newpayload
on Reply sub message introduced in cosmwasm v2.0.0, following @amimart suggestionSummary by CodeRabbit
New Features
Bug Fixes
Tests