-
Notifications
You must be signed in to change notification settings - Fork 0
feat(chain): unify key safety and expand tx primitives beyond Cascade #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b05055e
feat(chain): unify key handling and add generic tx/simulate helpers
mateeullahmalik 4df7eb4
feat(chain): add tx event extraction and simulated gas signing path
mateeullahmalik 09a1440
fix(ci): address PR review issues and sequence retry path
mateeullahmalik 10f979d
fix(ci): resolve review findings and bump rustls-webpki for audit
mateeullahmalik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # sdk-rs chain expansion feasibility (vs sdk-go) | ||
|
|
||
| ## Scope requested | ||
| 1) Safe/unified key handling for tx signing + message signing. | ||
| 2) Expand beyond Cascade into stronger chain interactions (account info, fees, tx sending, tx confirmation). | ||
|
|
||
| ## Feasibility verdict | ||
| **Feasible now with current Rust stack** (`cosmrs`, `tendermint-rpc`, `reqwest`). | ||
| No blocker found for parity on the requested baseline. | ||
|
|
||
| ## What exists in sdk-rs today | ||
| - Action params and action-fee query (REST). | ||
| - Register-action tx flow with signing and sequence retry. | ||
| - sn-api upload/download orchestration. | ||
|
|
||
| ## Gaps relative to sdk-go baseline | ||
| - No dedicated identity/key module (key derivation duplicated in examples). | ||
| - No explicit signer/address mismatch guard in tx path. | ||
| - Fee handling in tx path was static/fixed (not parsed from configured gas price). | ||
| - No generic tx lookup + wait-for-confirmation utility. | ||
| - No explicit account-info public API. | ||
|
|
||
| ## What was implemented in this step | ||
| - Added `src/keys.rs`: | ||
| - `SigningIdentity::from_mnemonic(...)` (single source for tx + arbitrary signing keys). | ||
| - `validate_address(...)` and `validate_chain_prefix(...)`. | ||
| - `derive_signing_keys_from_mnemonic(...)` helper for existing flows. | ||
| - Updated `src/chain.rs`: | ||
| - Added signer-vs-creator precheck (`validate_signer_matches_creator`). | ||
| - Added `get_account_info(address)`. | ||
| - Added `calculate_fee_amount(gas_limit)` from configured gas price. | ||
| - Replaced fixed tx fee with gas-price-derived fee. | ||
| - Added `get_tx(tx_hash)` and `wait_for_tx_confirmation(tx_hash, timeout_secs)`. | ||
| - Added generic tx path: `build_signed_tx(...)`, `broadcast_signed_tx(...)`, `send_any_msgs(...)`. | ||
| - Added gas simulation + adjusted signing flow: `simulate_gas_for_tx(...)`, `build_signed_tx_with_simulation(...)`. | ||
| - Added common Lumera wrapper: `request_action_tx(...)`. | ||
| - Added broadcast mode support: `Async`, `Sync`, `Commit`. | ||
| - Refactored examples (`golden_devnet`, `ui_server`) to use centralized key derivation helper. | ||
|
|
||
| ## Next parity steps (recommended) | ||
| 1. Add richer tx result/event extraction helpers for action/general events. | ||
| 2. Add integration tests for signer/address mismatch and tx wait timeout behavior. | ||
| 3. Add convenience wrappers for more common Lumera msgs on top of generic tx path. | ||
|
|
||
| ## Validation done | ||
| - `cargo check`: pass | ||
| - `cargo test --lib`: pass (13 tests) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function body now delegates to
derive_signing_keys_from_mnemonic, but the file still importsbip32::{DerivationPath, XPrv},bip39::Mnemonic, andstd::str::FromStr(lines 4, 17-18) which were only used by the old inline derivation logic. These are now dead imports and will trigger compiler warnings (or errors under#[deny(unused_imports)]).Fix it with Roo Code or mention @roomote and request a fix.