Commit Graph

12 Commits

Author SHA1 Message Date
Steve 821a6e8752
Add ibc-translator contract to the cosmwasm workspace and it's governance packet to the rust sdk. (#3174)
* Add ibc-translator contract and it's governance packet to the rust sdk.

* Remove unnecessary cargo script

* rustfmt and clippy fixes

* Address review comments

* Use WormholeQuery instead of contract to verify vaa, remove wormhole
core contract dependency, remove feature flag on anybuf.

* Add cw20 token metadata to tokenfactory metadata

* Change Simple/ContractControlled payloads to
GatewayTransfer/GatewayTransferWithPayload

* Change display and scaled denom to ensure x/bank conformance.
2023-08-10 07:08:22 -07:00
Nikhil Suri 892274ffa4
cosmwasm: ibc contracts (#2591)
* cosmwasm: add wormchain-ibc-receiver and wormhole-ibc contracts

* Address review comments from jynnantonix and hendrikhofstadt

* Fix lint errors and test failures

* Update naming to reflect new mapping of channelId -> chainId

* Return errors in ibc handlers that should never be called

* Remove contract name and version logic from migration handlers

* Add query handlers to wormhole-ibc contract

* Add wormchain channel id whitelisting to wormhole-ibc contract

* Increase packet timeout to 1 year

* Rebase on main, update imports to new names

* Add governance replay protection to both contracts

* wormhole_ibc SubmitUpdateChannelChain should only handle a single VAA

* better error messages

* Better logging and strip null characters from channel_id from governance VAA

* add brackets back for empty query methods

* Update Cargo.lock

* Only send wormhole wasm event attributes via IBC and add attribute whitelist on the receiver end

* tilt: fix terra2 deploy

* Update based on comments from jynnantonix

---------

Co-authored-by: Evan Gray <battledingo@gmail.com>
2023-05-18 07:34:15 -04:00
Nikhil Suri d7b6be7358
Cosmwasm package naming updates (#2641)
* sdk: update wormhole-core to wormhole-sdk and fix lib name to be wormhole_sdk

* cosmwasm: update wormhole and token bridge cosmwasm package/lib names

* Fix terra2 deployment script with new artifact names
2023-04-18 09:31:38 -07:00
Chirantan Ekbote dd95954fc3 cosmwasm: Rename accounting -> accountant
Also change wormchain -> global.
2023-01-23 16:42:47 -05:00
Chirantan Ekbote 3c914c725a cosmwasm: Add cw_transcode crate
The cw_transcode crate provides a way to transcode any arbitrary rust
struct into a `cosmwasm_std::Event` via that struct's `Serialize` impl,
ensuring that the event attribute values are encoded as proper json.

This will make it easier for client code to parse the event back into
structured data without having to write custom parsing code for each
individual event type.
2023-01-12 10:29:29 +09:00
Chirantan Ekbote 25abafc753
cosmwasm: Add wormchain-accounting contract (#1920)
* sdk/rust: Move profile settings to workspace

* sdk/rust: Add serde_wormhole crate

The serde_wormhole crate implements the wormhole wire format as a serde
data format.  This will let us replace all the hand-rolled
serialization with auto-generated code, which is less error-prone and
easier to review.

* sdk/rust: Add serde-based struct defintions

Refactor the core crate to add serde-based struct definitions for the
various messages used by the different wormhole smart contracts.  This
will also make it easier to use alternate data formats (like json) for
client-side tooling.

Co-authored-by: Reisen <reisen@morphism.org>

* sdk/rust: Drop references to `de::Unexpected`

The `de::Unexpected` enum from serde has a `Float(f64)` variant.
Referencing this enum anywhere in the code will cause the compiler to
emit its `fmt::Display` impl, which includes an `f64.load` instruction
on wasm targets.  Even if this instruction is never executed, its mere
existence will cause cosmos chains to reject any cosmwasm contract that
has it.

Fix this by removing all references to `de::Unexpected`.

* cosmwasm: Use cargo resolver version "2"

Enable the new feature resolver for the entire workspace.  This
prevents features that are enabled only for dev builds from also being
enabled in normal builds.

* Move cosmwasm Dockerfile to root directory

The cosmwasm contracts now also depend on the rust sdk so the docker
build context needs to be set to the root directory rather than the
cosmwasm/ directory.

* cosmwasm: Add wormchain-accounting contract

This contract implements tokenbridge accounting specifically for the
wormchain environment.

Fixes #1880.

* cosmwasm/accounting: Drop references to `de::Unexpected`

The `de::Unexpected` enum from serde has a `Float(f64)` variant.
Referencing this enum anywhere in the code will cause the compiler to
emit its `fmt::Display` impl, which includes an `f64.load` instruction
on wasm targets.  Even if this instruction is never executed, its mere
existence will cause cosmos chains to reject any cosmwasm contracts that
contain it.

Fix this by removing references to `de::Unexpected`.

Co-authored-by: Reisen <reisen@morphism.org>
2022-12-14 12:06:45 -05:00
Chirantan Ekbote c5925f1467 cosmwasm: Add core accounting package
The accounting package implements the reusable, chain agnostic part of
tokenbridge accounting.

Part of #1880.
2022-11-30 16:34:22 +09:00
Chirantan Ekbote b1fce660c8 cosmwasm: Add wormhole-bindings package
This package defines the bindings into the native wormhole module on
wormchain.

Part of #1880 and #1881.
2022-11-29 08:18:56 +09:00
Chirantan Ekbote aad0a2bf47 cosmwasm: Override local deps at the workspace level
Put all the local overrides at the workspace level rather than having
to specify the path in each individual crate.  This will also make it
easier for us to publish to crates.io when that time comes.
2022-11-11 09:46:33 -05:00
Csongor Kiss c22d0c222b cosmwasm: Add shutdown feature flag to token bridge 2022-09-27 07:58:28 -05:00
Evan Gray db0fc219aa cosmwasm: terra2 support
Co-authored-by: Csongor Kiss <ckiss@jumptrading.com>
2022-06-21 10:03:57 -04:00
Evan Gray c7d8075555 cosmwasm: initialize 2022-06-21 10:03:57 -04:00