Commit Graph

27 Commits

Author SHA1 Message Date
Chirantan Ekbote 975182acb7 wormchain: Rename "certusone" -> "wormhole-foundation" 2022-10-03 17:34:42 +09:00
Chirantan Ekbote d577b931a4 wormchain: Fix formatting and add to lint.sh 2022-10-03 17:34:42 +09:00
Chirantan Ekbote e2c2ec9749 wormchain: tokenbridge: "Wormhole" -> "Portal" 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 124307140d wormchain: tokenbridge: Don't change registered decimals
Don't allow an AssetMeta payload to change the decimals of a registered
asset as this would cause issues with any unredeemed token transfers.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote d1b6512954 wormchain: tokenbridge: Normalize coins before processing
This lets users use non-base denominations when transferring coins.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 5e7752c74b wormchain: tokenbridge: Send/Burn coins after truncation
Sending or burning coins before truncating the amount would lead to the
user losing the truncated coins.  Only send or burn the coins after
truncation.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote c53813ce37 wormchain: tokenbridge: Clean up coin handling
Use `sdk.Coin` methods as much as possible rather than mixing with
big.Int and uint256.Int.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote ce40d17c74 wormchain: tokenbridge: Use sdk.Coin for transfer fees
Since the transfer amount already uses `sdk.Coin`, use it for fees as
well.  This ensures the fees cannot be negative.

Also add some extra validation for `MsgTransfer` fields and add tests
for the validation checks.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 524520c914 wormchain: wormhole: Fix broken test 2022-10-03 17:34:42 +09:00
Chirantan Ekbote b655e5b19b wormchain: Delete unused errors 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 7fc2f06402 wormchain: client: Delete unused variable 2022-10-03 17:34:42 +09:00
Chirantan Ekbote b5ab6a8833 wormchain: wormhole: Remove nullify call in test
This was overwriting the generated keys and addresses.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 8f70fd1719 wormchain: tokenbridge: Don't register asset meta for unknown chains 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 832a72057d wormchain: tokenbridge: Don't allow self-registration
Don't allow registering an emitter for wormhole chain on wormhole chain.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 5666ee51b5 wormchain: wormhole: Don't allow changes to the consensus guardian set
This would allow a jailed guardian to simply register a new validator
address and bypass the jail.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 727a3e869d wormchain: wormhole: Check for multiple validator registration.
Don't allow a tx signer to register more than one guardian validator.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 2fcfb7f769 wormchain: wormhole: Check for duplicate guardian addresses
When updating the guardian set via a governance action, make sure that
there are no duplicate addresses in the set.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote b38180bf5d wormchain: tokenbridge: Check that the target chain is registered
Ensure that the destination chain has been registered in the tokenbridge
before allowing transfers to it.  This prevents users from accidentally
locking up their tokens in the token bridge by passing in an invalid
chain id.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote d272eee7bc wormchain: tokenbridge: Burn wrapped coins
Previously we would just collect all the coins in the module account,
which isn't necessary for wrapped coins that we minted.  Burn them
instead.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote 3e6b92a1f6 wormchain: tokenbridge: Reject transfers with negative fee 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 317c0cf7c9 wormchain: wormhole: Simplify return in UpdateGuardianSet 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 96c0db86ce wormchain: wormhole: Fix inconsistent comment 2022-10-03 17:34:42 +09:00
Chirantan Ekbote 991c41b46e wormchain: wormhole: Use existing helper functions
Replace a couple of blocks with existing helper functions that do the
same thing.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote a0c25dead2 wormchain: tokenbridge: Check for base denom in GetWrappedCoinMeta
The base denom for wrapped tokens is prefixed with "b".  Check for this
in GetWrappedCoinMeta so that we don't end up treating base denom tokens
as native tokens.
2022-10-03 17:34:42 +09:00
Chirantan Ekbote a66b3ac28c wormchain: tokenbridge: Parse chain id as an unsigned integer
A chain id cannot be negative so parse it using `strconv.ParseUint` to
avoid issues with negative values.
2022-10-03 17:34:42 +09:00
Csongor Kiss 62edb5b5b1 wormchain: Audit items (#11)
* changed minimum governance vaa length check

* remove double write of chain ID in token attest

* removed panics from vaa processing in token bridge

* added non-negative check to fee in transfer tokens

* simplify non-negative check

* make fee sign check nicer in msg_server_execute_vaa

Operationally identical

* 14->13 in proofOfAuthority.md

Co-authored-by: chase-45 <chasemoran45@gmail.com>
Co-authored-by: Csongor Kiss <ckiss@jumptrading.com>
2022-10-03 17:34:42 +09:00
Developer Experience team at Tendermint 879be5bbc6 Add wormhole chain
This is a squashed commit of all the changes in the wormhole_chain
directory from the development branch with the following changes:

 * Replace the vendored cosmos-sdk directory with a replace directive in
   the go.mod file pointing to the wormhole-foundation/cosmos-sdk repo.
 * Update the cosmos-sdk version to v0.45.7.
 * Rename starport -> ignite
 * Update to ignite version 0.23.0
 * Update go version in dockerfile to 1.19.0
 * Upgrade github.com/cosmos/ibc-go v1.2.0 => v1.2.2
 * Upgrade github.com/tendermint/spm v0.1.5 => v0.1.9
 * Add missing module names to the
   SetOrder{BeginBlockers,EndBlockers,InitGenesis} functions.
 * Fix the gentx memo in the genesis.json file.
2022-10-03 17:34:42 +09:00