Skip to content

feat: update mantrachain-std to v5#26

Merged
desamtralized merged 6 commits intomainfrom
update-mantrachain-std-v5
Sep 30, 2025
Merged

feat: update mantrachain-std to v5#26
desamtralized merged 6 commits intomainfrom
update-mantrachain-std-v5

Conversation

@allthatjazzleo
Copy link
Contributor

@allthatjazzleo allthatjazzleo commented Sep 26, 2025

Description and Motivation

Related Issues


Checklist:

  • I have read MANTRA's contribution guidelines.
  • My pull request has a sound title and description (not something vague like Update index.md)
  • All existing and new tests are passing.
  • I updated/added relevant documentation.
  • The code is formatted properly just fmt.
  • Clippy doesn't report any issues just lint.

Summary by CodeRabbit

  • New Features

    • Cosmos EVM support: ERC20, VM, fee-market, crypto, precisebank, types and typed queries.
    • Added Epochs and Protocolpool modules with typed queries.
  • Changes

    • Transactions: added unordered execution mode with optional timeout.
    • Bank: denoms metadata query added; all_balances undeprecated.
    • Sanctions blacklist query supports pagination.
    • Version bumps: Mantrachain → v5.0.0, mantrachain-std → 0.3.0.
  • Breaking Changes

    • Removed xfeemarket and ORM public modules/queries.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

Adds large EVM, epochs, and protocolpool protobuf/type surfaces and typed queriers; removes ORM and xfeemarket surfaces; adds fields to several Cosmos core types and TxBody; integrates EVM repo into proto-build and bumps Mantrachain/mantrachain-std versions; removes many provenance doc comments.

Changes

