Skip to content

Conversation

@enriquesouza
Copy link
Contributor

@enriquesouza enriquesouza commented Apr 18, 2025

Summary

This PR adds support for signing CosmWasm MsgInstantiateContract transactions on Cosmos SDK–based chains.

Changes

  • Added protobuf message: cosmwasm.wasm.v1.MsgInstantiateContract
  • Implemented message struct and encoder: wasm_message_instantiate_contract.rs
  • Integrated support into Cosmos transaction builder
  • Added test coverage with real data: sign_wasm_contract.rs

Notes

  • This supports CosmWasm contracts such as those used by Thorchain or Kujira.
  • Test vectors are based on actual chain data and signatures verified against broadcasted transactions.

Tests

  • The test is covered successfully and broadcasted to blockchain

Previous PR closed

  • It was closed because after compiling the C++ it included hundreds of .make files and after trying to remove them it rebased and added 98 files that were not mine.

#4355

@enriquesouza enriquesouza mentioned this pull request Apr 18, 2025
5 tasks
@enriquesouza enriquesouza changed the title Wasm instantiate contract fixed Support for signing wasm/MsgInstantiateContract transactions Apr 18, 2025
@satoshiotomakan
Copy link
Collaborator

Hi @gupnik, could you please take a look?

gupnik
gupnik previously approved these changes Apr 22, 2025
Copy link
Collaborator

@gupnik gupnik left a comment

Choose a reason for hiding this comment

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

Hi @enriquesouza, thanks for the PR. There's a minor formatting issue. Could you fix that please?

@enriquesouza
Copy link
Contributor Author

Hi @enriquesouza, thanks for the PR. There's a minor formatting issue. Could you fix that please?

Sorry. I missed that. Where is it?

@satoshiotomakan
Copy link
Collaborator

Hi @enriquesouza, you can run cargo fmt

@enriquesouza
Copy link
Contributor Author

Hi @enriquesouza, you can run cargo fmt

Done.

@gupnik
Copy link
Collaborator

gupnik commented Apr 30, 2025

Hi @enriquesouza, you can run cargo fmt

Done.

Thanks @enriquesouza but it still continues to fail: https://github.com/trustwallet/wallet-core/actions/runs/14736373444/job/41403605555?pr=4368

…ouza/wallet-core into wasm_instantiate_contract_fixed
@enriquesouza
Copy link
Contributor Author

Hi @enriquesouza, you can run cargo fmt

Done.

Thanks @enriquesouza but it still continues to fail: https://github.com/trustwallet/wallet-core/actions/runs/14736373444/job/41403605555?pr=4368

It should be ok now I've also run

cargo run --check

@gupnik
Copy link
Collaborator

gupnik commented May 2, 2025

Hi @enriquesouza, you can run cargo fmt

Done.

Thanks @enriquesouza but it still continues to fail: https://github.com/trustwallet/wallet-core/actions/runs/14736373444/job/41403605555?pr=4368

It should be ok now I've also run

cargo run --check

Thanks @enriquesouza but it seems that we now have a minor clippy warning. Could you please take a look at that as well?

https://github.com/trustwallet/wallet-core/actions/runs/14755148818/job/41521615223?pr=4368

@enriquesouza
Copy link
Contributor Author

enriquesouza commented May 5, 2025

Hi @enriquesouza, you can run cargo fmt

Done.

Thanks @enriquesouza but it still continues to fail: https://github.com/trustwallet/wallet-core/actions/runs/14736373444/job/41403605555?pr=4368

It should be ok now I've also run

cargo run --check

Thanks @enriquesouza but it seems that we now have a minor clippy warning. Could you please take a look at that as well?

https://github.com/trustwallet/wallet-core/actions/runs/14755148818/job/41521615223?pr=4368

Funny bc I removed that days ago
ff1f177

This is what I get:

 ./tools/rust-lint 


Check code formatting
Check Clippy warnings
    Checking tw_number v0.1.0 (/wallet-core/rust/tw_number)
error: manually reimplementing `div_ceil`
   --> tw_number/src/u256.rs:145:23
    |
145 |         U256::BYTES - (self.0.bits() + 7) / 8
    |                       ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `self.0.bits().div_ceil(8)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
    = note: `-D clippy::manual-div-ceil` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_div_ceil)]`

error: could not compile `tw_number` (lib) due to 1 previous error

Copy link
Collaborator

@gupnik gupnik left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

LGTM

@satoshiotomakan satoshiotomakan merged commit 302938c into trustwallet:master May 5, 2025
12 checks passed
zkrypt-crossbar pushed a commit to Cramiumlabs/wallet-core that referenced this pull request Jun 15, 2025
…wallet#4368)

* my tracked commit

* MsgInstantiateContract

* revert formatting

* test

* Tests fixes and broadcast

* cargo fmt

* remove unused

---------

Co-authored-by: gupnik <mail.guptanikhil@gmail.com>
zkrypt-crossbar pushed a commit to Cramiumlabs/wallet-core that referenced this pull request Jun 21, 2025
…wallet#4368)

* my tracked commit

* MsgInstantiateContract

* revert formatting

* test

* Tests fixes and broadcast

* cargo fmt

* remove unused

---------

Co-authored-by: gupnik <mail.guptanikhil@gmail.com>
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