Commit Graph

2758 Commits

Author SHA1 Message Date
Kevin Peters 6f4dd461f0 clients/js: postVaaSolana remove retry limit 2023-01-11 12:44:03 -05:00
Hendrik Hofstadt 9b50158a3f
add: safety check against signatory being address(0) (#2021)
* add: safety check against signatory being address(0)

Change-Id: I0e0b32c9d9b8501cfe57b8c672441314774c009f

* evm: add revert message and fix tests

Co-authored-by: Rasul <rasul.yunusov282750@gmail.com>
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
2023-01-11 18:32:48 +01:00
tbjump 1e6aa2b48e
Update SECURITY.md (#2206) 2023-01-11 07:01:15 -08:00
Nikhil Suri 42b0e00dc8 ci: fix wormchain build ignite cli issue 2023-01-10 15:26:57 -06:00
Hendrik Hofstadt fc64658ce8
node: add admin command to sign existing VAAs (#2183)
* node: add admin command to sign existing VAAs

Change-Id: Ia59c077db1817a3f35ec30544c307448e01455ca

* node: add tests for signing of existing VAAs

Change-Id: I16fca1181fc9d96abb4ebdfad91bc686da517090
2023-01-10 17:54:35 +01:00
bruce-riley f41eebe0b3
Node: EVM watcher tests, phase1 (#1915)
* Node: EVM watcher tests, phase1

Change-Id: I8bbcebc52e3a4e70dda8ea5b53001a2b913c7f9a

* Update optimism tests to match latest code

Change-Id: Ib19c815e80d821c2df7ffc416ab3b8b6f2b91b18

* Clean up poller test

Change-Id: I4176ceacefe781d22174e91815309188b31ccf6a

* Node: rework for evm watcher tests

Change-Id: Idc7bbe4a95402e8af536cef53a4dd2daaa181de1

* Node: More evm watcher test rework

Change-Id: Ibb6466cf425b07bb771a51a3d2131bce73e0dd97

* Node: fix lint errors in evm watcher tests

Change-Id: I6d62cb35c43b20d36c72824fb17a0b4c912fe504

* Node: Fix lint errors in evm tests

Change-Id: Iadd08bd294dc2c6206e04217ef06836507edf1ec
2023-01-05 07:39:33 -06:00
Josh Siegel 0872f4ff16 algorand/recover: format fix 2023-01-05 05:05:40 -06:00
Josh Siegel b3d2f838cd algorand/recover: Address #2192 2023-01-05 05:05:40 -06:00
Josh Siegel 04ed27cb3f node: Simplify WrapWithScissors and make AlgorandWatcher use it 2023-01-05 05:05:40 -06:00
Chirantan Ekbote 72e3a103b8 cosmwasm: accounting: Identify failed transfer in batch
When we fail to handle an observation in a batch, include the transfer
key as part of the error context so that it's easier to figure out which
observation caused the error.
2023-01-05 16:24:58 +09:00
Josh Siegel 4ddeca4dbd node: switch to use recovery and cleanly restart watcher 2023-01-04 13:49:32 -06:00
Chirantan Ekbote 5d8072e3da cosmwasm: accounting: Change error message for duplicate observation
Change the error message when handling duplicate observations from
"message already processed" -> "transfer already committed".
2023-01-04 16:17:54 +09:00
Chirantan Ekbote e3192a09b1 cosmwasm: accounting: Add query for missing observations
Add a query for guardians to check if there are any pending transfers
with missing observations.  The guardians can use this information to
trigger re-observations of those transactions.
2023-01-04 16:17:37 +09:00
Chirantan Ekbote e05176c9be sdk/rust: Remove `expiration_time` from `GuardianSetInfo`
This field doesn't actually appear in `GuardianSetUpgrade` governance
messages and was already being skipped by serde so just remove it
completely.  Contracts that need to keep track of this information can
encapsulate the `GuardianSetInfo` inside another struct that has an
`expiration_time` field.
2023-01-04 16:17:14 +09:00
Chirantan Ekbote 3a1dd9eccd sdk/rust: Simplify quorum calculation
Also add tests.
2023-01-04 16:17:14 +09:00
Chirantan Ekbote ab172b4da5 sdk/rust: Ensure chain conversions are isomorphic
Ensure that converting `Chain` to/from a u16 or to/from a string is
always isomorphic.  This requires changing the `FromStr` impl so that in
can handle strings like "Unknown(27)".
2023-01-04 16:17:14 +09:00
Chris Sentman 0f066614b3 sdk: tests for vaa.UnmarshalBody()
Full coverage save for a non-empty payload read error.
2023-01-03 09:59:56 -05:00
Chris Sentman 66c8399dcb sdk: test ChainID.String()
Completing coverage for method.
2023-01-03 09:59:56 -05:00
Jeff Schroeder bc1edba32c sdk: full test coverage of ChainID.FromString()
The optimism coverage was a lie as it wasn't explicitly tested.
2023-01-03 09:59:56 -05:00
Jeff Schroeder 2b6ede0d54 sdk: test vaa.Address.UnmarshalJSON()
Full coverage including the error condition.
2023-01-03 09:59:56 -05:00
Jeff Schroeder 6ea4cf054a sdk: test BodyWormchainInstantiateContract.Serialize()
This completes full test coverage of sdk/vaa/payloads.go!
2023-01-03 09:59:56 -05:00
Jeff Schroeder a2857e3b1d sdk: test BodyWormchainStoreCode.Serialize() 2023-01-03 09:59:56 -05:00
Jeff Schroeder 1cc177bf64 sdk: cleanup vaa payloads test
Less duplication of the addr.
2023-01-03 09:59:56 -05:00
Jeff Schroeder 7a439e4cfd sdk: BodyTokenBridgeRegisterChain.Serialize() test
* Switch the BodyTokenBridgeRegisterChain.Serialize() test to table driven
  and add coverage for the panic condition.
2023-01-03 09:59:56 -05:00
Jonathan Claudius 98c843e85d
sdk: Add unit-tests for quorum calculation (#2127)
* sdk: Add unit-tests for quorum calculation

* sdk: fix go imports error

* node: remove duplicate sdk unit-test
2022-12-27 13:27:47 -05:00
Kevin Peters a7be5a639c sdk/js: 0.9.8 version bump 2022-12-22 12:57:20 -06:00
Kevin Peters 88e0c6cddf sdk/js: Use BN.toArrayLike for compatibility with browserify and similar tools.
Fixes this error when calling `deriveWrappedMintKey` in the browser:
TypeError: (intermediate value).toBuffer is not a function
2022-12-22 12:57:20 -06:00
Conor Patrick e5a9ef78d1 wormchain: update new mainnet genesis 2022-12-22 09:34:27 -06:00
Conor Patrick 2273ed54cb wormchain: update cosmos-sdk to disable 0 delegation invariant check 2022-12-22 09:34:27 -06:00
heyitaki b7d870efcb docker: reorganize dockerfiles 2022-12-21 10:58:22 -08:00
Kevin Peters 49de9ef8f2 sdk/js: 0.9.7 version bump 2022-12-21 11:05:40 -06:00
Hendrik Hofstadt 6c7d44ca85
ci: Fix flaky solana tests and improve CI time (#2148)
* solana: remove sync from tests

Change-Id: I8c123ea87e78732541e5040e8653bc114ce95404

* ci: cache more rust build artifacts

Change-Id: I436f27de38651cdb2a9c73b58f20d44b4392c336
2022-12-21 14:24:50 +01:00
guibescos 43035fcc44
sdk/js: Add instruction decoder to solana (#2095)
* Bump package

* Refactor coder add decoder

* Refactor

* Fix

* Fix u64

* Simplify encode

* Add comment

* Fix verify signatures

* Fix package lock

* Revert "Fix package lock"

This reverts commit 9f219bc6fc21d2d0f8bf33fedafd6c204a00e659.

* Fix deps

* Fix import for bs58
2022-12-21 06:35:37 -05:00
Chirantan Ekbote d53085abec cosmwasm: accounting: Include digests in transfer queries
When querying transfer details, return the digest in addition to the
details of the tokens being transferred.
2022-12-21 13:59:01 +09:00
Chirantan Ekbote d6dadb195a cosmwasm: accounting: Remove `InstantiateMsg`
Now that we're keeping track of transfer digests, initializing any on-
chain state through the `InstantiateMsg` doesn't make a lot of sense:
any state initialized this way is unverified and this message doesn't
contain enough information to generate the transfer digests.

Rather than trying to add in the necessary fields, just drop the message
completely since it won't be used in production.  It's currently only
used to initialize on-chain state for tests but the same thing can be
accomplished through the `ModifyBalance` and `SubmitVAAs` methods.
2022-12-21 13:59:01 +09:00
Chirantan Ekbote 29d28a75c0 cosmwasm: accounting: Store transfer digests
Keep track of the digests of committed transfers so that they can be
used later when handling duplicate observations / VAAs.  When processing
an observation or VAA with the same (chain, address, sequence) tuple as
a committed transfer, return a "message already processed" error when
the digests match and a "digest mismatch" error when they don't.  The
latter implies a very serious issue because transfer details shouldn't
change once they have been observed by a quorum of guardians.
2022-12-21 13:59:01 +09:00
Chirantan Ekbote b400a2d51d sdk/rust: Add test for digest calculation
Add a test to ensure that calculating the digest from the structured
body, serialized data, or partial body + serialized payload all give the
same result.
2022-12-21 13:59:01 +09:00
Nikhil Suri 79d3013336 wormchain: remove redundant guardian key arg in register-account-as-guardian msg handler 2022-12-20 14:58:49 -06:00
Chirantan Ekbote acc3ec14d8 cosmwasm: accounting: Drop dependency on the tokenbridge contract
Now that the accounting contract can handle chain registrations on
its own, there's no need to query the tokenbridge contract.  Remove
references to it from `InstantiateMsg` and the internal state.
2022-12-19 17:14:33 +09:00
Chirantan Ekbote 9a559f3fbd cosmwasm: accounting: Add support for chain registration
Add support for handling chain registration VAAs for the tokenbridge
contract.  This will let us deploy accounting without also having to
deploy the tokenbridge.
2022-12-19 17:14:33 +09:00
Chirantan Ekbote 0dbeeec3d4 sdk/rust: Add `Body::with_payload`
Add the `Body::with_payload` method, which can be used to change the
type of the payload for a `Body`.  This is useful when parsing the
payload needs to be deferred until after the body is parsed.
2022-12-19 17:14:33 +09:00
Chirantan Ekbote 4ea369d7a9 sdk/rust: Implement Display for Address
This will be used later by the accounting contract.
2022-12-19 17:14:33 +09:00
Nikhil Suri eff4eb2ebd wormchain: add accounting contract bindings 2022-12-16 08:51:41 -05:00
Nikhil Suri ee2b6d0c17 cosmwasm: wormhole: remove unecessary cast to usize 2022-12-15 14:51:54 -05:00
Kevin Peters d094e3104a Updated CODEOWNERS file 2022-12-15 14:51:06 -05:00
Chirantan Ekbote fba2f48dee cosmwasm: accounting: Fix chain registration query return type
The tokenbridge chain registration query returns a
`ChainRegistrationResponse` struct and not a `Vec<u8>`.  Use the proper
return type when sending the query.
2022-12-15 10:01:08 -05:00
Chirantan Ekbote ac9c8cd743 cosmwasm: Add backfill method for accounting
Add a mechanism to backfill missing transfer messages by submitting
signed VAAs.  This will also be used to initialize the on-chain state
as there is too much data to initialize the contract via the normal
`instantiate` mechanism.

Fixes #1883, fixes #1884.
2022-12-15 12:22:37 +09:00
Chirantan Ekbote 16b22a8cfc cosmwasm: wormhole-bindings: Use the Signature type from the SDK
Use the `Signature` type from the core SDK to avoid unnecessary
type conversions.  Cosmwasm requires its message types to implement
`JsonSchema` so also derive that impl for the `Signature` type behind a
feature flag.

This change uncovered a separate issue where the fake `WormholeKeeper`
was using regular ecdsa signatures rather than recoverable signatures
so fix the signing and verification methods to use the recoverable
signatures.
2022-12-15 12:22:37 +09:00
Chirantan Ekbote 88549b6849 cosmwasm: accounting: Add ValidateTransfer query
Add a query to validate transfers.  This can be useful for guardians to
sanity check a transfer before submitting a signed observation for it.
2022-12-15 12:21:35 +09:00
Chirantan Ekbote 7cd3e14e99 cosmwasm: accounting: Rename CommitTransferError -> TransferError
This error will also be returned by the `validate_transfer` query so
rename it.
2022-12-15 12:21:35 +09:00