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

refactor(wasmbinding)!: remove wasmbinding custom executors #1766

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

matthiasmatt
Copy link
Contributor

@matthiasmatt matthiasmatt commented Jan 5, 2024

Purpose / Abstract

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation
    • Reordered and reformatted sections in README.md.
    • Removed outdated link from README.md.
  • Refactor
    • Removed WASM bindings and options from the application code.
  • Chores
    • Updated CHANGELOG.md to reflect the removal of the wasmbindings module.
  • Style
    • Eliminated comments related to WASM bindings in various functions.

@matthiasmatt matthiasmatt requested a review from a team as a code owner January 5, 2024 10:48
Copy link
Contributor

coderabbitai bot commented Jan 5, 2024

Walkthrough

The recent updates reflect a shift in the Nibiru Chain's approach to handling Wasm bindings and options. The changes suggest a move away from custom bindings towards using MsgServer and StargateMsg, aligning with the project's goal to simplify and enhance the way smart contracts interact with the blockchain's modules.

Changes

File Change Summary
README.md, app/app.go, app/wasmext/wasm.go Reordered and reformatted sections in README.md. Removed code-x-wasm link. Removed import of wasmbinding and usage of wasmbinding.NibiruWasmOptions. Renamed package and eliminated unused parameters.
app/keepers.go Removed comment about TokenFactory initialization.
x/tokenfactory/keeper/msg_server.go Removed comments about ValidateBasic for Wasm bindings in multiple functions.
app/wasmext/stargate_query.go, app/wasmext/stargate_query_test.go Renamed package and modified import paths.
CHANGELOG.md Pull request #1766 removes the wasmbindings module and updates the perp module, adding new features and fixing issues.
app/wasmext/wasm_cli_test/cli_test.go Renamed the package, removed import of time, and modified the formatting of the fees flag.

Poem

In the realm of code, where logic reigns,
A rabbit hopped through, leaving smart contract chains.
🌟 With every leap, old bindings shed,
New paths woven, in stargate's stead. 🚀

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • 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

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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 e839e08 and ff8360a.
Files ignored due to filter (6)
  • wasmbinding/bindings/execute_msg.json
  • wasmbinding/bindings/query_resp.json
  • wasmbinding/test/testdata/cw_nameservice.wasm
  • wasmbinding/wasmbin/bindings_perp.wasm
  • wasmbinding/wasmbin/controller.wasm
  • wasmbinding/wasmbin/shifter.wasm
Files selected for processing (4)
  • README.md (2 hunks)
  • app/app.go (2 hunks)
  • app/keepers.go (1 hunks)
  • x/tokenfactory/keeper/msg_server.go (6 hunks)
Files skipped from review due to trivial changes (3)
  • README.md
  • app/keepers.go
  • x/tokenfactory/keeper/msg_server.go
Additional comments: 3
app/app.go (3)
  • 43-46: The removal of the wasmbinding import statement is consistent with the PR's objective to remove the wasmbindings module. This change should not affect other parts of the file as long as there are no references to the removed module elsewhere in the code.

  • 113-116: The removal of wasmbinding.NibiruWasmOptions from the GetWasmOpts function aligns with the PR's goal. Ensure that no other part of the application relies on the removed functionality, which could lead to runtime errors.

Verification successful

The search for references to NibiruWasmOptions in the codebase did not yield any results. This suggests that the removal of wasmbinding.NibiruWasmOptions from the GetWasmOpts function in app/app.go has not left any orphaned references in the Go files.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any remaining references to `NibiruWasmOptions` in the codebase.
rg --type go 'NibiruWasmOptions'

Length of output: 32

* 43-48: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-242]

Given the scope of the changes, it's important to verify that the removal of the wasmbindings module does not affect other modules or functionality within the application. This includes checking for any indirect dependencies that might be broken due to the removal.

Verification successful

The search for references to the wasmbindings module in Go files did not yield any results. This suggests that there are no remaining indirect references or dependencies on the wasmbindings module within the Go files of the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any indirect references or dependencies on the `wasmbindings` module.
rg --type go 'wasmbindings'

