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

CEP-18 #402

Merged
merged 12 commits into from
Apr 26, 2024
Merged

CEP-18 #402

merged 12 commits into from
Apr 26, 2024

Conversation

kubaplas
Copy link
Contributor

@kubaplas kubaplas commented Apr 17, 2024

Implementation of CEP-18 in Odra.
Named keys implementation is still missing.

Summary by CodeRabbit

  • New Features
    • Introduced new functionalities for managing named and dictionary values in contracts, enhancing interaction capabilities.
    • Deployed and tested CEP-18 compliant token contracts, providing full lifecycle management including token transfers and approvals.
  • Bug Fixes
    • Added checks to prevent contract execution from a contract address, enhancing security.
  • Documentation
    • Updated documentation related to contract execution and error handling.
  • Refactor
    • Optimized contract interaction methods and refactored storage handling for efficiency and clarity.
  • Tests
    • Added comprehensive test cases for token minting, burning, and transfer scenarios to ensure robustness and security.
  • Chores
    • Updated dependencies and integrated new modules for enhanced functionality.
  • Style
    • Improved code readability and maintenance by standardizing storage and error handling modules.

Copy link
Contributor

coderabbitai bot commented Apr 17, 2024

Warning

Rate Limit Exceeded

@kubaplas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 14 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 4f87480 and f985b99.

Walkthrough

The recent updates focus on enhancing the Odra framework and Casper network functionality. New methods for managing named and dictionary values in contract storage have been introduced, along with improvements in error handling and testing capabilities. Additionally, the CEP-18 token standard implementation has been expanded, offering more robust features for token management and operations.

Changes

