NibiruChain / nibiru

Nibiru Chain: The breakthrough smart contract platform ushering in the next era of money. Nibiru powers an ecosystem of dApps including perps, RWAs, and more.
https://nibiru.fi
Apache License 2.0
179 stars 200 forks source link

feat(evm): keeper collections and grpc query impls for EthAccount, NibiruAccount #1873

Closed Unique-Divine closed 2 months ago

Unique-Divine commented 2 months ago
  1. Part of #1836
  2. Deletes unused protobuf files
  3. Upgrades to collections v0.5 to use MapTransient and ItemTransient
  4. Implements the NibiruAccount and EthAccount queries
  5. Further updates the module wiring.
coderabbitai[bot] commented 2 months ago

Walkthrough

The changes in the NibiruChain/nibiru project encompass significant updates related to Ethereum integration, including new keeper collections and gRPC query implementations for Ethereum and Nibiru accounts. Additionally, the codebase has undergone a refactor to improve readability and maintainability, such as consolidating validation logic and renaming various functions and variables for clarity. The codec handling has been standardized across multiple files, switching from Marshaler to Codec.

Changes

File/Path Change Summary
CHANGELOG.md Added features related to Ethereum (eth) and Ethereum Virtual Machine (evm).
app/ante.go Refactored NewAnteHandler to use ValidateAndClean method for validation.
app/ante/fixed_gas_test.go Updated expected gas value in TestOraclePostPriceTransactionsHaveFixedPrice.
app/ante/testutil_test.go Modified NewNibiruTestApp to use Codec instead of Marshaler.
app/app.go Changed appCodec to use Codec instead of Marshaler.
app/appconst/appconst.go Renamed Version() to RuntimeVersion().
app/codec/codec.go Renamed Marshaler field in EncodingConfig struct to Codec.
app/ibc_test.go Updated parameter to app.NewDefaultGenesisState to use Codec.
app/keepers.go Added import for eth and modified AccountKeeper initialization.
app/modules_test.go Updated to use Codec instead of Marshaler in multiple functions.
cmd/nibid/cmd/decode_base64_test.go Replaced Marshaler with Codec in TestBase64Decode.
cmd/nibid/cmd/genaccounts_test.go Replaced Marshaler with Codec in TestAddGenesisAccountCmd.
cmd/nibid/cmd/root.go Replaced Marshaler with Codec in WithCodec method call.
cmd/nibid/cmd/testnet_test.go Switched from Marshaler to Codec in multiple function calls.
eth/chain_id.go Removed errorsmod import and refactored error handling.
eth/chain_id_test.go Refactored TestParseChainID into TestParseChainID_Happy and TestParseChainID_Sad.
eth/codec.go Added constants for transaction extension protobuf type URLs.
eth/encoding/config.go Registered Amino codec with mb before registering interfaces.
eth/eth_account.go Introduced functionality related to Ethereum accounts.
eth/indexer/kv_indexer_test.go Updated encCfg declaration to use app.MakeEncodingConfig().
eth/rpc/backend/account_info.go Renamed QueryAccountRequest to QueryEthAccountRequest.
eth/rpc/backend/evm_query_client_test.go Renamed function call and request/response types.
eth/rpc/backend/mocks/evm_query_client.go Renamed functions and updated request/response types.
eth/rpc/rpcapi/web3_api.go ClientVersion now returns appconst.RuntimeVersion().
proto/eth/evm/v1/query.proto Renamed RPC methods and message types related to Ethereum account queries.
x/common/error.go Renamed ErrNilMsg() to ErrNilGrpcMsg().
x/common/testutil/cli/network.go Changed Codec field assignment to use Codec.
x/common/testutil/cli/network_test.go Modified cdc variable declaration in TestLogMnemonic.
x/common/testutil/cli/util.go Updated NewKeyring to use Codec.
x/common/testutil/genesis/genesis.go Replaced Marshaler with Codec in NewTestGenesisState.
x/common/testutil/genesis/oracle_genesis.go Replaced Marshaler with Codec in AddOracleGenesis.
x/common/testutil/genesis/sudo_genesis.go Replaced Marshaler with Codec in AddSudoGenesis.
x/common/testutil/testapp/testapp.go Switched from Marshaler to Codec for JSON operations.

In the code's realm, where bytes do dance,
Ethereum's magic takes its stance.
Keepers and queries now align,
With Codec's touch, the stars do shine.
Ante's logic, clean and bright,
Nibiru's future, ever in sight.
A rabbit's joy, in code's delight. 🐇✨


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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 38.83162% with 178 lines in your changes are missing coverage. Please review.

Project coverage is 67.13%. Comparing base (6e38c19) to head (5187d0f).

:exclamation: Current head 5187d0f differs from pull request most recent head 75d3990. Consider uploading reports for the commit 75d3990 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1873 +/- ## ========================================== - Coverage 67.79% 67.13% -0.67% ========================================== Files 208 212 +4 Lines 13228 13467 +239 ========================================== + Hits 8968 9041 +73 - Misses 3619 3780 +161 - Partials 641 646 +5 ``` | [Files](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain) | Coverage Δ | | |---|---|---| | [app/app.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-YXBwL2FwcC5nbw==) | `54.36% <100.00%> (ø)` | | | [app/keepers.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=app%2Fkeepers.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-YXBwL2tlZXBlcnMuZ28=) | `99.16% <100.00%> (+<0.01%)` | :arrow_up: | | [cmd/nibid/cmd/root.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=cmd%2Fnibid%2Fcmd%2Froot.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-Y21kL25pYmlkL2NtZC9yb290Lmdv) | `77.93% <100.00%> (ø)` | | | [eth/codec.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=eth%2Fcodec.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-ZXRoL2NvZGVjLmdv) | `58.33% <ø> (ø)` | | | [eth/encoding/config.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=eth%2Fencoding%2Fconfig.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-ZXRoL2VuY29kaW5nL2NvbmZpZy5nbw==) | `100.00% <100.00%> (ø)` | | | [eth/rpc/backend/account\_info.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=eth%2Frpc%2Fbackend%2Faccount_info.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-ZXRoL3JwYy9iYWNrZW5kL2FjY291bnRfaW5mby5nbw==) | `83.03% <100.00%> (ø)` | | | [x/common/testutil/cli/network.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=x%2Fcommon%2Ftestutil%2Fcli%2Fnetwork.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-eC9jb21tb24vdGVzdHV0aWwvY2xpL25ldHdvcmsuZ28=) | `77.15% <100.00%> (ø)` | | | [x/common/testutil/cli/util.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=x%2Fcommon%2Ftestutil%2Fcli%2Futil.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-eC9jb21tb24vdGVzdHV0aWwvY2xpL3V0aWwuZ28=) | `74.32% <100.00%> (ø)` | | | [x/evm/codec.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=x%2Fevm%2Fcodec.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-eC9ldm0vY29kZWMuZ28=) | `84.21% <ø> (ø)` | | | [x/evm/const.go](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree&filepath=x%2Fevm%2Fconst.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain#diff-eC9ldm0vY29uc3QuZ28=) | `0.00% <ø> (ø)` | | | ... and [12 more](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain) | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/NibiruChain/nibiru/pull/1873/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NibiruChain)