Conversation
WalkthroughAdds 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
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
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
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
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 onneutron_std_derive(e.g. in the rootCargo.tomlor inpackages/mantrachain-std/Cargo.toml) so that everyuse neutron_std_derive::CosmwasmExt;resolves correctly.packages/mantrachain-std/src/types/cosmos/protocolpool/module/v1.rs (1)
2-17: Doc comment now misnames the moduleThe 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: Addblacklist_allhelper and update docs/CHANGELOG
No internal usages ofblacklistwere found—this change is non-breaking in the crate. Add ablacklist_all(&self)wrapper that callsblacklist(None), document thatNonereturns 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 attributeMarking 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 deprecatedconfig()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 aliasMany 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 clonesImproves 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 convenienceThis 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 requestConvenience 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 requestConsistency 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 requestCompletes 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_txandtrace_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&strfor querier methods.The querier API forces callers to allocate
Strings for identifiers, which is inconsistent with other modules and adds churn. Accept anythingInto<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
📒 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 goodThe commit pointer now aligns with the v5 release.
scripts/update-and-rebuild.sh (1)
8-8: Version bump aligns with v5 rolloutSwitching the default to
v5.0.0matches 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 addedMatches 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 — LGTMCorrect type and tag; aligns with Cosmos pagination conventions.
112-115: Pagination added to QueryBlacklistResponse — LGTMUses 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 goodThe 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 consistentType 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 (withprost-derive), where derivingMessagestill impliesDebug; 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 ofprecisebank::v1looks goodThanks for wiring the v1 module; it matches the new
precisebanksurface introduced elsewhere in the PR.packages/mantrachain-std/src/types/cosmos/evm/vm/mod.rs (1)
1-1:vm::v1re-export hooked up cleanlyThe 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::ethsecp256k1exposure confirmedGlad 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-levelcrypto::v1export aligns with new layoutThis 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
moduleandv1beta1are 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 consistentAdding
epochs,evm, andprotocolpoolhere 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 goodThe new module declarations surface the expected EVM submodules cleanly. No issues spotted here.
| /// 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>, |
There was a problem hiding this comment.
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.
| /// 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>, |
There was a problem hiding this comment.
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.
| /// 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.
| /// 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, |
There was a problem hiding this comment.
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 {} |
There was a problem hiding this comment.
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.
| 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.
| /// 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>, |
There was a problem hiding this comment.
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.
| /// 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.
| /// failed is true if the eth transaction did not go succeed | ||
| #[prost(bool, tag = "5")] | ||
| pub failed: bool, |
There was a problem hiding this comment.
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.
| /// 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.
| 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>, | ||
| } |
There was a problem hiding this comment.
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 readyIf 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.
| 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.
| /// 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 |
There was a problem hiding this comment.
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.
| 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 | ||
| } |
There was a problem hiding this comment.
🛠️ 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.
| 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()) | |
| }) | |
| } |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/mantrachain-std/src/types/cosmos/evm/vm/v1.rs (2)
1596-1626: EstimateGas: avoid non-standardquery_grpc; use Stargate query and decode cleanlyCurrent approach depends on a non-standard
QuerierWrapper::query_grpcand does extra dance withprost::Message::decode. Use a standard Stargate query and decode viaEstimateGasResponse::decodefor 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 helperFor completeness and parity with other queries, consider adding a
#[proto_query]toQueryTxLogsRequestand exposing atx_logshelper inVmQuerier.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
⛔ Files ignored due to path filters (1)
Cargo.lockis 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-stdnow 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 EstimateGasBoth 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.
There was a problem hiding this comment.
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
Paramsstruct 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
📒 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::CosmwasmExtis 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
ChainConfigstruct 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
AccessTypeenum 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
VmQuerierstruct 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_gasmethod correctly addresses the previous type mismatch issue by manually handling the gRPC query and decoding the response to the properEstimateGasResponsetype. 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(definingPageRequest/PageResponse) exists inpackages/mantrachain-std/src/types/cosmos/base/query/v1beta1.rs, so no changes required.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/mantrachain-std/src/lib.rs (1)
1-1: Scope the Clippy allowance to generated modulesAllowing
clippy::allat 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
typesmodule:-#![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
📒 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 entryThe added crate row accurately documents
mantrachain-stdwith consistent wording and links. Thanks for keeping the table up to date.
Description and Motivation
Related Issues
Checklist:
Update index.md)just fmt.just lint.Summary by CodeRabbit
New Features
Changes
Breaking Changes