Commit Graph

110 Commits

Author SHA1 Message Date
A5 Pickle 22e31affe2
sdk/rust: prepare to publish crate (#3849)
* sdk/rust: organize workspace

* sdk/rust: add serde_wormhole to deps

* sdk/rust: serde_wormhole -> wormhole-raw-serde

* sdk/rust: add supported-chains; serde_wormhole -> wormhole-vaas-serde

* cosmwasm: fix deps

* sdk/rust: fix fmt

* sdk/rust: jk

* sdk/rust: add desc

* sdk/rust: rm Cargo.lock

* .github: fix workflow

---------

Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
2024-03-25 14:09:54 -04:00
Jeff Schroeder b175dd43c8
docs: quit the spelling spam typo fix PRs with cspell magic (#3845)
* Add cspell configuration and custom dictionary

The goal is to cut down on both incoming tyops, and well meaning but
spammy tyop fix PRs.

To run cspell locally install it and run:

    cspell '**/*.md' \
        --config cspell.config.yaml \
        --words-only \
        --unique \
        --quiet | sort --ignore-case

* docs: cspell updates

* wormchain: cspell updates

* aptos: cspell updates

* node: cspell updates

* algorand: cspell updates

* whitepapers: cspell updates

* near: cspell updates

* solana: cspell updates

* terra: cspell updates

* cosmwasm: cspell updates

* ethereum: cspell updates

* clients: cspell updates

* cspell updates for DEVELOP document

* github: run cspell github action

* sdk: cspell updates

* github: only run cspell on markdown files

* algorand: EMMITTER --> EMITTER

Suggested-by: @evan-gray

* cspell: removed from dictionary

Suggested-by: @evan-gray

* aptos and node: cspell updates

Suggested-by: @evan-gray

* cosmowasm: doc updates for terra2

Suggested-by: @evan-gray

* algorand: cspell updates

Suggested-by: @evan-gray

* algorand: cspell updates

Suggested-by: @evan-gray

* cspell: updated custom word dictionary

This resorts the dictionary and adds a few new words from the
algorand/MEMORY.md document around varints and integers.

* cspell: sort the dictionary how vscode does it

On macOS the sorting is locale dependent. To do this on macOS, you have
to invert the case, do a character insensitive sort, and then invert the
case again:

    LC_COLLATE="en_US.UTF-8" cspell '**/*.md' --config cspell.config.yaml \
        --words-only \
        --unique \
        --no-progress \
        --quiet \
    | tr 'a-zA-Z' 'A-Za-z' \
    | sort --ignore-case \
    | tr 'a-zA-Z' 'A-Za-z'

This requires the `LC_COLLATE` variable to be set to `en_US.UTF-8`, or it
will not do the right thing.

* docs: grammar clean up

---------

Co-authored-by: Evan Gray <battledingo@gmail.com>
2024-03-20 15:40:02 -04:00
Evan Gray 3a8aec6217 ntt-accountant: update comment and add test 2024-03-15 20:49:23 -04:00
Evan Gray 8ca620b81e ntt-accountant: clean up and add normalize test 2024-03-07 11:04:06 -05:00
Evan Gray 71120245f1 ntt-accountant: update readme 2024-03-07 11:04:06 -05:00
Evan Gray 41e0b9accd ntt-accountant: improved relayer parsing test 2024-03-07 11:04:06 -05:00
Evan Gray fca76d14f5 ntt-accountant: remove commented tests, leave TODOs 2024-03-07 11:04:06 -05:00
Evan Gray dbc1bf6955 sdk/rust: shared accountant ModificationKind 2024-03-07 11:04:06 -05:00
Evan Gray 02e37667ff cosmwasm: functional ntt-accountant contract 2024-03-07 11:04:06 -05:00
Evan Gray 6aea705f0c ntt-accountant: copy from global-accountant
Change-Id: Ib27ad40c4c8cb1ab36391a0cbb1b79f1c711d0e3
2024-03-07 11:04:06 -05:00
Bing Yu 738a68a543
cosmwasm: accounting: change str.try_into().unwrap() to str.into() because conversion is infallible… (#3623)
Signed-off-by: bingyuyap <bingyu.yap.21@gmail.com>
2024-01-04 00:39:00 +08:00
Evan Gray 09d18801fd terra: update devnet address 2023-12-13 11:45:07 -05:00
Evan Gray 094a404902 tilt: remove additional root CA support 2023-12-12 14:22:05 -06:00
Evan Gray 69dbfb7c30 ci: fix terra2 test 2023-12-11 11:53:57 -05:00
Csongor Kiss 9a46b2e317 cosmwasm/Dockerfile: fix target cache
the cosmwasm optimizer script builds to the root directory
2023-12-06 20:40:17 +00:00
Steve 745351199b
Tokenfactory metadata display fix (#3337)
* Add tests for ibc-translator contract

* Tokenfactory metadata symbol fix: if symbol is empty when registering an
asset, populate tokenfactory's metadata symbol with the denom with
exponent string so it is not empty.

* Tokenfactory metadata display fix: use denom with exponent for this
string instead of base denom.
2023-11-14 14:46:09 -08:00
Steve fcd41cf883
Tokenfactory metadata symbol fix (#3336)
* Add tests for ibc-translator contract

* Tokenfactory metadata symbol fix: if symbol is empty when registering an
asset, populate tokenfactory's metadata symbol with the denom with
exponent string so it is not empty.

---------

Co-authored-by: Nikhil Suri <nikhilsuri@comcast.net>
2023-11-14 12:43:01 -08:00
Nikhil Suri 11bc1a5a91
cosmwasm: fix ibc-translator reply tests (#3521) 2023-11-13 17:17:47 -08:00
Steve ac9ff33b39
Add tests for ibc-translator contract (#3301) 2023-11-13 11:33:46 -08:00
Nikhil Suri 9c678e1db7
cosmwasm: update packet timeout comment in ibc-translator contract (#3510) 2023-11-13 11:29:38 -08:00
Nikhil Suri ff970b5cad cosmwasm: ibc-translator: increase packet timeout to 1 year 2023-10-27 00:25:14 -04:00
Csongor Kiss 299427087c
cosmwasm/global-accountant: fix clippy warning (#3432) 2023-10-10 14:59:31 -05:00
Csongor Kiss 512e507081 cosmwasm: run cargo fmt using new stable 1.72.0
commit-id:cb70a6c2
2023-08-25 10:39:21 -05:00
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
Paul Noel 1badc908f5 cosmwasm: fix terra2 test 2023-06-13 07:51:38 -05:00
heyitaki 0ecc427d6f docker: build CLI in shared image
Co-authored-by: Evan Gray <battledingo@gmail.com>
2023-06-01 15:33:07 +01:00
bruce-riley 1514d7cd79
Scripts: For upgrading testnet (#2984) 2023-05-26 08:29:14 -05:00
Kevin Peters 1937691afe terra2: Fix broken CI tests due to LocalTerra v2.4.0 update
LocalTerra was updated to v2.4.0 and the LCD no longer returns
HTTP errors on some transaction failures (not enough gas still returns
an HTTP error). This caused some of the integration tests to break, because
the typescript SDK would throw on those HTTP errors.

https://github.com/terra-money/LocalTerra/releases/tag/v2.4.0
2023-05-25 13:14:10 -04:00
Nikhil Suri f6f93bf35e
tilt: devnet deployment for ibc generic messaging (#2593)
* Tilt devnet deployment for ibc generic messaging

* Address review comments from kcsongor and hendrikhofstadt

* Add IBC channel whitelist updates to wormchain and terra devnet deploy scripts

* VAAs had guardian set index three instead of zero

* ci: update addresses

* Remove message.block_height and message.tx_index from attributes

* Remove unnecessary contracts from terra2 devnet deployment

* Update wormhole-ibc address on terra2

* Update wormhole-ibc guardian set on terra2 devnet deployment

* IBC relayer testnet deployment fixes

* Wormchain update whitelist fix

---------

Co-authored-by: Bruce Riley <briley@jumptrading.com>
Co-authored-by: Evan Gray <battledingo@gmail.com>
2023-05-18 18:56:18 -04: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 842462fd78
cosmwasm: remove terraswap dependency (#2739)
* cosmwasm: remove terraswap dependency

* add test to ensure serialization is the same
2023-05-04 07:56:01 -07:00
Nikhil Suri c5df4dbfe6
cosmwasm: token bridge: add new CompleteTransferResponse struct as data to complete_transfer executions (#2653) 2023-04-20 07:13:49 -07: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
Nikhil Suri 8837a9af50
cosmwasm: bump k256 dependency to 0.11 (#2630)
* cosmwasm: add test for keys_equal

* cosmwasm: bump k256 from 0.9.4 to 0.11

* Update bad_signature tests to use new error messages
2023-04-14 15:04:49 -05:00
Nikhil Suri 56b847c41d
cosmwasm: clean up unused dependencies (#2629) 2023-04-13 12:34:08 +01:00
Conor Patrick 26839604c8 accountant: export governance modules from sdk to double check in contract 2023-03-16 08:48:25 -05:00
Conor Patrick 6324a239f9 accountant: address comments from #2513 2023-03-16 08:48:25 -05:00
Conor Patrick 3a1bc456e3 accountant: separate modify_balance into separate module and check test errors 2023-03-16 08:48:25 -05:00
Evan Gray c07cba2836 cosmwasm: acct: fix emitter requirements 2023-03-10 14:44:17 -06:00
Conor Patrick a64e4717de accountant: review comments 2023-02-27 08:52:42 -06:00
Conor Patrick 7c5bdb1863 accountant: remove double keccak for submitting observations 2023-02-27 08:52:42 -06:00
Conor Patrick b35480f966 accountant: address review comments for modify governance vaa 2023-02-15 06:23:25 -08:00
Conor Patrick a3a8e3ea87 accountant: use token bridge governance vaa to make modifications 2023-02-15 06:23:25 -08:00
A5 Pickle ce9c70682c cosmwasm: add prefix handling for observations verification 2023-01-31 21:16:18 -05:00
A5 Pickle 1b40fdb7b9 cosmwasm: fix clippy error 2023-01-26 18:36:03 -06:00
Chirantan Ekbote 9f0109388a cosmwasm: accountant: Allow transfers on the same chain
While sending tokens to another address on the same chain via wormhole
is quite inefficient, it's not strictly disallowed and we do have some
VAAs on solana that do this.  Explicitly check for this case and allow
it.

There are no restrictions on native tokens sent in this way but wrapped
transfers are still subject to some checks: the wrapped account for
the token must exist and it must have a balance larger than the amount
being transferred.  If either of those checks fails then that means
that the sender acquired some wrapped tokens that did not go through
the accountant and so that transfer should be blocked and require manual
intervention.
2023-01-26 09:35:43 -05:00
Chirantan Ekbote dd95954fc3 cosmwasm: Rename accounting -> accountant
Also change wormchain -> global.
2023-01-23 16:42:47 -05:00
Chirantan Ekbote 1f8055adfa cosmwasm: accounting: Use hex-encoding for TokenAddress
Use hex rather than base64 when serializing / deserializing
`TokenAddress` so that it's more consistent with the other address
types.
2023-01-23 14:27:08 -05:00
Chirantan Ekbote 1e3356b4c9 cosmwasm: accounting: Don't store Observation on-chain
Now that we can calculate the digest of an Observation there's no need
to store the whole thing on-chain.  Instead only store the observation
digest, tx_hash, and emitter chain (the tx_hash is necessary because
it's not included in the digest and the emitter chain is used for
servicing missing observation queries).  When adding new observations
we can check for equality by comparing the digests and tx hashes rather
than comparing the whole object.

This should further reduce the size of the on-chain state.
2023-01-23 14:27:08 -05:00
Chirantan Ekbote 2ee213254f cosmwasm: accounting: Don't store signature data on-chain
When submitting observations to the accounting contract, clients sign
the entire batch once.  There's no point storing this signature in the
on-chain data for each observation because it's already stored as part
of the chain's transaction history and the signature would be different
if an observation was submitted as part of a different batch (or the
same batch in a different order) even if the observation itself didn't
change.

Also, nothing actually made use of this signature data.  (Yes,
technically it was returned by some queries but the usefulness of
the signature by itself is questionable without the full batch of
observations that were signed).

All we really care about is the index of the guardian anyway so use
a bitset to keep track of the indices of all the guardians that have
signed an observation.  We use a u128 for the bitset out of an abundance
of caution in case the number of guardians increases in the future.
Dealing with more than 128 guardians is left as a problem for future
wormhole contributors if we ever get to that point.
2023-01-23 14:27:08 -05:00