File Pattern Change Summary
core/src/contract_*.rs, odra-*/src/*_contract_env.rs Added methods for handling named and dictionary values in contract storage.
core/src/*, odra-casper/* Enhanced error handling with new variants and updated deserialization methods.
examples/*, modules/* Introduced CEP-18 token functionality and client contract for Casper network interactions.
benchmark/* Added new storage modules for benchmarking named keys and dictionary values.
odra-vm/*, odra-casper/wasm-env/* Updated VM and WASM environments to support new storage functionalities.

🐇✨
In the land of code where the smart contracts play,
A rabbit hopped through, bringing updates today.
With a flick of its tail, new features unfurl,
Named keys and tokens, in the blockchain swirl.
Celebrate the dance of bits and bytes in flight,
As the rabbit's work turns darkness into light!
🌟📜


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Benchmark report

Action Details Gas diff
Wasm Deploy Filename: Benchmark.wasm 🔴 +0.00945 CSPR (0.01%)

@kubaplas kubaplas force-pushed the feature/cep-18 branch 4 times, most recently from 51203d0 to 9c0517f Compare April 23, 2024 10:25
@kubaplas kubaplas marked this pull request as ready for review April 24, 2024 14:33
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.

Actionable comments posted: 2

Out of diff range and nitpick comments (1)
examples/bin/cep18_on_livenet.rs (1)

45-64: Clarify that the parameters in deploy_cep18 are example values.

The function deploy_cep18 uses hardcoded values for the contract's parameters. It would be beneficial to add comments indicating that these are example values and should be adjusted according to actual use cases.

examples/bin/cep18_on_livenet.rs Show resolved Hide resolved
examples/bin/cep18_on_livenet.rs Show resolved Hide resolved
Copy link

Benchmark report

Action Details Gas diff
Wasm Deploy Filename: Benchmark.wasm 🔴 +3.68487 CSPR (4.96%)
Contract Call Entry point: set_variable 🔴 +0.00087915 CSPR (0.47%)
Contract Call Entry point: get_variable 🟢 -0.00000056 CSPR (0.00%)
Contract Call Entry point: set_struct_variable 🟢 -0.00015906 CSPR (0.05%)
Contract Call Entry point: get_struct_variable 🟢 -0.00018122 CSPR (0.05%)
Contract Call Entry point: set_mapping 🔴 +0.00103218 CSPR (0.50%)
Contract Call Entry point: get_mapping 🔴 +0.00013688 CSPR (0.03%)
Contract Call Entry point: push_list 🔴 +0.00015303 CSPR (0.04%)
Contract Call Entry point: get_list 🔴 +0.00013744 CSPR (0.03%)
Contract Call Entry point: call_submodule 🔴 +0.00005097 CSPR (0.01%)
Contract Call Entry point: transfer_back 🔴 +0.00012107 CSPR (0.00%)

modules/src/cep18_token.rs Outdated Show resolved Hide resolved
modules/src/cep18/utils.rs Outdated Show resolved Hide resolved
modules/src/cep18_token.rs Outdated Show resolved Hide resolved
modules/src/cep18_token.rs Outdated Show resolved Hide resolved
modules/src/cep18_token.rs Outdated Show resolved Hide resolved
modules/src/cep18_token.rs Show resolved Hide resolved
modules/src/lib.rs Show resolved Hide resolved
modules/Cargo.toml Outdated Show resolved Hide resolved
core/src/contract_env.rs Show resolved Hide resolved
Copy link
Contributor

@zie1ony zie1ony left a comment

Choose a reason for hiding this comment

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

Well done :)

core/src/contract_env.rs Outdated Show resolved Hide resolved
core/src/contract_env.rs Show resolved Hide resolved
core/src/contract_env.rs Show resolved Hide resolved
core/src/contract_env.rs Show resolved Hide resolved
core/src/error.rs Show resolved Hide resolved
modules/src/cep18_token.rs Show resolved Hide resolved
modules/src/cep18_token.rs Outdated Show resolved Hide resolved
modules/src/cep18_token.rs Show resolved Hide resolved
odra-macros/src/ast/schema/custom_item.rs Show resolved Hide resolved
odra-vm/src/vm/odra_vm.rs Outdated Show resolved Hide resolved
Copy link

Benchmark report

Action Details Gas diff
Wasm Deploy Filename: Benchmark.wasm 🔴 +3.68487 CSPR (4.96%)
Contract Call Entry point: set_variable 🔴 +0.00087915 CSPR (0.47%)
Contract Call Entry point: get_variable 🟢 -0.00000056 CSPR (0.00%)
Contract Call Entry point: set_struct_variable 🟢 -0.00015906 CSPR (0.05%)
Contract Call Entry point: get_struct_variable 🟢 -0.00018122 CSPR (0.05%)
Contract Call Entry point: set_mapping 🔴 +0.00103218 CSPR (0.50%)
Contract Call Entry point: get_mapping 🔴 +0.00013688 CSPR (0.03%)
Contract Call Entry point: push_list 🔴 +0.00015303 CSPR (0.04%)
Contract Call Entry point: get_list 🔴 +0.00013744 CSPR (0.03%)
Contract Call Entry point: call_submodule 🔴 +0.00005097 CSPR (0.01%)
Contract Call Entry point: transfer_back 🔴 +0.00012107 CSPR (0.00%)

Copy link

Benchmark report

Action Details Gas diff
Wasm Deploy Filename: Benchmark.wasm 🔴 +3.68487 CSPR (4.96%)
Contract Call Entry point: set_variable 🔴 +0.00087915 CSPR (0.47%)
Contract Call Entry point: get_variable 🟢 -0.00000056 CSPR (0.00%)
Contract Call Entry point: set_struct_variable 🟢 -0.00015906 CSPR (0.05%)
Contract Call Entry point: get_struct_variable 🟢 -0.00018122 CSPR (0.05%)
Contract Call Entry point: set_mapping 🔴 +0.00103218 CSPR (0.50%)
Contract Call Entry point: get_mapping 🔴 +0.00013688 CSPR (0.03%)
Contract Call Entry point: push_list 🔴 +0.00015303 CSPR (0.04%)
Contract Call Entry point: get_list 🔴 +0.00013744 CSPR (0.03%)
Contract Call Entry point: call_submodule 🔴 +0.00005097 CSPR (0.01%)
Contract Call Entry point: transfer_back 🔴 +0.00012107 CSPR (0.00%)

Added named keys and dictionary methods to benchmark.
Copy link

Benchmark report

Action Details Gas diff
Wasm Deploy Filename: Benchmark.wasm 🔴 +16.0040138 CSPR (21.56%)
Contract Call Entry point: set_variable 🔴 +0.00360106 CSPR (1.94%)
Contract Call Entry point: get_variable 🔴 +0.00272135 CSPR (0.84%)
Contract Call Entry point: set_struct_variable 🔴 +0.00272691 CSPR (0.89%)
Contract Call Entry point: get_struct_variable 🔴 +0.00270411 CSPR (0.68%)
Contract Call Entry point: set_mapping 🔴 +0.00375281 CSPR (1.81%)
Contract Call Entry point: get_mapping 🔴 +0.00285751 CSPR (0.72%)
Contract Call Entry point: push_list 🔴 +0.00287462 CSPR (0.72%)
Contract Call Entry point: get_list 🔴 +0.00285903 CSPR (0.70%)
Contract Call Entry point: init_submodule 🔴 +0.00329521 CSPR (0.25%)
Contract Call Entry point: call_submodule 🔴 +0.0027716 CSPR (0.81%)
Contract Call Entry point: call_payable 🔴 +0.00272191 CSPR (0.05%)
Contract Call Entry point: transfer_back 🔴 +0.00284714 CSPR (0.11%)
Contract Call Entry point: emit_event 🔴 +0.00329521 CSPR (1.29%)

@kubaplas kubaplas merged commit 6253efa into release/1.0.0 Apr 26, 2024
2 of 4 checks passed
@kubaplas kubaplas deleted the feature/cep-18 branch April 26, 2024 10:24
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