Cohort / File(s) Summary
Version & build scripts
packages/mantrachain-std/src/types/MANTRACHAIN_COMMIT, scripts/update-and-rebuild.sh, packages/mantrachain-std/Cargo.toml, Cargo.toml, packages/proto-build/src/main.rs
Bumped Mantrachain commit/version to v5.0.0; bumped mantrachain-std package 0.2.00.3.0; proto-build now clones/resolves an EVM repo and includes an EVM project in generation.
Proto-build: git helper
packages/proto-build/src/git.rs
Added Evm variant to Module enum and branch to resolve EVM version from go.mod.
Cosmos root / module exports
packages/mantrachain-std/src/types/cosmos/mod.rs, .../orm/mod.rs, .../orm/module/mod.rs, .../orm/query/mod.rs
Added epochs, evm, protocolpool exports; removed orm exports and several orm submodule re-exports.
ORM surface removal
.../cosmos/orm/query/v1alpha1.rs, .../cosmos/orm/v1.rs, .../cosmos/orm/v1alpha1.rs
Deleted the ORM v1/v1alpha1 types, queries and querier helpers (complete API surface removed).
EVM module tree added
packages/mantrachain-std/src/types/cosmos/evm/mod.rs, .../crypto/mod.rs, .../erc20/mod.rs, .../feemarket/mod.rs, .../precisebank/mod.rs, .../types/mod.rs, .../vm/mod.rs
Introduced EVM namespaces and submodules (crypto, erc20, feemarket, precisebank, types, vm).
EVM granular files
.../evm/crypto/v1/ethsecp256k1.rs, .../evm/erc20/v1.rs, .../evm/feemarket/v1.rs, .../evm/precisebank/v1.rs, .../evm/types/v1.rs, .../evm/vm/v1.rs
Added many protobuf-backed types, events, params, genesis, Msg/Query messages and typed queriers (PubKey/PrivKey, TokenPair/Allowance, ERC20 gov/messages/events, Feemarket types, Precisebank types, ExtensionOptions/TxResult/Web3Tx, large VM v1 surface and VmQuerier).
Epochs module added
packages/mantrachain-std/src/types/cosmos/epochs/mod.rs, .../module/v1.rs, .../v1beta1.rs
Exposed epochs modules, adjusted module type_url, added epoch events/types and EpochsQuerier with epoch_infos and current_epoch queries.
Protocolpool module added
.../cosmos/protocolpool/module/mod.rs, .../module/v1.rs, .../protocolpool/v1.rs
Added protocolpool v1 types (ContinuousFund, Params, GenesisState, Msg/Query messages) and ProtocolpoolQuerier; updated Module proto type_url.
Core SDK type changes
packages/mantrachain-std/src/types/cosmos/app/runtime/v1alpha1.rs, .../cosmos/app/v1alpha1.rs, .../cosmos/auth/module/v1.rs, .../cosmos/tx/v1beta1.rs
Added Module.skip_store_keys and Module.pre_blockers; deprecated V1alpha1Querier::config; added Module.enable_unordered_transactions; added TxBody.unordered and TxBody.timeout_timestamp.
Bank querier update
packages/mantrachain-std/src/types/cosmos/bank/v1beta1.rs
Added BankQuerier::denoms_metadata(pagination) and removed #[deprecated] from all_balances; cleaned duplicate docs.
Sanction pagination
packages/mantrachain-std/src/types/mantrachain/sanction/v1.rs
QueryBlacklistRequest/Response now support pagination; SanctionQuerier::blacklist accepts optional pagination.
Mantrachain module cleanup
packages/mantrachain-std/src/types/mantrachain/mod.rs, .../xfeemarket/v1.rs
Removed public xfeemarket export and deleted its v1 types and XfeemarketQuerier.
Doc-comment pruning (no API changes)
many packages/mantrachain-std/src/types/cosmos/.../*.rs
Removed many "Since: cosmos-sdk ..." provenance doc comments across numerous Cosmos files (abci, base, tendermint, consensus, crisis, distribution, evidence, feegrant, gov, group, mint, params, slashing, staking, store, upgrade, vesting, etc.).
Crate lint / README
packages/mantrachain-std/src/lib.rs, README.md
Added #![allow(clippy::all)] at crate root; updated README table to list mantrachain-std crate.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant QuerierHelper as TypedQuerier (Erc20/Feemarket/Precisebank/Vm/Epochs)
  participant Querier as QuerierWrapper
  participant Chain as Chain RPC

  Client->>QuerierHelper: call typed method (e.g., token_pairs, params, epoch_infos)
  QuerierHelper->>Querier: build proto request and invoke query
  Querier->>Chain: RPC request
  Chain-->>Querier: Response / StdError
  Querier-->>QuerierHelper: return typed response
  QuerierHelper-->>Client: return Response / StdError
Loading
sequenceDiagram
  autonumber
  actor Client
  participant SanctionQuerier
  participant ChainRPC

  Client->>SanctionQuerier: blacklist(pagination?)
  SanctionQuerier->>ChainRPC: QueryBlacklistRequest{pagination}
  alt paged response
    ChainRPC-->>SanctionQuerier: QueryBlacklistResponse{addresses, pagination.next_key}
    note right of SanctionQuerier: caller may re-query with next_key
  else single page
    ChainRPC-->>SanctionQuerier: QueryBlacklistResponse{addresses, pagination=nil}
  end
  SanctionQuerier-->>Client: QueryBlacklistResponse
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

I nibble code beneath the moonlight,
New EVM tunnels in soft white. 🐇
Epochs tick, protocol pools bloom,
ORM closed up — tidy the room.
v5.0 hops forth, queries on the run; thump-thump, well done! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “feat: update mantrachain-std to v5” clearly summarizes the core purpose of this PR, which is to bump the mantrachain-std crate to version 5 and apply related updates. It follows a concise conventional commit style and avoids unnecessary detail, making the primary change immediately apparent to anyone scanning the project history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-mantrachain-std-v5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Actionable comments posted: 12

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/mantrachain-std/src/types/cosmos/evm/feemarket/v1.rs (1)

1-288: Declare neutron_std_derive in Cargo.toml
Add a dependency on neutron_std_derive (e.g. in the root Cargo.toml or in packages/mantrachain-std/Cargo.toml) so that every use neutron_std_derive::CosmwasmExt; resolves correctly.

packages/mantrachain-std/src/types/cosmos/protocolpool/module/v1.rs (1)

2-17: Doc comment now misnames the module

The new wording says this is the config for the “consensus module,” but this file defines the protocolpool module. Please revert or rephrase to avoid confusing downstream readers.

🧹 Nitpick comments (13)
packages/mantrachain-std/src/types/mantrachain/sanction/v1.rs (1)

193-200: Add blacklist_all helper and update docs/CHANGELOG
No internal usages of blacklist were found—this change is non-breaking in the crate. Add a blacklist_all(&self) wrapper that calls blacklist(None), document that None returns all entries, and record the API change in the CHANGELOG.

packages/proto-build/src/main.rs (1)

53-59: Make EVM rev resolution reproducible and override-friendly.

Given git.rs currently returns a temporary branch, evm_rev isn’t pinned. Once git.rs is updated to extract from go.mod with fallback, this will be reproducible. Optionally allow an env override (e.g., EVM_REV) to force testing specific commits without code changes.

If you want the env override, I can draft a small patch to read std::env::var("EVM_REV") and prefer it over go.mod.

Also applies to: 82-88, 100-100

packages/mantrachain-std/src/types/cosmos/app/v1alpha1.rs (2)

245-248: Add deprecation version to the attribute

Marking with a version helps downstreams plan migrations.

Apply this diff:

-    #[deprecated]
+    #[deprecated(since = "v5.0.0")]
     pub fn config(&self) -> Result<QueryConfigResponse, cosmwasm_std::StdError> {
         QueryConfigRequest {}.query(self.querier)
     }

245-248: No .config() call-sites detected Repo-wide search found zero invocations of the deprecated config() method; no code updates needed. Recommend documenting the replacement API in crate-level docs.

packages/mantrachain-std/src/types/cosmos/evm/types/v1.rs (1)

103-108: Widen serde compatibility with an extra alias

Many clients use camelCase “typedDataChainID”. Add it as an additional alias.

Apply this diff:

     #[prost(uint64, tag = "1")]
-    #[serde(alias = "typed_data_chainID")]
+    #[serde(alias = "typed_data_chainID")]
+    #[serde(alias = "typedDataChainID")]
     #[serde(
         serialize_with = "crate::serde::as_str::serialize",
         deserialize_with = "crate::serde::as_str::deserialize"
     )]
     pub typed_data_chain_id: u64,
packages/mantrachain-std/src/types/cosmos/evm/precisebank/v1.rs (2)

136-141: Take address by Into to avoid unnecessary clones

Improves ergonomics and avoids forcing callers to allocate.

Apply this diff:

-    pub fn fractional_balance(
-        &self,
-        address: ::prost::alloc::string::String,
-    ) -> Result<QueryFractionalBalanceResponse, cosmwasm_std::StdError> {
-        QueryFractionalBalanceRequest { address }.query(self.querier)
-    }
+    pub fn fractional_balance(
+        &self,
+        address: impl Into<::prost::alloc::string::String>,
+    ) -> Result<QueryFractionalBalanceResponse, cosmwasm_std::StdError> {
+        QueryFractionalBalanceRequest { address: address.into() }.query(self.querier)
+    }

47-65: Derive Default for empty request for convenience

This eases construction in callers and tests.

Apply this diff:

-#[derive(
+#[derive(
     Clone,
     PartialEq,
     Eq,
     ::prost::Message,
     ::serde::Serialize,
     ::serde::Deserialize,
     ::schemars::JsonSchema,
-    CosmwasmExt,
+    CosmwasmExt,
+    Default,
 )]
 pub struct QueryRemainderRequest {}
packages/mantrachain-std/src/types/cosmos/evm/feemarket/v1.rs (3)

120-137: Add Default derive to empty request

Convenience for callers.

Apply this diff:

-#[derive(
+#[derive(
     Clone,
     PartialEq,
     Eq,
     ::prost::Message,
     ::serde::Serialize,
     ::serde::Deserialize,
     ::schemars::JsonSchema,
-    CosmwasmExt,
+    CosmwasmExt,
+    Default,
 )]
 pub struct QueryParamsRequest {}

156-175: Add Default derive to empty request

Consistency with other empty requests.

Apply this diff:

-#[derive(
+#[derive(
     Clone,
     PartialEq,
     Eq,
     ::prost::Message,
     ::serde::Serialize,
     ::serde::Deserialize,
     ::schemars::JsonSchema,
-    CosmwasmExt,
+    CosmwasmExt,
+    Default,
 )]
 pub struct QueryBaseFeeRequest {}

206-211: Add Default derive to empty request

Completes the set.

Apply this diff:

-#[derive(
+#[derive(
     Clone,
     PartialEq,
     Eq,
     ::prost::Message,
     ::serde::Serialize,
     ::serde::Deserialize,
     ::schemars::JsonSchema,
-    CosmwasmExt,
+    CosmwasmExt,
+    Default,
 )]
 pub struct QueryBlockGasRequest {}
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1)

1-1669: Consider extracting common patterns in VmQuerier methods.

The VmQuerier implementation has 15+ query methods with repetitive parameter passing patterns. While functional, this could benefit from helper methods or macros to reduce boilerplate, especially for methods that construct requests with many parameters like trace_tx and trace_block.

Example refactor pattern for consideration:

// Helper macro for simple queries
macro_rules! simple_query {
    ($method:ident, $request:ty, $response:ty, $($field:ident: $type:ty),*) => {
        pub fn $method(&self, $($field: $type),*) -> Result<$response, cosmwasm_std::StdError> {
            <$request> { $($field),* }.query(self.querier)
        }
    };
}

// Usage:
simple_query!(account, QueryAccountRequest, QueryAccountResponse, address: ::prost::alloc::string::String);
packages/mantrachain-std/src/types/cosmos/epochs/v1beta1.rs (1)

219-234: Accept &str for querier methods.

The querier API forces callers to allocate Strings for identifiers, which is inconsistent with other modules and adds churn. Accept anything Into<String> so borrowing stays cheap.

Apply:

-    pub fn current_epoch(
-        &self,
-        identifier: ::prost::alloc::string::String,
-    ) -> Result<QueryCurrentEpochResponse, cosmwasm_std::StdError> {
-        QueryCurrentEpochRequest { identifier }.query(self.querier)
+    pub fn current_epoch<I>(
+        &self,
+        identifier: I,
+    ) -> Result<QueryCurrentEpochResponse, cosmwasm_std::StdError>
+    where
+        I: Into<::prost::alloc::string::String>,
+    {
+        QueryCurrentEpochRequest {
+            identifier: identifier.into(),
+        }
+        .query(self.querier)

(Optionally, mirror the same pattern in other queriers for consistency.)

packages/mantrachain-std/src/types/cosmos/protocolpool/v1.rs (1)

431-452: Streamline querier string inputs.

Like other modules, accept Into<String> to avoid forcing heap allocations for callers.

-    pub fn continuous_fund(
-        &self,
-        recipient: ::prost::alloc::string::String,
-    ) -> Result<QueryContinuousFundResponse, cosmwasm_std::StdError> {
-        QueryContinuousFundRequest { recipient }.query(self.querier)
+    pub fn continuous_fund<R>(
+        &self,
+        recipient: R,
+    ) -> Result<QueryContinuousFundResponse, cosmwasm_std::StdError>
+    where
+        R: Into<::prost::alloc::string::String>,
+    {
+        QueryContinuousFundRequest {
+            recipient: recipient.into(),
+        }
+        .query(self.querier)

Mirror the same change in other methods taking strings if you want full consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between e30ecd6 and e586a49.

📒 Files selected for processing (59)
  • packages/mantrachain-std/src/types/MANTRACHAIN_COMMIT (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/app/runtime/v1alpha1.rs (2 hunks)
  • packages/mantrachain-std/src/types/cosmos/app/v1alpha1.rs (2 hunks)
  • packages/mantrachain-std/src/types/cosmos/auth/module/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/auth/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/bank/v1beta1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/base/abci/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/base/query/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/base/tendermint/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/consensus/v1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/crisis/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/distribution/v1beta1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/epochs/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/epochs/module/v1.rs (2 hunks)
  • packages/mantrachain-std/src/types/cosmos/epochs/v1beta1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evidence/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/crypto/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/crypto/v1/ethsecp256k1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/crypto/v1/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/erc20/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/erc20/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/feemarket/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/feemarket/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/precisebank/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/precisebank/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/types/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/types/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/vm/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/feegrant/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/gov/v1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/gov/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/group/v1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/mint/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/mod.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/module/mod.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/query/mod.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/query/v1alpha1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/v1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/orm/v1alpha1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/params/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/protocolpool/module/mod.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/protocolpool/module/v1.rs (2 hunks)
  • packages/mantrachain-std/src/types/cosmos/protocolpool/v1.rs (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/slashing/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/staking/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/store/snapshots/v1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/store/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/tx/v1beta1.rs (2 hunks)
  • packages/mantrachain-std/src/types/cosmos/upgrade/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/cosmos/vesting/v1beta1.rs (0 hunks)
  • packages/mantrachain-std/src/types/mantrachain/mod.rs (0 hunks)
  • packages/mantrachain-std/src/types/mantrachain/sanction/v1.rs (3 hunks)
  • packages/mantrachain-std/src/types/mantrachain/xfeemarket/v1.rs (0 hunks)
  • packages/proto-build/src/git.rs (2 hunks)
  • packages/proto-build/src/main.rs (6 hunks)
  • scripts/update-and-rebuild.sh (1 hunks)
💤 Files with no reviewable changes (27)
  • packages/mantrachain-std/src/types/mantrachain/mod.rs
  • packages/mantrachain-std/src/types/cosmos/orm/query/mod.rs
  • packages/mantrachain-std/src/types/cosmos/params/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/mint/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/base/query/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/upgrade/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/gov/v1.rs
  • packages/mantrachain-std/src/types/cosmos/slashing/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/feegrant/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/store/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/base/abci/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/staking/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/group/v1.rs
  • packages/mantrachain-std/src/types/cosmos/vesting/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/crisis/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/gov/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/evidence/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/store/snapshots/v1.rs
  • packages/mantrachain-std/src/types/cosmos/orm/query/v1alpha1.rs
  • packages/mantrachain-std/src/types/cosmos/auth/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/consensus/v1.rs
  • packages/mantrachain-std/src/types/mantrachain/xfeemarket/v1.rs
  • packages/mantrachain-std/src/types/cosmos/orm/v1alpha1.rs
  • packages/mantrachain-std/src/types/cosmos/orm/mod.rs
  • packages/mantrachain-std/src/types/cosmos/orm/v1.rs
  • packages/mantrachain-std/src/types/cosmos/base/tendermint/v1beta1.rs
  • packages/mantrachain-std/src/types/cosmos/orm/module/mod.rs
🧰 Additional context used
🪛 GitHub Actions: Tests and Lints
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs

[error] 1601-1608: mismatched types: function return type is Result<EstimateGasResponse, cosmwasm_std::StdError> but the expression returns Result<MsgEthereumTxResponse, _>. This causes a type mismatch: expected EstimateGasResponse but found MsgEthereumTxResponse. (E0308)


[error] 1602-1608: Type error prevents compilation: function returning Result<EstimateGasResponse, cosmwasm_std::StdError> is returning MsgEthereumTxResponse. Ensure the called .query/... returns the correct type or adjust the function's return type accordingly.


[error] 1601-1608: could not compile mantrachain-std (lib) due to 1 previous error

🔇 Additional comments (26)
packages/mantrachain-std/src/types/MANTRACHAIN_COMMIT (1)

1-1: Version marker bump looks good

The commit pointer now aligns with the v5 release.

scripts/update-and-rebuild.sh (1)

8-8: Version bump aligns with v5 rollout

Switching the default to v5.0.0 matches the rest of the upgrade work. No issues spotted.

packages/mantrachain-std/src/types/cosmos/distribution/v1beta1.rs (1)

37-42: Doc-comment cleanup looks good.

Removing the redundant SDK version notes keeps the generated types lean without touching behavior. All good here.

packages/mantrachain-std/src/types/cosmos/bank/v1beta1.rs (1)

1066-1071: Great to see the paginated denoms metadata helper added

Matches the new QueryDenomsMetadata* types and keeps the querier surface consistent with the other paginated helpers. Looks solid.

packages/mantrachain-std/src/types/mantrachain/sanction/v1.rs (2)

89-94: Pagination added to QueryBlacklistRequest — LGTM

Correct type and tag; aligns with Cosmos pagination conventions.


112-115: Pagination added to QueryBlacklistResponse — LGTM

Uses a new tag and won’t collide with existing fields.

packages/proto-build/src/git.rs (1)

41-42: Enum variant for EVM looks good.

Adding Module::Evm is consistent with the new project integration.

packages/proto-build/src/main.rs (4)

15-16: EVM repo constant addition is fine.


19-20: Version bump to v5.0.0 acknowledged.


28-30: EVM_DIR path addition looks consistent with existing layout.


67-73: Confirm excluded Cosmos SDK modules don’t drop needed protos.

Excluding autocli, benchmark, counter, and reflection should be fine, but please confirm none of your consumed protos depend on reflection declarations.

packages/mantrachain-std/src/types/cosmos/evm/types/mod.rs (1)

1-1: LGTM: module exposure is correct

pub mod v1; neatly exposes the new EVM types v1 surface.

packages/mantrachain-std/src/types/cosmos/app/v1alpha1.rs (1)

220-220: Docs alignment looks good

The response doc matches the proto_query annotation and type.

packages/mantrachain-std/src/types/cosmos/evm/precisebank/v1.rs (1)

1-143: LGTM: module and querier additions are consistent

Type URLs, proto_query paths, and serde helpers align with Cosmos JSON conventions.

packages/mantrachain-std/src/types/cosmos/evm/types/v1.rs (1)

1-121: Ignore Debug derive suggestion
Workspace uses prost 0.13.3 (with prost-derive), where deriving Message still implies Debug; no changes needed.

Likely an incorrect or invalid review comment.

packages/mantrachain-std/src/types/cosmos/evm/feemarket/mod.rs (1)

1-1: LGTM!

The module exposure follows the standard pattern for v1 module organization.

packages/mantrachain-std/src/types/cosmos/evm/erc20/v1.rs (1)

1-701: Well-structured ERC20 v1 module implementation.

The module provides a comprehensive set of types and query helpers for Cosmos EVM ERC20 integration, following consistent patterns with proper protobuf annotations and CosmWasm extensions throughout. The deprecated proposal types are appropriately marked for backward compatibility.

packages/mantrachain-std/src/types/cosmos/evm/erc20/mod.rs (1)

1-1: LGTM!

Module exposure follows the standard pattern.

packages/mantrachain-std/src/types/cosmos/protocolpool/module/mod.rs (1)

1-1: LGTM!

Module exposure is consistent with the established pattern.

packages/mantrachain-std/src/types/cosmos/evm/precisebank/mod.rs (1)

1-1: Exposure of precisebank::v1 looks good

Thanks for wiring the v1 module; it matches the new precisebank surface introduced elsewhere in the PR.

packages/mantrachain-std/src/types/cosmos/evm/vm/mod.rs (1)

1-1: vm::v1 re-export hooked up cleanly

The v1 module is now reachable from the EVM namespace, which keeps the tree consistent with the other new submodules.

packages/mantrachain-std/src/types/cosmos/evm/crypto/v1/mod.rs (1)

1-1: crypto::v1::ethsecp256k1 exposure confirmed

Glad to see the Ethereum key types exported under the versioned namespace; no issues spotted.

packages/mantrachain-std/src/types/cosmos/evm/crypto/mod.rs (1)

1-1: Top-level crypto::v1 export aligns with new layout

This keeps the crypto tree consistent with the rest of the EVM module additions.

packages/mantrachain-std/src/types/cosmos/epochs/mod.rs (1)

1-2: Epochs modules exported appropriately

module and v1beta1 are now reachable from the root, which matches the new query/types files—looks good.

packages/mantrachain-std/src/types/cosmos/mod.rs (1)

11-21: New Cosmos module exports look consistent

Adding epochs, evm, and protocolpool here keeps the top-level namespace in sync with the new modules introduced in this release. No issues observed.

packages/mantrachain-std/src/types/cosmos/evm/mod.rs (1)

1-6: Module exports look good

The new module declarations surface the expected EVM submodules cleanly. No issues spotted here.

Comment on lines +43 to +47
/// skip_store_keys is an optional list of store keys to skip when constructing the
/// module's keeper. This is useful when a module does not have a store key.
/// NOTE: the provided environment variable will have a fake store service.
#[prost(string, repeated, tag = "11")]
pub skip_store_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Ensure new repeated field deserializes when omitted.

skip_store_keys should stay optional like the proto definition. Without #[serde(default)], older configs missing this key will now error on deserialize. Please add the attribute.

-    #[prost(string, repeated, tag = "11")]
+    #[serde(default)]
+    #[prost(string, repeated, tag = "11")]
     pub skip_store_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/app/runtime/v1alpha1.rs around
lines 43 to 47, the repeated field skip_store_keys is currently missing serde
default handling so deserialization of older configs that omit this key will
fail; add the serde default attribute (#[serde(default)]) to the skip_store_keys
field so it deserializes to an empty Vec when omitted, preserving optional
behavior and backward compatibility.

Comment on lines +63 to +67
/// pre_blockers specifies the module names of pre blockers
/// to call in the order in which they should be called. If this is left empty
/// no pre blocker will be registered.
#[prost(string, repeated, tag = "10")]
pub pre_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Mark pre_blockers optional for serde.

Same concern here: we need #[serde(default)] so legacy JSON lacking pre_blockers (or new configs that don’t use it) still parse.

-    #[prost(string, repeated, tag = "10")]
+    #[serde(default)]
+    #[prost(string, repeated, tag = "10")]
     pub pre_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// pre_blockers specifies the module names of pre blockers
/// to call in the order in which they should be called. If this is left empty
/// no pre blocker will be registered.
#[prost(string, repeated, tag = "10")]
pub pre_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// pre_blockers specifies the module names of pre blockers
/// to call in the order in which they should be called. If this is left empty
/// no pre blocker will be registered.
#[serde(default)]
#[prost(string, repeated, tag = "10")]
pub pre_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/app/runtime/v1alpha1.rs around
lines 63 to 67, the pre_blockers field must be made optional for serde to allow
parsing legacy JSON that omits it; add the serde default attribute to the field
(e.g. #[serde(default)]) so missing pre_blockers deserializes to an empty Vec,
and ensure the serde derive/feature is enabled in this crate so the attribute is
respected.

Comment on lines +25 to +29
/// enable_unordered_transactions determines whether unordered transactions should be supported or not.
/// When true, unordered transactions will be validated and processed.
/// When false, unordered transactions will be rejected.
#[prost(bool, tag = "4")]
pub enable_unordered_transactions: bool,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add serde default for backward compatibility.

This new proto field is optional, but without #[serde(default)], any JSON payload that omits it (older genesis/configs, REST responses) will now fail to deserialize. Please mark it as defaulted so existing data keeps working.

-    #[prost(bool, tag = "4")]
+    #[serde(default)]
+    #[prost(bool, tag = "4")]
     pub enable_unordered_transactions: bool,
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/auth/module/v1.rs around lines 25
to 29, the new boolean field enable_unordered_transactions lacks a serde default
which will break deserialization of older JSON that omits the field; add the
attribute #[serde(default)] to the field definition so missing values
deserialize to false, ensuring backward compatibility with existing
genesis/configs and REST responses.

)]
#[proto_message(type_url = "/cosmos.orm.module.v1alpha1.Module")]
#[proto_message(type_url = "/cosmos.epochs.module.v1.Module")]
pub struct Module {}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Add missing fields to Module.

The new /cosmos.epochs.module.v1.Module message isn’t empty—it defines begin_blockers, end_blockers, and hooks_order. Leaving the struct empty drops those fields from serialization and breaks module wiring.

Bring the struct in line with the proto:

-#[proto_message(type_url = "/cosmos.epochs.module.v1.Module")]
-pub struct Module {}
+#[proto_message(type_url = "/cosmos.epochs.module.v1.Module")]
+pub struct Module {
+    #[prost(string, repeated, tag = "1")]
+    pub begin_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
+    #[prost(string, repeated, tag = "2")]
+    pub end_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
+    #[prost(string, repeated, tag = "3")]
+    pub hooks_order: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub struct Module {}
#[proto_message(type_url = "/cosmos.epochs.module.v1.Module")]
pub struct Module {
#[prost(string, repeated, tag = "1")]
pub begin_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "2")]
pub end_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "3")]
pub hooks_order: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/epochs/module/v1.rs around line 15,
the Module struct is currently empty but must include the proto-defined fields
begin_blockers, end_blockers, and hooks_order; update the struct to add these
fields with appropriate Rust types (e.g., Vec<String> or
Vec<::prost::alloc::string::String> depending on project conventions),
derive/implement the same serialization traits used elsewhere (prost::Message /
serde if applicable), and ensure default/empty vectors are used so
serialization/deserialization matches the proto wire format and preserves module
wiring.

Comment on lines +2 to +47
/// PubKey defines a type alias for an ecdsa.PublicKey that implements
/// CometBFT's PubKey interface. It represents the 33-byte compressed public
/// key format.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey")]
pub struct PubKey {
/// key is the public key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
}
/// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
/// CometBFT's PrivateKey interface.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")]
pub struct PrivKey {
/// key is the private key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Wrong type URLs for Ethermint keys.

The canonical ethsecp256k1 keys still live under ethermint.crypto.v1, not cosmos.evm.crypto.v1. Using the wrong type URLs breaks any Any packing/unpacking against the chain.

Update both declarations:

-#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey")]
+#[proto_message(type_url = "/ethermint.crypto.v1.ethsecp256k1.PubKey")]-#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")]
+#[proto_message(type_url = "/ethermint.crypto.v1.ethsecp256k1.PrivKey")]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// PubKey defines a type alias for an ecdsa.PublicKey that implements
/// CometBFT's PubKey interface. It represents the 33-byte compressed public
/// key format.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey")]
pub struct PubKey {
/// key is the public key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
}
/// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
/// CometBFT's PrivateKey interface.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")]
pub struct PrivKey {
/// key is the private key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
/// PubKey defines a type alias for an ecdsa.PublicKey that implements
/// CometBFT's PubKey interface. It represents the 33-byte compressed public
/// key format.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/ethermint.crypto.v1.ethsecp256k1.PubKey")]
pub struct PubKey {
/// key is the public key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
}
/// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
/// CometBFT's PrivateKey interface.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/ethermint.crypto.v1.ethsecp256k1.PrivKey")]
pub struct PrivKey {
/// key is the private key in byte form
#[prost(bytes = "vec", tag = "1")]
#[serde(
serialize_with = "crate::serde::as_base64_encoded_string::serialize",
deserialize_with = "crate::serde::as_base64_encoded_string::deserialize"
)]
pub key: ::prost::alloc::vec::Vec<u8>,
}
🤖 Prompt for AI Agents
packages/mantrachain-std/src/types/cosmos/evm/crypto/v1/ethsecp256k1.rs lines
2-47: The proto_message type_url values are using the wrong namespace
(/cosmos.evm.crypto.v1...) which breaks Any packing/unpacking; update both
proto_message attributes to use the canonical Ethermint namespace by changing
the type_url strings to /ethermint.crypto.v1.ethsecp256k1.PubKey and
/ethermint.crypto.v1.ethsecp256k1.PrivKey respectively so the generated Any
types match the chain.

Comment on lines +65 to +67
/// failed is true if the eth transaction did not go succeed
#[prost(bool, tag = "5")]
pub failed: bool,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix minor grammar in doc comment

“did not go succeed” → “did not succeed”.

Apply this diff:

-    /// failed is true if the eth transaction did not go succeed
+    /// failed is true if the eth transaction did not succeed
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// failed is true if the eth transaction did not go succeed
#[prost(bool, tag = "5")]
pub failed: bool,
/// failed is true if the eth transaction did not succeed
#[prost(bool, tag = "5")]
pub failed: bool,
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/evm/types/v1.rs around lines 65 to
67, the doc comment for the `failed` field contains awkward grammar ("did not go
succeed"); update the comment text to a concise, correct phrasing such as "did
not succeed" so the comment reads: "failed is true if the eth transaction did
not succeed". Make only the comment change; leave the #[prost] attribute and the
field definition unchanged.

Comment on lines +15 to +74
pub struct ContinuousFund {
/// Recipient is the address string of the account receiving funds.
#[prost(string, tag = "1")]
pub recipient: ::prost::alloc::string::String,
/// Percentage is the percentage of funds to be allocated from Community pool.
#[prost(string, tag = "2")]
pub percentage: ::prost::alloc::string::String,
/// Optional, if expiry is set, removes the state object when expired.
#[prost(message, optional, tag = "3")]
pub expiry: ::core::option::Option<crate::shim::Timestamp>,
}
/// Params defines the parameters for the protocolpool module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.protocolpool.v1.Params")]
pub struct Params {
/// EnabledDistributionDenoms lists the denoms that are allowed to be distributed.
/// This is to avoid spending time distributing undesired tokens to continuous funds and budgets.
#[prost(string, repeated, tag = "1")]
pub enabled_distribution_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// DistributionFrequency is the frequency (in terms of blocks) that funds are distributed out from the
/// x/protocolpool module.
#[prost(uint64, tag = "2")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub distribution_frequency: u64,
}
/// GenesisState defines the protocolpool module's genesis state.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.protocolpool.v1.GenesisState")]
pub struct GenesisState {
/// ContinuousFunds defines the continuous funds at genesis.
#[prost(message, repeated, tag = "1")]
pub continuous_funds: ::prost::alloc::vec::Vec<ContinuousFund>,
/// Params defines the parameters of this module, currently only contains the
/// denoms that will be used for continuous fund distributions.
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Model ContinuousFund fields as numbers.

Both percentage and distribution_frequency are numeric in the proto (sdk.Dec / uint64). Serializing them as strings loses validation and forces callers to massage types. Use the SDK wrappers we already expose (Decimal, u64 via as_str helpers).

Consider:

-    #[prost(string, tag = "2")]
-    pub percentage: ::prost::alloc::string::String,
+    #[prost(string, tag = "2")]
+    pub percentage: ::prost::alloc::string::String, // TODO: replace with Decimal once shim is ready

If Decimal support is pending, drop a TODO and explain why string is required so downstream users aren’t surprised.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub struct ContinuousFund {
/// Recipient is the address string of the account receiving funds.
#[prost(string, tag = "1")]
pub recipient: ::prost::alloc::string::String,
/// Percentage is the percentage of funds to be allocated from Community pool.
#[prost(string, tag = "2")]
pub percentage: ::prost::alloc::string::String,
/// Optional, if expiry is set, removes the state object when expired.
#[prost(message, optional, tag = "3")]
pub expiry: ::core::option::Option<crate::shim::Timestamp>,
}
/// Params defines the parameters for the protocolpool module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.protocolpool.v1.Params")]
pub struct Params {
/// EnabledDistributionDenoms lists the denoms that are allowed to be distributed.
/// This is to avoid spending time distributing undesired tokens to continuous funds and budgets.
#[prost(string, repeated, tag = "1")]
pub enabled_distribution_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// DistributionFrequency is the frequency (in terms of blocks) that funds are distributed out from the
/// x/protocolpool module.
#[prost(uint64, tag = "2")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub distribution_frequency: u64,
}
/// GenesisState defines the protocolpool module's genesis state.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.protocolpool.v1.GenesisState")]
pub struct GenesisState {
/// ContinuousFunds defines the continuous funds at genesis.
#[prost(message, repeated, tag = "1")]
pub continuous_funds: ::prost::alloc::vec::Vec<ContinuousFund>,
/// Params defines the parameters of this module, currently only contains the
/// denoms that will be used for continuous fund distributions.
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
}
pub struct ContinuousFund {
/// Recipient is the address string of the account receiving funds.
#[prost(string, tag = "1")]
pub recipient: ::prost::alloc::string::String,
/// Percentage is the percentage of funds to be allocated from Community pool.
#[prost(string, tag = "2")]
pub percentage: ::prost::alloc::string::String, // TODO: replace with Decimal once shim is ready
/// Optional, if expiry is set, removes the state object when expired.
#[prost(message, optional, tag = "3")]
pub expiry: ::core::option::Option<crate::shim::Timestamp>,
}
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/protocolpool/v1.rs around lines
15–74, the ContinuousFund.percentage field is modeled as String but the proto
uses sdk.Dec (a numeric decimal) and should be represented with the SDK Decimal
wrapper so callers get numeric validation; change the Rust field type from
String to the SDK decimal type (e.g. crate::shim::Decimal or your project’s
Decimal wrapper) and add serde serialize_with/deserialize_with helpers that
read/write it as string (same pattern as distribution_frequency), update imports
accordingly; if Decimal support does not yet exist, leave a TODO comment on the
field explaining why it remains a string and reference the issue tracking
Decimal support so downstream users are aware.

Comment on lines +202 to +216
/// intend for the transaction to be evaluated and executed in an un-ordered
/// fashion. Specifically, the account's nonce will NOT be checked or
/// incremented, which allows for fire-and-forget as well as concurrent
/// transaction execution.
///
/// Note, when set to true, the existing 'timeout_timestamp' value must
/// be set and will be used to correspond to a timestamp in which the transaction is deemed
/// valid.
///
/// When true, the sequence value MUST be 0, and any transaction with unordered=true and a non-zero sequence value will
/// be rejected.
/// External services that make assumptions about sequence values may need to be updated because of this.
#[prost(bool, tag = "4")]
pub unordered: bool,
/// timeout_timestamp is the block time after which this transaction will not
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Add #[serde(default)] to keep TxBody JSON backward-compatible

With the raw bool, serde::Deserialize now requires every JSON TxBody to carry an unordered field. Legacy payloads (which obviously omit it) will fail with missing field 'unordered', breaking existing clients. Please mark the field as defaultable so absent data still deserializes to false.

-    #[prost(bool, tag = "4")]
-    pub unordered: bool,
+    #[serde(default)]
+    #[prost(bool, tag = "4")]
+    pub unordered: bool,
🤖 Prompt for AI Agents
In packages/mantrachain-std/src/types/cosmos/tx/v1beta1.rs around lines 202-216,
the plain bool field `unordered` causes serde::Deserialize to fail on legacy
JSON that omits the field; annotate the field with #[serde(default)] so missing
values deserialize to false, and if necessary enable/confirm serde support in
this crate (or add the serde attribute imports) so the attribute compiles.

Comment on lines +55 to +58
Module::Evm => {
// extract_module_version(&content, "cosmos/evm", "MANTRA-Chain/evm")
Ok("mantra/v0.4.x_main".to_string()) // Temporary hardcode until evm repo tag is ready
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Avoid hardcoding the EVM revision; derive from go.mod with a safe fallback.

Hardcoding "mantra/v0.4.x_main" breaks reproducibility and can drift from Mantrachain’s go.mod. Prefer extracting the version (commit/tag) from go.mod and only fall back to the temporary branch if extraction fails.

Apply this diff:

-        Module::Evm => {
-            // extract_module_version(&content, "cosmos/evm", "MANTRA-Chain/evm")
-            Ok("mantra/v0.4.x_main".to_string()) // Temporary hardcode until evm repo tag is ready
-        }
+        Module::Evm => {
+            // Try to resolve from go.mod first; fallback to temporary branch while tags are not ready.
+            extract_module_version(&content, "cosmos/evm", "MANTRA-Chain/evm").or_else(|e| {
+                info!(
+                    "EVM version not found in go.mod ({}); falling back to temporary branch",
+                    e
+                );
+                Ok("mantra/v0.4.x_main".to_string())
+            })
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Module::Evm => {
// extract_module_version(&content, "cosmos/evm", "MANTRA-Chain/evm")
Ok("mantra/v0.4.x_main".to_string()) // Temporary hardcode until evm repo tag is ready
}
Module::Evm => {
// Try to resolve from go.mod first; fallback to temporary branch while tags are not ready.
extract_module_version(&content, "cosmos/evm", "MANTRA-Chain/evm").or_else(|e| {
info!(
"EVM version not found in go.mod ({}); falling back to temporary branch",
e
);
Ok("mantra/v0.4.x_main".to_string())
})
}

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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (2)

1596-1626: EstimateGas: avoid non-standard query_grpc; use Stargate query and decode cleanly

Current approach depends on a non-standard QuerierWrapper::query_grpc and does extra dance with prost::Message::decode. Use a standard Stargate query and decode via EstimateGasResponse::decode for portability and consistency with the rest of the file.

Apply this diff:

     pub fn estimate_gas(
         &self,
         args: ::prost::alloc::vec::Vec<u8>,
         gas_cap: u64,
         proposer_address: ::prost::alloc::vec::Vec<u8>,
         chain_id: i64,
     ) -> Result<EstimateGasResponse, cosmwasm_std::StdError> {
         let request = EthCallRequest {
             args,
             gas_cap,
             proposer_address,
             chain_id,
         };
 
-        use prost::Message;
-        let resp: Result<EstimateGasResponse, prost::DecodeError> = Message::decode(self.querier.query_grpc(
-            "/cosmos.evm.vm.v1.Query/EstimateGas".to_string(),
-            request.to_proto_bytes().into(),
-        )?
-        .as_slice());
-
-        match resp {
-            Err(e) => Err(cosmwasm_std::StdError::generic_err(format!(
-                "Can't decode item: {}",
-                e
-            ))),
-            Ok(data) => Ok(data),
-        }
+        use prost::Message;
+        let bin: cosmwasm_std::Binary = self.querier.query(&cosmwasm_std::QueryRequest::Stargate {
+            path: "/cosmos.evm.vm.v1.Query/EstimateGas".to_string(),
+            data: request.to_proto_bytes().into(),
+        })?;
+        EstimateGasResponse::decode(bin.as_slice())
+            .map_err(|e| cosmwasm_std::StdError::generic_err(format!("Can't decode item: {}", e)))
     }

1132-1173: Optional: Add proto_query for TxLogs and a VmQuerier helper

For completeness and parity with other queries, consider adding a #[proto_query] to QueryTxLogsRequest and exposing a tx_logs helper in VmQuerier.

Suggested additions:

 #[proto_message(type_url = "/cosmos.evm.vm.v1.QueryTxLogsRequest")]
+#[proto_query(
+    path = "/cosmos.evm.vm.v1.Query/TxLogs",
+    response_type = QueryTxLogsResponse
+)]
 pub struct QueryTxLogsRequest {

And in impl VmQuerier:

pub fn tx_logs(
    &self,
    hash: ::prost::alloc::string::String,
    pagination: ::core::option::Option<super::super::super::base::query::v1beta1::PageRequest>,
) -> Result<QueryTxLogsResponse, cosmwasm_std::StdError> {
    QueryTxLogsRequest { hash, pagination }.query(self.querier)
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 7edf635 and ed813f8.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml (1 hunks)
  • packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Lints
  • GitHub Check: Test Suite
🔇 Additional comments (2)
Cargo.toml (1)

18-18: Workspace dependency bump looks correct.

mantrachain-std now references v0.3.0 at the same local path, matching the crate bump downstream. 👍

packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1)

1210-1227: Clarify dual-use of EthCallRequest for EstimateGas

Both EthCall and EstimateGas gRPC endpoints accept EthCallRequest; only the response types differ. Your manual query for EstimateGas is the right direction given a single request type can’t carry two #[proto_query] annotations.

Please confirm the upstream proto service defines rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse); to ensure request compatibility with the EstimateGas path.

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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1)

98-143: Consider documenting the skipped tag numbers.

The Params struct has sequential tags 1, 4, 5, 7, 8, 9, 10 with gaps at tags 2, 3, and 6. While this might be intentional for protocol compatibility, consider adding a comment explaining the missing tag numbers to prevent confusion during future modifications.

 pub struct Params {
     /// evm_denom represents the token denomination used to run the EVM state
     /// transitions.
     #[prost(string, tag = "1")]
     pub evm_denom: ::prost::alloc::string::String,
+    // Note: tags 2, 3, and 6 are reserved/deprecated for protocol compatibility
     /// extra_eips defines the additional EIPs for the vm.Config
     #[prost(int64, repeated, packed = "false", tag = "4")]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between ed813f8 and 524f2c2.

📒 Files selected for processing (1)
  • packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Lints
🔇 Additional comments (8)
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (8)

1-1: Import organization follows established pattern.

The import for neutron_std_derive::CosmwasmExt is appropriately placed at the beginning of the file and follows the project's established pattern for external derives.


2-37: Well-structured event type definitions.

The event structures (EventEthereumTx, EventTxLog, EventMessage, EventBlockBloom) are properly defined with consistent derive attributes and appropriate proto message annotations. The field documentation is clear and follows Ethereum conventions.


197-303: Comprehensive ChainConfig implementation.

The ChainConfig struct properly implements Ethereum hard fork parameters with appropriate string representations for big integers and includes modern upgrades (Shanghai, Cancun, Prague, Verkle, Osaka). The chain ID alias annotation is a good practice for JSON compatibility.


565-597: Robust enum implementation with proper string conversion.

The AccessType enum is well-implemented with proper string conversion methods. The documentation clearly explains the different access control behaviors.


1533-1594: Well-designed querier wrapper pattern.

The VmQuerier struct provides a clean abstraction over the underlying querier with type-safe methods. The implementation follows established patterns and provides appropriate error handling.


1596-1629: Proper fix for estimate_gas type mismatch.

The estimate_gas method correctly addresses the previous type mismatch issue by manually handling the gRPC query and decoding the response to the proper EstimateGasResponse type. The implementation properly handles encoding/decoding errors and provides meaningful error messages.


1630-1689: Complete querier method implementations.

The remaining querier methods (trace_tx, trace_block, base_fee, config, global_min_gas_price) are properly implemented with appropriate parameter passing and return types. The methods follow the established pattern from the rest of the querier.


1144-1152: Cross-module import is valid: cosmos.base.query.v1beta1 (defining PageRequest/PageResponse) exists in packages/mantrachain-std/src/types/cosmos/base/query/v1beta1.rs, so no changes required.

BigtoMantraDev
BigtoMantraDev previously approved these changes Sep 26, 2025
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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/mantrachain-std/src/lib.rs (1)

1-1: Scope the Clippy allowance to generated modules

Allowing clippy::all at the crate root hides every Clippy warning, including ones coming from hand-written helper code that we still want surfaced. The warnings we care about suppressing are coming from the generated proto surface; let's confine the allowance to that module instead of disabling linting globally.

Apply this diff to limit the allowance to the generated types module:

-#![allow(clippy::all)]
 #![doc = include_str!("../README.md")]
 #![cfg_attr(docsrs, feature(doc_cfg))]
 #![forbid(unsafe_code)]
 #![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)]

 #[allow(deprecated)]
+#[allow(clippy::all)]
 pub mod types;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 524f2c2 and c3f5e01.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • packages/mantrachain-std/src/lib.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test Suite
  • GitHub Check: Lints
🔇 Additional comments (1)
README.md (1)

10-10: LGTM on the new README entry

The added crate row accurately documents mantrachain-std with consistent wording and links. Thanks for keeping the table up to date.

@desamtralized desamtralized merged commit f17c8ca into main Sep 30, 2025
5 checks passed
@desamtralized desamtralized deleted the update-mantrachain-std-v5 branch September 30, 2025 05:05
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