Commit Graph

2758 Commits

Author SHA1 Message Date
justinschuldt 220a869b7b wormchain - contract deploy + test 2023-01-23 15:10:22 -06:00
justinschuldt 1f939ea2dd wormchain - peer-exchange reactor off by default 2023-01-23 15:06:07 -06: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
Chirantan Ekbote 289d37771d cosmwasm: accounting: Return transfer status for observations
When submitting a batch of observations, we don't want an observation
for an already committed transfer to fail the entire batch.  This leads
to more complexity in the guardian and also delays all the legitimate
observations by at least one more block (~5 seconds).

Fix this by returning the transfer status of each observation as part
of the response data.  Observations for committed transfers will get
a `TransferStatus::Committed` response without failing the tx as long
as the digest of the observation matches the digest of the committed
transfer.  Digest mismatches are still an error and will fail the entire
batch.
2023-01-23 14:27:08 -05:00
Josh Siegel 04b0018cfe sui/guardian: more informative error messages 2023-01-23 11:00:09 -06:00
Josh Siegel bf70827fe7 sui: guardian watcher updates 2023-01-23 11:00:09 -06:00
Chirantan Ekbote b2ca522e73 sdk/rust: Add test with hardcoded digest
Add a test for digest calculation that uses a hardcoded digest.  The
digest for this test was calculated using the `worm` CLI to ensure
interoperability.
2023-01-23 11:53:39 -05:00
Jeff Schroeder cd93c57d66 node: strip leading 0x for send-observation-request
This allows copying and pasting transactions from montioring tools or
an explorer to be reobserved.
2023-01-23 10:32:15 -05:00
Chirantan Ekbote 45b3d18d80 Add codeowners for accountant 2023-01-23 09:11:39 -05:00
tbjump 5323453b81
node: add channel read/write type constraints (#1931) 2023-01-20 13:15:13 -08:00
Csongor Kiss 500f70c858 CI: update scripts/check-docker-pin.sh to allow sui 2023-01-20 14:57:00 +00:00
Csongor Kiss 91047147b0 CI: run sui tests 2023-01-20 14:57:00 +00:00
Josh Siegel 62eb6aec15 sui: implement contracts 2023-01-20 14:57:00 +00:00
bruce-riley 53d554d93b
Node/Acct: batch requests (#2266)
* Node/Acct: batch requests

Change-Id: I3f950c73265f40b2542a9b1222b2df67cb1964b0

* Node/Acct: use vaa.Address in response

Change-Id: If20f2f75f81c616f30d3b0e1c250c5fb1351f3f2

* Node/Acct: Fix issues with defer

Change-Id: I9370458455da422985516e98f6047d85db822ca0

* Node/Acct: More PR rework

Change-Id: I6d4f549218c25976b7f312d45a2ad53cdeb9ca67

* Node/Acct: use Observation event in watcher

Change-Id: Id0bb7575569a75ef83f97d1297022672d2e693a9
2023-01-20 08:15:36 -06:00
Chirantan Ekbote d19fc98091 sdk/rust: Properly support tokenbridge payload3 messages
Add the payload as an explicit field to the `TransferWithPayload` enum
variant.  This is a generic parameter that defaults to `Box<RawMessage>`
for maximum flexibility (and to avoid leaking lifetimes higher up the
stack) but users are encouraged to replace this default type parameter
with an explicit `&RawMessage` in places where the serde_wormhole data
format is used.

The main benefit of this change is that the payload is now included as
part of the actual message and no longer requires callers to awkwardly
append it after serialization.  This is especially useful in human-
readable formats like JSON (see the `transfer_with_payload` test in
token.rs for an example of this simplification).

The main downside is that this now requires explicit type annotations
when using the non-payload3 variants so that the compiler will pick up
the default generic parameter.  This is a relatively minor inconvenience
and the benefit appears to be worth the cost.

There should be no functional change.
2023-01-20 18:12:41 +09:00
Josh Siegel 59602e7424 aptos/cache_fix: remove the usage of the cache from the aptos test that runs in the Dockerfile 2023-01-19 11:29:59 -06:00
justinschuldt 9db82e310f cosmwasm - separate deploy code per chain 2023-01-19 09:32:13 -06:00
Jonathan Claudius f258da927d Update bounty 2023-01-19 09:13:48 -05:00
Josh Siegel 588d7e629a node: ether block pollers need to wrap their supervisor runs 2023-01-19 07:18:59 -06:00
Justin Schuldt ff7273cc5d
tilt: two wormchain nodes for devnet (#2228) 2023-01-18 17:15:23 -05:00
jumpsiegel 3580f51ccf
node/pythnet: websocket subscription (#2219)
* node/pythnet: websocket subscription
2023-01-18 11:24:55 -05:00
Csongor Kiss e6d3bb8731 worm: speed up `evm info` by improving concurrency 2023-01-18 11:22:33 -05:00
Nikhil Suri a7976136b7
tilt: add ibc relayer which connects wormchain and terra2 to dev environment (#2215)
- updates terra2 devnet chain timeout_commit to "1s" since the timeout_commit of "0.5s" is too fast and leads to Terra2's clock going into the future.
- updates terra2 devnet chain unbonding_time to "1814400s" which is the default value and translates to a valid trusting period for IBC connectivity.
2023-01-18 07:57:09 -08:00
Nikhil Suri 07831437ba
wormchain: run Ignite through docker and update documentation (#2169) 2023-01-18 07:56:32 -08:00
Chirantan Ekbote 421a030dca sdk/rust: Remove `*_with_payload` methods
The RawMessage type provides a more flexible way to handle trailing
payloads so replace all usage of the `*_with_payload` functions to use
`RawMessage` instead.

There should be no functional change.
2023-01-18 09:33:10 +09:00
Chirantan Ekbote 3c6702b6f7 sdk/rust: Add serde_wormhole::RawMessage
Add a RawMessage type that can be used to defer parsing parts of a
payload, similar to the `json.RawMessage` from Go.  The implementation
is inspired by `serde_json::RawValue`, which does a similar thing.

When serializing, RawMessage will serialize to a base64-encoded string
if it detects that the data format is human readable (like JSON).
Otherwise it will simply forward the raw bytes to the serializer.

RawMessage has both borrowed and boxed versions.  The borrowed version
is the most efficient as it enables zero-copy handling of the input data
but also requires that the input data already contains raw bytes and is
not suitable when dealing with human-readable formats like JSON.

The boxed version is more flexible as it supports byte slices, base64-
encoded strings, and byte sequences but is slightly less efficient as it
requires copying or decoding the input data.
2023-01-18 09:29:05 +09:00
Conor Patrick 8f08d68baa wormchain: reset genesis to adjust 0 commission change values 2023-01-17 17:18:00 -06:00
Kevin Peters 0a7f0dabf5 node: New default current guardian set index (3) 2023-01-17 11:12:58 -06:00
Evan Gray 004ccecaf8 clients/js: handle injective mainnet 2023-01-17 10:32:58 -05:00
bruce-riley 09aee3cfde
Node/Acct: Renaming (#2245)
Change-Id: I20783b4ae4e445a54d45280e19332af87336a92a
2023-01-17 07:30:50 -06:00
bruce-riley 499c8424e4
Node: Initial guardiand changes for accounting (#2181)
* node: guardiand support for accounting

Change-Id: I97fe1f6d6d71a5803881ff4c793e3c30f22b14d8

* Node: Tie accounting into the guardian

Change-Id: I31600d18176f516b75b3eb046fd7ac6e54e1b133

* Node: accounting tests and metrics

Change-Id: Ieb139772edf464ed1ab202861babeaf0f857ad6b

* Node: minor tweak to accounting metrics

Change-Id: Iad2b7e34870734f0c5e5d538c0ac86269a9a4728

* Node: load accounting key

Change-Id: I228ce23e63b556d751000b97097202eda48650aa

* More work in progress

Change-Id: I85088d26c05cf02d26043cf6ee8c67efd13f2ea4

* Node: send observations to accounting contract

Change-Id: Ib90909c2ee705d5e2a7e6cf3a6ec4ba7519e2eb1

* Node: Fix lint error in accounting tests

Change-Id: Id73397cf45107243a9f68ba82bed3ccf2b0299b5

* Node: Need to copy libwasmvm.so

Change-Id: I2856c8964ca082f1f4014d6db9fb1b2dc4e64409

* Node: Rename wormchain to wormconn

Change-Id: I6782be733ebdd92b908228d3984a906aa4c795f7

* Node: moving accounting check after governor

Change-Id: I064c77d30514715c6f8b6b5da50806a5e1adf657

* Node: Add accounting status to heartbeat

Change-Id: I0ae3e476386cfaccc5c877ee1351dbe41c0358c7

* Node: start of accounting integration work

Change-Id: I8ad206eb7fc07aa9e1a2ebc321f2c490ec36b51e

* Node: More broadcast tx stuff

Change-Id: Id2cc83df859310c013665eaa9c6ce3033bb1d9c5

* Node: Can actually send a request to accounting

Change-Id: I6af5d59c53939f58b2f13ae501914bef260592f2

* Node: More accounting tx broadcast stuff

Change-Id: If758e49f8928807e87053320e9330c7208aad490

* Node: config changes for accounting

Change-Id: I2803cceb188d04c557a52aa9aa8ba7296da8879f

* Node: More accounting changes

Change-Id: Id979af0ec6ab8484bc094072f3febf39355351ca

* Node/Acct: Use new observation request format

* Node/acct: use new contract interface

* Node/acct: fix minor copy/paste error

* Node: Clean up comments and lint errors

* Node: disable accounting in dev by default

* Node: Fix test failure

* Remove test code

* Switch messages to debug, rename Run()

* check for "out of gas"

* Use worker routine to submit observations

* Rename mutex to reflect what it protects

* Create handleEvents func

* Remove FinalizeObservation

* Node/Acct: Trying to use tm library for watcher

* Node/acct: switch watcher to use tm library

* Node/Acct: Need separate WS parm for accounting

* Node/Acct: Fix compile error in tests

* Node/Acct: Minor rework

* Node: add wormchain as a dep to remove stale code

* Node/Acct: GS index is not correct in requests

* Node/Acct: Peg connection error metric

* Node/Acct: Add wormchain to node docker file

* Node/Acct: Fix for double base64 decode

* Node/Acct: Change public key to sender address

* Node/Acct: Fix lint error

* Node/Acct: key pass phrase change

* Node/Acct: Pass guardian index in obs req

* Node/Acct: No go on submit observation

* Node/Acct: Don't double encode tx_hash

* Node/Acct: Remove unneeded base64 encoding

* Node/Acct: handle submit channel overflow

* Node/Acct: Added a TODO to document a review issue

* Node/Acct: Fix for checking if channel is full

Co-authored-by: Conor Patrick <conorpp94@gmail.com>
2023-01-16 06:33:01 -06:00
Chirantan Ekbote 8777c22d32 cosmwasm: accounting: Use cw_transcode for events
Use cw_transcode to ensure that event attribute values are always
encoded as proper json, making it easier for clients to parse them back
into structured data.

This also lets us reuse the input messages for the events, reducing the
number of different structs that we need to track.
2023-01-16 09:28:43 +09:00
tbjump 5c41d343ca node: add logging for public rpc requests 2023-01-14 15:07:30 -05:00
bruce-riley 3f61661051
sdk: Add Aptos NFT bridge address (#2244) 2023-01-13 15:03:15 -06:00
Josh Siegel 3de4f875dc node/cosmwasm: restructure a little
node/cosmwasm: convert from gorilla to nhooyr
2023-01-13 07:33:50 -06:00
Chirantan Ekbote b1050f69ee cosmwasm: accounting: Simply transfer queries
Rather than forcing clients to guess whether a transfer is pending or
committed use a single `TransferStatus` query that will return whether
the transfer is still pending or already committed.

This will make it easier for clients to keep the pending and committed
transfer state in sync to avoid unnecessary overhead.
2023-01-13 11:41:54 +09:00
Josh Siegel 1178f6ed6c node/ether: scissors updates 2023-01-12 14:46:45 -06:00
Csongor Kiss 88d13e694b aptos/nft-bridge: mainnet deploy 2023-01-12 02:46:42 +00:00
Csongor Kiss fe5ca53a98 aptos/nft-bridge: Tilt integration
aptos: update Docker image
2023-01-12 02:46:42 +00:00
Csongor Kiss 9824d71fe1 aptos/nft_bridge: implement contract 2023-01-12 02:46:42 +00:00
Csongor Kiss 6da8e4ae7d aptos: formatting fixes 2023-01-12 02:46:42 +00: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
omahs ce1f3adc23 Fix: minor typo
Fix: minor typo
2023-01-11 14:25:55 -05:00
Kevin Peters 5f6782e67d sdk/js: Use BN.toArrayLike in `tokenIdToMint` function for browserify compatibility. 2023-01-11 13:38:54 -05:00
Csongor Kiss 280fffe486 aptos: remove unused typescripts scripts 2023-01-11 13:06:44 -05:00
Evan Gray 735ce417b6 sdk/js: generate docs fixes #1821 2023-01-11 13:01:46 -05:00
Kevin Peters 26ee5e8e10 clients/js: Update wormhole-sdk to 0.9.8 2023-01-11 13:00:02 -05:00
Paul Noel cf5187b90c
tilt: eth speedup (#2214)
* ethereum/scripts: add register all script

* devnet: update eth startup script

* ethereum/scripts - remove unused scripts

* ethereum/scripts: add register all script

* devnet: update eth startup script

* ethereum/scripts - remove unused scripts

* devnet: update eth-devnet2 script
2023-01-11 12:59:43 -05:00