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

Feat/law stone program code #395

Merged
merged 3 commits into from
Oct 17, 2023
Merged

Feat/law stone program code #395

merged 3 commits into from
Oct 17, 2023

Conversation

ccamel
Copy link
Member

@ccamel ccamel commented Oct 16, 2023

Implement #389.

Summary by CodeRabbit

  • New Feature: Added a new functionality to retrieve the code of a law program stored within the contract's storage. This feature enhances the transparency of the system by allowing users to view the underlying code of the program.
  • Documentation: Updated the documentation to reflect the new changes in the QueryMsg enum and the introduction of the Binary struct. This will help users understand the new features and how to use them effectively.

@ccamel ccamel self-assigned this Oct 16, 2023
@bot-anik
Copy link
Member

bot-anik commented Oct 16, 2023

size-limit report 📦

Path Size
target/wasm32-unknown-unknown/release/okp4_objectarium.wasm 430.56 KB (0%)
target/wasm32-unknown-unknown/release/okp4_law_stone.wasm 644.19 KB (+0.51% 🔺)
target/wasm32-unknown-unknown/release/okp4_cognitarium.wasm 803.13 KB (0%)

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #395 (33ba939) into main (4b6aaed) will increase coverage by 0.00%.
Report is 11 commits behind head on main.
The diff coverage is 97.87%.

@@           Coverage Diff           @@
##             main     #395   +/-   ##
=======================================
  Coverage   97.77%   97.77%           
=======================================
  Files          42       42           
  Lines       10116    10163   +47     
=======================================
+ Hits         9891     9937   +46     
- Misses        225      226    +1     
Files Coverage Δ
contracts/okp4-law-stone/src/msg.rs 11.11% <ø> (ø)
contracts/okp4-law-stone/src/contract.rs 94.09% <97.87%> (+0.23%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ccamel ccamel marked this pull request as ready for review October 17, 2023 07:45
@coderabbitai
Copy link

coderabbitai bot commented Oct 17, 2023

Walkthrough

The changes introduce a new query message ProgramCode to retrieve the code of a program stored in the contract's storage. This is achieved by adding a new function program_code and a corresponding test. The QueryMsg enum is updated with a new variant ProgramCode to facilitate this request.

Changes

File Summary
contracts/okp4.../contract.rs Added a new query message ProgramCode and a function program_code to retrieve the program code from the contract's storage. Included a test program_code for verification.
contracts/okp4.../msg.rs Introduced a new variant ProgramCode to the QueryMsg enum for requesting the program code.
docs/okp4-law-stone.md Documented the new variants ProgramCode and program_code in the QueryMsg enum and the new struct Binary.

🐇

In the land of code, where logic is the road,

A new query message, a new tale to decode.

With a hop and a skip, the contract takes a dip,

To fetch the program's script, on this coding trip. 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

Copy link

@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

Commits Files that changed from the base of the PR and between ddd39a4 and 33ba939.
Files selected for processing (3)
  • contracts/okp4-law-stone/src/contract.rs (3 hunks)
  • contracts/okp4-law-stone/src/msg.rs (1 hunks)
  • docs/okp4-law-stone.md (3 hunks)
Files skipped from review due to trivial changes (1)
  • docs/okp4-law-stone.md
Additional comments (Suppressed): 4
contracts/okp4-law-stone/src/msg.rs (1)
  • 38-45: The new ProgramCode variant has been added to the QueryMsg enum. This variant is used to request the law program code. Ensure that all calls to this enum throughout the codebase have been updated to include this new variant. Also, verify that the returned Binary type is handled correctly in all instances where this variant is used.
contracts/okp4-law-stone/src/contract.rs (3)
  • 123-127: The new QueryMsg::ProgramCode variant is handled correctly in the match statement. Ensure that all calls to this function throughout the codebase have been updated to match the new variant.

  • 143-153: The program_code function retrieves the code of a program from the contract's storage using the querier. It seems to be implemented correctly, but ensure that the ObjectRef struct and PROGRAM constant are defined and accessible in this scope.

  • 401-443: The program_code test verifies the functionality of the new program_code function. It sets up a mock environment, saves a program to the contract's storage, and then queries the program code. The test seems to be implemented correctly, but ensure that all the constants, functions, and structs used in this test are defined and accessible in this scope.

@ccamel ccamel requested a review from amimart October 17, 2023 07:53
Copy link
Member

@amimart amimart left a comment

Choose a reason for hiding this comment

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

Nice 😉

@ccamel ccamel merged commit 27cd6e0 into main Oct 17, 2023
18 checks passed
@ccamel ccamel deleted the feat/law_stone_program_code branch October 17, 2023 12:35
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.

3 participants