Commit Graph

211 Commits

Author SHA1 Message Date
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
Chirantan Ekbote 0f0ea48fdc solana: Fix clippy warnings 2022-09-20 23:00:47 +09:00
Chirantan Ekbote e377a75e2b solana: run `cargo fmt` 2022-09-20 23:00:47 +09:00
Chirantan Ekbote 25dde0b614 solana: bridge: Fix unused variable warning 2022-09-20 23:00:47 +09:00
Stan Drozd 18eac4e3d3 solana: bump: Rust nightly-2022-07-12, SOL SDK v1.10.31, rust container 1.60
solana: use prebuild docker image for 1.10.31

solana: use the right rust version

from https://github.com/solana-labs/solana/blob/v1.10.31/ci/rust-version.sh

nft_bridge: TransportError -> BanksClientError

solana/Dockerfile.wasm: Use rust-toolchain instead of rustup
2022-08-17 15:30:01 +01:00
bruce-riley f0b7225591
Pythnet mainnet deploy (#1388) 2022-08-04 09:51:38 -05:00
Reisen 5da7ad0ef5 solitaire: reduce Claim complexity 2022-07-15 13:12:27 -05:00
Reisen 82ea938317 solitaire: remove recursive FromAccounts and 'c lifetime.
Solitaire parses accounts using two traits, FromAccounts and Peel. The
FromAccounts derive macro generates a function, `FromAccounts::from()`,
which calls `Peel::peel` to construct each field in the struct:

```
let example = Example {
    foo: Peel::peel(next_account_iter(accs)?),
    bar: Peel::peel(next_account_iter(accs)?),
    baz: Peel::peel(next_account_iter(accs)?),
    ...,
}
```

The FromAccounts derivation also attempts to implement Peel for the
structure itself however, which means `Example` itself is embeddable as
a field in another accounts struct. This is only used in ClaimableVAA
which is a large source of confusion and the complexity is not worth
maintaining.

This commit removes the recursion by:

1) Removing the `impl Peel` derived by FromAccounts.
2) Removes the AccountInfo iterator from Context as it is no longer needed.
3) Adds the current parsed account to Context instead, safe thanks to (2)
4) Move message out of ClaimableVAA and pass in to verify everywhere instead.
5) Removes Peel/FromAccounts from ClaimableVAA.
2022-07-15 13:12:27 -05:00
Csongor Kiss be38cf5d7e solana: Update last_lamports after transfer_fees 2022-06-28 13:08:13 +01:00
Hendrik Hofstadt f1dba4adfe
Allow account reuse for message posting (#1077)
* Implement message posting with account reuse

Change-Id: I195f493f6816048f5f8f76e1f0f6e561fa0fe692

* Use different magic for unreliable messages

* guardiand: Ignore solana instructions with empty data

Co-authored-by: Csongor Kiss <ckiss@jumptrading.com>
2022-06-27 09:57:25 +01:00
Reisen 4131381fa4 solitaire: remove unused InstructionContext 2022-06-24 13:51:50 +02:00
Reisen a8d1ed129b solitaire: remove unused client code 2022-06-24 13:51:50 +02:00
Reisen 9aad49d631 solitaire: remove unused deps 2022-06-24 13:51:50 +02:00
Csongor Kiss 2e220a6f76
Solana fix warnings (#1226)
* solana: fix all rustc warnings

* solana: fix clippy warnings

* Remove manual memcpy + other warning suppressions

Co-authored-by: Csongor Kiss <ckiss@jumptrading.com>
2022-06-10 17:59:15 +01:00
Chirantan Ekbote 06c79838bd solana: bridge: Delete makefile
The tests no longer need a running instance of the test validator so
this is no longer necessary.
2022-05-10 00:58:43 +09:00
Chirantan Ekbote 24dd6ed48b solana: bridge: Fix tests
Fix all the tests for the solana bridge program so that we can start
running it in CI.

Use the `solana-program-test` crate as the test framework. Previously,
running the tests required spinning up a test validator and manually
deploying the program there. Now developers can just do `cargo test-bpf`
to run the tests without needing any additional setup (beyond installing
the solana tools). This also lets us split out the tests so that they
can be run separately rather than having to run everything sequentially
in a single integration test.
2022-05-10 00:58:43 +09:00
Chirantan Ekbote 3fdd9ccc3e solana: Merge into single workspace
Merge all the separate solana crates into a single workspace.  This is
the same thing we do for terra and will make it easier to check / lint /
test all the crates together.
2022-04-20 09:37:30 +09:00
justinschuldt 33298ca722 solana-devnet init multiple guardians 2022-04-12 20:37:52 -05:00
Csongor Kiss 4227dde53b Improve and document deployment&verification workflow 2022-04-11 21:29:39 -04:00
Csongor Kiss ff15ca3a67 Document AccountState
* Don't use option_env
* Fix 'cargo test' (it was failing on ambiguous module names)
2022-04-11 21:29:39 -04:00
Hendrik Hofstadt c04d25e704 Fix solana integration tests & add test for account creation
Change-Id: I222744f194f952d03bfbd3ba4469bce59c310fc0
2022-04-11 21:29:39 -04:00
Hendrik Hofstadt 2b56fcc7da solitaire: Fix prefunded accounts blocking creation
Change-Id: I8841e6595b7f8bb217991515bb9ae1ae3d4f4607
2022-04-11 21:29:39 -04:00
Reisen 4e13d9d49c solana/token_bridge: Add blacklisted keys 2022-04-11 21:29:39 -04:00
Csongor Kiss f60acc59ab
solitaire: Infer entry point argument type in solitaire! macro (#927)
The type of the `ix_data` binding withing the solitaire! macro expansion
is explicitly annotated with its type, which comes from the macro's
pattern binding `$kind`. However, this type annotation is entirely
optional, since `ix_data` is passed in as an argument to `$fn`, whose
type forecs `ix_data` anyway, and rust will happily infer that from the
application. So we remove the explicit annotation which makes the entry
point macro easier to use.

commit-id:d428306c
2022-03-16 18:25:41 +00:00
Stanisław Drozd 2ea41b8176
[WIP] Pr/drozdziak1/p2w batching/5e704f8b (#877)
* ethereum: p2w contract -> p2w emitter, fill in essential envs

Change-Id: I6fa9364a96738d2cc02ec829a31fedba0586d8e8

commit-id:0a56f1f8

* Add p2w-relay, a p2w-sdk integration test

commit-id:6bfab639

* p2w-sdk: Expand README

Change-Id: I17cb547d6aaddc240588923561c26d11a787df2e

commit-id:6ebd6a22

* p2w-sdk: don't build ETH contracts, only the types

Change-Id: I7cbd18328227700635d7688aa24a9671e8919fcd

commit-id:adf079f7

* p2w: configurability and sane envs

commit-id:f10fd90e

* Solitaire: Implement Option<T> support in structs

commit-id:31aa12d6

* bridge/governance.rs: Stop pestering about EMITTER_ADDRESS

commit-id:d5bd7234

* p2w-attest: price batching

This commit introduces support for multiple Pyth product/price pairs
per call. The initial maximum batch size is 5 and is enforced using a
`P2W_MAX_BATCH_SIZE` constant.

solana/pyth2wormhole/program:
* On-chain batching logic
* Batch message parsing logic

solana/pyth2wormhole/client:
* Off-chain batching logic - divides any number of symbols into
largest possible batches
* Use a multi-symbol config file instead of CLI arguments

third_party/pyth/p2w-sdk:
* Expose batch parsing logic

third_party/pyth/p2w-relay:
* Comment out target chain calls until ETH contract supports batching
* Test the batch parsing function

third_party/pyth/p2w_autoattest.py:
* Generate and use the symbol config file  with pyth2wormhole-client

third_party/pyth/pyth_publisher.py:
* Add a configurable number of mock Pyth symbols
* Adjust HTTP endpoint for multiple symbols

commit-id:73787a61

* p2w-attest: mention attestation size in batch

This commit ensures that no matter the attestation format, a batch
will never contain attestations of different sizes. This guarantee
enables forward compatibility by adding new constant-size fields at
the end of a batch at all times. An older implementation will simply
not consume the remaining newer values while respecting the stated
batch member alignment.

commit-id:210da230

* pyth2wormhole-client: use fresh blockhashes, harden batch errors

This commit makes sure we don't have to deal with expired transactions
due to stale blockhashes. The problem existed with larger symbol
configs as well as on Solana mainnet. Additionally, the attestation logic
now treats transaction errors as non-critical - a failure for a batch
does not prevent attestation attempts for batches farther in the queue

commit-id:5e704f8b
2022-02-23 19:12:16 +01:00
Hendrik Hofstadt 7edbbd3677 Update Solana to 1.9.4
Change-Id: I9c1ce5f25b21ca81599957a7faa730558d8fc03e
2022-02-02 11:31:33 -05:00
Reisen e561d6de02 sdk: fixes to types and builds
Change-Id: I10b753450445cc021dbeb9f28ddb0384070e9635
2022-01-14 13:09:12 +00:00
Reisen ee0fea0436 sdk: add underlying sdk for wormhole programs
Change-Id: I858f3e43e6458af51131de9165a63078e4bb024c
2022-01-14 13:09:12 +00:00
Reisen d21f08d2cb rust: rename wormhole libraries
Change-Id: I9bf5255c13b13d3724d7f8809489b04612b90747
2022-01-14 13:09:12 +00:00
Stanisław Drozd 02a1dcecbc
solana: hide wasm-bindgen dependency behind the feature flag (#730)
commit-id:480d3b7a
2022-01-10 15:31:36 +01:00
Hendrik Hofstadt 20ce9e1e5c Fix CPI poster
Change-Id: I5a1d13f5256cdb13a431d1bf5cb2c42506de9920
2021-10-01 09:03:25 +00:00
Hendrik Hofstadt 1421e5d76f Add derivation methods for claims and spl meta
Change-Id: I4e8056b37d441caf7bca94037585c37afe25cc24
2021-09-21 16:29:42 +02:00
Reisen 20386593ed solana/bridge: fix tests to use bool sigcheck
Change-Id: I8d59016ae926e9cdcdc6114db8c640889fc5c9ee
2021-09-13 10:29:29 +00:00
Reisen ca509f2d73 solana/bridge: re-organize account data
Change-Id: Ia215c584e5d00145d8ad0250c303ca9503d8432a
2021-09-13 10:29:29 +00:00
Hendrik Hofstadt 94695ee125 More checks on amount and fees
Change-Id: If5a7f43faa0ea39e99138c0856756bad19a4b410
2021-09-07 12:18:06 +02:00
Stan Drozd 5dbd3ea722 pyth2wormhole: on-chain attestation call, update Pyth-facing types
This commit takes the selected Pyth Price struct account and after
serialization places them inside a PostMessage cross-program
call to Wormhole.

Change-Id: If04123705290f4749de318c0dfaa8f1d840ed349
2021-09-03 17:17:34 +02:00
Hendrik Hofstadt 48e8ae1555 Fix guardian set expiration
Change-Id: Ie92168305db2dcd69421f369078d118a011332e1
2021-09-01 18:48:10 +00:00
Hendrik Hofstadt 1a8bf4456e Fix initial guardian set expiration on mainnet
Change-Id: I41adacc68687d0c638e79c834b7441896dc4ed98
2021-09-01 18:48:10 +00:00
Hendrik Hofstadt 610bf76902 Don't store signatures on chain
This saves 0.01 SOL per Wormhole tx and we don't need it.

Change-Id: I947a20fcbae9822c11073ba83b4dc67f9dcee19c
2021-09-01 18:48:10 +00:00
Hendrik Hofstadt 72477c46a4 Allow the emitter to be mutable
This is the case when the emitter is the fee payer.

Change-Id: Ib21658c6cbbbb246a7434057c0f03f24bec8c013
2021-08-23 13:54:07 +00:00
Reisen 254f1c8674 Use bridge config to decide fee payer.
Change-Id: I5eb7601737eb5cbc687dee07567a6fab4e5ca4c5
2021-08-23 13:54:03 +00:00
Hendrik Hofstadt f42453be45 Resolve rust compiler warnings
Change-Id: Iaac63d0fb44ecb7e03d68a10df7bddbb521c73a0
2021-08-23 09:51:31 +02:00
Hendrik Hofstadt a05017c043 Update rust dependencies
Change-Id: Ib587cf608255afc46dcb435a4168e0f8f8cfb8a8
2021-08-23 09:39:36 +02:00
Hendrik Hofstadt d242fd0fa4 Set bridge address via env variable
Change-Id: If301b31525dbe1d9f892f93ffbc1a35507be4625
2021-08-23 09:39:24 +02:00
Hendrik Hofstadt 1f6b3ba323 Pack more signatures in the verification tx
Since we now use double hashing, this will work no matter how large the payload is

Change-Id: I79939e9a0698bd71602aae1135d4d40631bb4438
2021-08-12 13:23:53 +02:00
Hendrik Hofstadt 24e5406e84 Always log sequence
Change-Id: I0fe6e2f0f564f719b6207067b7824e395e91a65c
2021-08-09 12:51:23 +00:00
Hendrik Hofstadt add04e8755 Create different accounts for message posting and VAA posting
Change-Id: I88a3f74301aeecc16bb51ba693ea9523dc16b612
2021-08-09 13:51:25 +02:00
Hendrik Hofstadt 597aae7cd7 Automatically register eth and solana token bridges
Change-Id: I35efef8d53f999f85ca2e8c4f58cc6cbf8193b2d
2021-08-06 15:21:27 +00:00
Hendrik Hofstadt 3fb493cb23 Remove hardcoded instances of the bridge pubkey in the program
Change-Id: I42bc36fa9db650b9cab6c6ac4c8e7c969487a40f
2021-08-06 12:25:01 +00:00
Hendrik Hofstadt 86cd27c919 Allow Solana VAAs to be posted even if the message account does not exist
This is needed for hand-crafted governance VAAs that originate from Solana

Change-Id: I50f75de9a83dd9640d960a7808c0a6605afc539d
2021-08-06 10:20:19 +00:00