Length of output: 27

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 ff8360a and 173a679.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (d8865a3) 73.40% compared to head (e267514) 73.24%.

❗ Current head e267514 differs from pull request most recent head a0dfd66. Consider uploading reports for the commit a0dfd66 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1766      +/-   ##
==========================================
- Coverage   73.40%   73.24%   -0.16%     
==========================================
  Files         196      191       -5     
  Lines       15547    15436     -111     
==========================================
- Hits        11412    11306     -106     
+ Misses       3473     3470       -3     
+ Partials      662      660       -2     
Files Coverage Δ
app/app.go 56.90% <100.00%> (-1.16%) ⬇️
app/keepers.go 99.18% <ø> (-0.01%) ⬇️
app/wasmext/stargate_query.go 100.00% <ø> (ø)
app/wasmext/wasm.go 0.00% <0.00%> (ø)
x/tokenfactory/keeper/msg_server.go 83.16% <66.66%> (ø)

@Unique-Divine
Copy link
Member

Unique-Divine commented Jan 5, 2024

The stargate queries are still supposed to be there. If that part is removed, contracts can't use the query server at all

README.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

This change breaks the links for me

app/app.go Outdated
Comment on lines 118 to 121
// Add the bindings to the app's set of []wasmkeeper.Option.
wasmOpts = append(wasmOpts, wasmbinding.NibiruWasmOptions(
nibiru.GRPCQueryRouter(),
nibiru.appCodec,
Copy link
Member

Choose a reason for hiding this comment

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

The stargate queries are still supposed to be there. If that part is removed, contracts can't use the query server at all.

So the only part to remove here is the keeper executor stuff, not the entire querier

@Unique-Divine Unique-Divine changed the title feat: remove wasmbindings module feat: remove wasmbinding custom executors Jan 6, 2024
@Unique-Divine Unique-Divine changed the title feat: remove wasmbinding custom executors refactor(wasmbinding)!: remove wasmbinding custom executors Jan 8, 2024
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 173a679 and e267514.
Files ignored due to filter (1)
  • app/wasmext/wasm_cli_test/testdata/cw_nameservice.wasm
Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • app/app.go (3 hunks)
  • app/wasmext/stargate_query.go (2 hunks)
  • app/wasmext/stargate_query_test.go (2 hunks)
  • app/wasmext/wasm.go (2 hunks)
Files skipped from review due to trivial changes (2)
  • app/wasmext/stargate_query.go
  • app/wasmext/stargate_query_test.go
Files skipped from review as they are similar to previous changes (2)
  • CHANGELOG.md
  • app/app.go
Additional comments: 3
app/wasmext/wasm.go (3)
  • 1-16: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-23]

The removal of parameters related to perpv2, sudoKeeper, and oracleKeeper from the NibiruWasmOptions function simplifies the configuration. Please ensure that this change does not impact other modules or functionalities that might depend on these keepers.

  • 1-10: The removal of unused imports is a good practice for maintaining clean code. Please confirm that there are no unresolved references due to these removals.

  • 1-1: The renaming of the package should be reflected across all files that import this package. Please verify that all necessary changes have been made.

Verification successful

The search results indicate that the wasmext package is still being referenced in several files within the codebase. Specifically, the app.go file imports the wasmext package and uses the NibiruWasmOptions function from it. Additionally, the stargate_query_test.go file references the wasmext package in a test package declaration and imports it with an alias wasmbinding.

Given this information, it appears that the package renaming has been accounted for in the codebase, as the references to wasmext are consistent with the package name shown in the wasm.go file.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any old package references that need to be updated.
rg --type go 'wasmext'

Length of output: 371

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 e267514 and a0dfd66.
Files selected for processing (1)
  • app/wasmext/wasm_cli_test/cli_test.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • app/wasmext/wasm_cli_test/cli_test.go

@Unique-Divine Unique-Divine enabled auto-merge (squash) January 8, 2024 04:11
@Unique-Divine Unique-Divine merged commit 33682ec into main Jan 8, 2024
12 checks passed
@Unique-Divine Unique-Divine deleted the mat/remove-wasmbinding branch January 8, 2024 04:15
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.

None yet

2 participants