Commit Graph

167 Commits

Author SHA1 Message Date
Hendrik Hofstadt 2bfdc2fdc9 Add missing derivation checks
Change-Id: I615c5fc4fd737cdeb9bb4a118cdbfb8ef7abc5db
2021-07-08 19:50:56 +02:00
Reisen 3730ce30e3 Check the on-chain state for paid fees test
Change-Id: I85def349ba9888edb8d9e4264c7eb593c0e7c766
2021-07-07 11:46:46 +00:00
Reisen 4f5047f799 Check Duplicate messages fail to persist
Change-Id: Iefbb40ea9e703208d8192571d15630d28cb042f8
2021-07-07 11:46:46 +00:00
Reisen 704e8d6911 Confirm intentionally not signing emitter fails
Change-Id: I0e33303b3105321675295040d027d1b0df57f030
2021-07-07 11:46:46 +00:00
Reisen fc1a104ceb Test Persistent Messages
Change-Id: Ib956b4154d27a1aad5b32ad730783b2480050958
2021-07-07 11:46:46 +00:00
Reisen 0d637482d4 Add Sequence tracker and test initialize
Change-Id: I2ecb360f498fe056332690937c0556448bb286f1
2021-07-07 11:46:46 +00:00
Reisen 007098aaec Allow different commitment level through utilities
Change-Id: I7269e5c64c82dceaf1d70c74fbdfe6e44c247ec5
2021-07-07 11:46:46 +00:00
Reisen 768f768001 Use clock time for bridge initialization timestamp
Change-Id: I6121e7546f4c0590dff830572a843384a0470972
2021-07-07 11:46:46 +00:00
Reisen 7ab5a93b21 Verify emitter in all governance actions
Change-Id: Ib1fdbe9dc553e22a0e61d6f119eb45325d15861c
2021-07-07 11:46:46 +00:00
Reisen 387fcc48c0 Add Mut layer to accounts in bridge program.
Change-Id: I78dfb4568eaec4f597a6d0e1ac10a0f698bb5a61
2021-07-06 12:08:25 +00:00
Reisen 72951531f6 Add test for messages from foreign chains
Change-Id: Ic02554f74a84a002f1a211a7cf519394cae1f36a
2021-07-06 09:05:56 +00:00
Reisen 7b030aa59a Add governance transfer_fee tests
Change-Id: I55fe0ccad1447ee7c70b1cc5de6f88cf1a2dfd8a
2021-07-06 09:05:53 +00:00
Hendrik Hofstadt 7784e74725 Align behaviour of persistent message fees
Change-Id: Ic9c6c40dbac2399e0eaf3a861dff33254a828a18
2021-07-05 18:02:04 +00:00
Hendrik Hofstadt d9fde6d7cc Implement optional persistence in Solana wormhole
Also reformatted the token_bridge

Change-Id: I195d7e2e13295c8b28e2a0b63620e3d306dc07e6
2021-07-05 18:02:04 +00:00
Reisen 366a045dd4 Add governance set_fees test
Change-Id: I13cda0ff055daa0fcfd9f0f2993f8e32d2670181
2021-07-05 12:27:46 +00:00
Reisen fd7b53a2a5 Add method to inspect account data in tests
Change-Id: I23ee5b351bcd1cb6fb998384ff87f7bfaf61b885
2021-07-05 12:27:20 +00:00
Reisen 6aa5788354 Confirm guardian set fails for non-gov emitter
Change-Id: Idc49a19be551d4a3c4ae7cafe735995fa4ced0be
2021-07-05 12:27:18 +00:00
Reisen da0ebfee2c Add failing guardian set change test
Change-Id: I4cd5b6360060a76671390ccc196b993d6c72f083
2021-07-05 12:22:39 +00:00
Reisen 20af0ae03a Expose errors from test utilities
Change-Id: I9dbe732bcff004dc85b79a8fe6e9226848de468f
2021-07-05 12:22:39 +00:00
Reisen b4d7265342 Split Integration Tests
Change-Id: Ib75bfbb54647dcda8ba37a08bef2083021ac8418
2021-07-05 12:22:37 +00:00
Hendrik Hofstadt 049177db37 use sequence as seed for persisted VAAs from foreign chains
Without the additional seed, messages with identical (emitter_chain, emitter_address, nonce, payload) but different sequence could fail to be persisted.

Change-Id: I6786f7be33bcc6da7289f54fc62c7a5b10821594
2021-07-02 16:51:26 +00:00
Hendrik Hofstadt b85cbacd3b fix message attestation for Solana
Change-Id: Iaf79984980affe64f268c2eed9f61d5058cea0dd
2021-07-02 16:05:06 +00:00
Hendrik Hofstadt cc08a9753c reformat and fix client
Change-Id: Ie99d2b7cc2ed9890432c38661f1035a473cc5ac1
2021-07-02 11:48:48 +00:00
Hendrik Hofstadt 3c5deee7ee Fix devnet for new contracts
Change-Id: I5b7536884ce3d1bdf39a21a8b71b6a848ad0380f
2021-07-02 13:02:35 +02:00
Reisen 62f5cb1986 Do message payment within same instruction
Change-Id: Id1e3ac10bcdc7e91c649f5e75caf8a98e27be0c6
2021-07-01 09:35:03 +00:00
Reisen cdcf6f5d14 Add tracing to PostMessage.
Change-Id: I13005cef8cc5a07021066e5182b5ad818b3be30e
2021-07-01 09:35:03 +00:00
Reisen 2e4279c964 Generate Keypairs for guardians during test.
Change-Id: Ide5f0347ee40189aecfe5dca4ba8f4ef3f0756d9
2021-07-01 09:35:03 +00:00
Reisen 889895bc91 Use multiple signatures in tests
Change-Id: Ibcd2cfbd59d3eb3e0d4486252ae93a5f38c3b457
2021-07-01 09:35:03 +00:00
Reisen 4a08dbf73e Fix calculation for quorum size.
Change-Id: I2240e4a395576cbdbe11f38883f418647d92ce50
2021-07-01 09:35:03 +00:00
Reisen 30e8419f93 Update tests to use initial guardian set.
Change-Id: I11cd5d5bc518ce69e12a289211f21b992eef9ffe
2021-07-01 09:34:59 +00:00
Reisen 44384e635f Expose Governance types/functions
Change-Id: I10fb14fa5d9d283cf831ea3d8585141e834e40b5
2021-07-01 06:16:59 +00:00
Reisen 21c7399d55 Return errors in Data peeling
Change-Id: I3e0ae581e83ebbcf0d343b758dff033ddc9b362e
2021-07-01 06:16:59 +00:00
Reisen e6317449d5 Pass in initial Guardians in Initialize
Change-Id: Iabc803d85ef89142a27e924a81ddddecb41e96dc
2021-07-01 06:16:59 +00:00
Hendrik Hofstadt f97bbccdae Fix agent bridge import
Change-Id: I88098157710dc51bcbb6a3cd412cdfd68be1c3fc
2021-06-30 18:56:54 +02:00
Hendrik Hofstadt 6d1b3d2651 Adapt solana agent for v2
Change-Id: I81fc8b959f33a157371d1c59b1d5323dfc11f1ce
2021-06-30 06:46:56 +00:00
Stan Drozd 5e7e4d4e48 Solitaire: Enforce the "client" feature in dependees
Change-Id: I55da10bde41f84e91c5754a89eb4239967117e67
2021-06-29 15:35:14 +00:00
Stan Drozd 79d82d1226 Solitaire: use "client" as superset of "no-entrypoint", logging
Change-Id: Ie846b9abd783fe041f2cfa9aeda962003ffe1441
2021-06-28 13:01:43 +02:00
Reisen 118bc13bcb Fix all warnings in the bridge program.
- Allowed non snake case globals for const generic names.
- Left feature warning on as these are valuable to others during cargo
  build, where you might want to spot what projects are using unstable
  features when pulling dependencies.

Change-Id: I595253513554c441284def7e354bb4e4e2df550e
2021-06-25 07:55:55 +00:00
Reisen 8cb2675c85 Rework integration tests around exposed instructions
Change-Id: Id796e31de90b1d59a43e9ae1cce85d84cd264558
2021-06-24 13:55:31 +00:00
Reisen e99b597ee3 Fix Signature Calculation
Change-Id: Ia0fa7f86f09360d792dbfebd8928f9a444ac3368
2021-06-24 10:02:15 +00:00
Hendrik Hofstadt ece0de4bef Fix bridge fee and implement CLI
Change-Id: Ib17b335e05359fd4baf614d0b4eaae459814b04d
2021-06-23 15:10:06 +00:00
Reisen 89ddc95a78 Add Instruction helpers to core program
Change-Id: I38d958c57aef02a5328075cd1010fb2a6a564b0b
2021-06-23 12:38:43 +00:00
Reisen 16f7e156ae Fix Derivation issues for PostVAA accounts.
Change-Id: Ia08003dc8aadfe3963598c81745813e6e09e5d3a
2021-06-23 11:02:42 +00:00
Reisen a28540de0d Test VerifySignatures.
Change-Id: I430b4676706371bbcf61368a83ff4946d9db2202
2021-06-23 11:02:42 +00:00
Reisen c2c2e7f13d Integration Test for PostVAA without working Signatures
Change-Id: Ib5c93986cdac88678657b254522422ab5231a856
2021-06-23 11:02:42 +00:00
Reisen 8173f0997a Add integration test PostVAA step
Change-Id: I44d00afc728557d2556a8a2e62f378a3f2e61db7
2021-06-23 11:02:42 +00:00
Reisen 692da33d0c Add integration test around PostMessage
Change-Id: I8c41db5f3d110ee445ed66d2599d87afb42fde7e
2021-06-23 11:02:42 +00:00
Reisen c3151728f5 Add integration test setup with Initialize filled in
Change-Id: Ie7cbb1a2a72b88e2752065b65d76da9cda9b1c0f
2021-06-23 11:02:42 +00:00
Reisen 146b368fc0 Fix accounts required for calling Initialize/PostMessage
Change-Id: Ide3fa8401bac6b1b05bc4c5ec1f552a98178ad06
2021-06-23 11:02:42 +00:00
Hendrik Hofstadt 22373b9943 Fix eth and solana deployment in tilt devnet
Change-Id: Iee032e92373c56d876e6fc1626b0f1af54046834
2021-06-22 18:17:18 +00:00
Leo c1d0f165d6 Merge branch 'main' into dev.v2
# Conflicts:
#	bridge/pkg/solana/submitter.go

Change-Id: I45b6e8f398b879915793987c5db38c839e8d1cc9
2021-06-22 18:54:15 +02:00
Hendrik Hofstadt 02d7257ff5 Implement PostedMessage fetching in the client
Change-Id: I8b59cdbfaf37212e187257cf46674086ad96d19d
2021-06-18 18:50:06 +02:00
Hendrik Hofstadt aa909c218f Restructure workspace
This will make is easier to separate modules and solitaire in the future.
We also get rid of the old bridge code.

Change-Id: I4d663c36739dfec77cd5d3f1ed6b51f422fe0c91
2021-06-21 10:24:52 +02:00
Stan Drozd c700e8847b Solitaire client implementation
Change-Id: I4d1f37082537cd24a4859802652a177400f6a205
2021-06-04 13:02:35 +02:00
Leo 31a94eeb79 solana/bridge: review comments
Change-Id: Icd58a43cf14588cf4c39f5557bd2d027ef5364ef
2021-04-20 09:52:07 +00:00
Hendrik Hofstadt fad00804e0 minor adjustments in the solana module
Change-Id: I5bafc475fb798fe11c67fd5511b8fe36c314ea36
2021-04-19 14:27:06 +02:00
Hendrik Hofstadt 1f30398e30 refactor new ix processing, remove old processors
Change-Id: I682573bf8544c5a19b2b57c6660e9e86e9b12cf9
2021-04-19 14:27:04 +02:00
Hendrik Hofstadt dfa746476f refactor message posting ix, remove old ixs
Change-Id: Idfa487a189ec2fb3ed2029ddce10fc02aef1255b
2021-04-19 14:25:28 +02:00
Hendrik Hofstadt aad19ff8f8 remove transfer specific methods
Change-Id: I017c9946aaf0f23a56cfc27b7871dbf22f19957b
2021-04-19 14:25:26 +02:00
Hendrik Hofstadt 6a6ba06c0c remove transfer state accounts, introduce posted message persistence
Change-Id: I34a8006dae5cb1a315dc0af297d9025d1e500fcb
2021-04-19 10:30:37 +00:00
Hendrik Hofstadt d09eb150e7 move governance messages to new file
Change-Id: I4b4b76974bb55b5f570c25072d5ffec59215a72c
2021-04-19 06:41:32 +00:00
Hendrik Hofstadt c0f7f3b8f9 reformat errors, remove transfer specific errors
Change-Id: Ie2827893f0fd8e5f5efbdc8f0b8ed0fa1d91abd4
2021-04-15 19:46:07 +00:00
Hendrik Hofstadt 776d774494 solana/bridge: change VAA structure
Change-Id: I8304d2573aafd2291f2ddfc2eec6e605326d0e2d
2021-04-15 19:39:00 +00:00
Stanisław Drozd 6de425a990
BPF SDK hotfix and devnet startup improvement (#196)
* Tiltfile: Make the guardian k8s_resource depend on solana-devnet

This makes guardian network convergence faster as the guardian pods
don't have to suffer from increasing redeploy back-off delays. This
should impact performance neglibibly as solana-devnet is still the
heaviest build we perform (at the time of this writing saturating a
32-thread Ryzen 9 CPU on my build machine.)

* hotfix bpf-sdk: bump bpf-sdk; use cargo-build-bpf
2021-04-07 15:13:01 +02:00
Ryo Onodera 2ba9381066
Add/Clarify comments (#187) 2021-02-26 13:48:44 +01:00
Hendrik Hofstadt 8478735ea7
don't subsidize guardian set creation (#172)
* don't subsidize guardian set creation

This works around https://github.com/solana-labs/solana/issues/9711 which causes issues when the guardian set creation is subsidized and another CPI call is done subsequently
2021-02-02 21:20:48 +01:00
Hendrik Hofstadt 2b30a30601
upgrade solana sdk version (#166)
* upgrade solana sdk version

Commitment levels were deprecated and the fastest confirmation level is `Processed`.

Also the upgradeable loader now requires the program to be writeable.

* Add deprecation comment

* update agent commitment level
2021-01-28 17:44:54 +01:00
Hendrik Hofstadt a5380b8ab1
Fix rent calculation and hardening (#163)
* use proper account for min balance calculation

* check bridge key in sig verify

* check bridge key in VAA processor
2021-01-25 15:11:38 +01:00
Leo 108f050c0e Clarify public keys vs public key's hashes in comments and docs 2021-01-21 00:59:50 +01:00
Hendrik Hofstadt 82fd4293e2
Fix guardian set expiration on Solana (#155)
* fix guardian set expiration on Solana
2021-01-19 16:44:48 +01:00
Hendrik Hofstadt efa03ef73c
Implement upgradeability (#151)
* Implement contract upgrade VAA action

* naming and (╯°□°)╯︵ ┻━┻

* Carefully unflip table and replace broken cutlery ┬─┬ノ( ◕◡◕ ノ)

* fix and automate upgradeability

* document contract upgrade call

* Update comments

* Exhaustiveness check in VAA payload switch

* Fix typo

Co-authored-by: Leo <leo@certus.one>
2021-01-19 13:01:45 +01:00
Hendrik Hofstadt 274bb7c97d
Owner and sysvar check hardening (#154)
* owner and sysvar check hardening
2021-01-12 23:21:30 +01:00
Hendrik Hofstadt 03ef5e1017
Don't evict governance VAA signatures (#137)
* don't evict governance VAA signatures

They need to persist for data availability (to be cross-submitted to other chains)
2020-12-17 11:27:46 +01:00
Hendrik Hofstadt bec598b41a
Fix subsidization and fees (#127)
* Revert "solana: partially revert #82 subsidization changes"

This reverts commit 2967653e

* fix subsidization

* fix deleted grpc tag dependency

* revert devnet changes

* verify system instruction action

* ┬─┬ノ(ಠ_ಠノ)
2020-11-30 11:09:08 +01:00
Leo 2967653e06 solana: partially revert #82 subsidization changes
... while keeping the borrowing fixes. Please review carefully whether
any of the remaining changes should've been reverted as well.

Fails due to account ownership check for debits, new tests caught it.
2020-11-29 17:07:15 +01:00
Hendrik Hofstad 3e57f475e1 solana: fix borrow issues 2020-11-20 14:23:05 +01:00
Hendrik Hofstadt 8510140165
subsidize guardian transactions using fees (#82)
* subsidize guardian transactions using fees

* reuse transfer function

* evict signature state on inbound transfers

* fix mutability issues due to copying

* add fee refund

* unify fee calculation

* add fee documentation

* Unflip tables

* type annotation
2020-11-19 22:47:09 +01:00
Leo fdc2be10b3 solana: verify that new guardian set isn't empty
ghstack-source-id: 4fc1d94152
Pull Request resolved: https://github.com/certusone/wormhole/pull/101
2020-11-19 12:57:21 +01:00
Hendrik Hofstadt cee28540bd
Upgrade SDK; add balance rpc call (#80) 2020-11-13 14:14:56 +01:00
Leo f3107ebed4 solana: add uncommitted Cargo.lock files
If there's a reason they are missing, then I didn't realize :-)

Ref #29

ghstack-source-id: 9052f64e76
Pull Request resolved: https://github.com/certusone/wormhole/pull/68
2020-10-28 22:47:12 +01:00
Hendrik Hofstadt dadb287220
bridge: fix quorum calculation (#69) 2020-10-28 21:22:15 +01:00
Hendrik Hofstadt cf90bbec0d cli: create_wrapped command, deterministic generation 2020-10-28 20:37:06 +01:00
Hendrik Hofstadt 8d7a35683e
bridge: fix quorum (#56) 2020-10-25 08:57:04 +01:00
Hendrik Hofstadt e266bf1a7c
Implement assistant & Reimplement wrapped asset precreation (#42)
* all: readd early wrapped meta creation; initial transfer wizard

* web: complete transfer assistant

* web: allow multiple accounts per wrapped mint
2020-10-14 11:49:13 +02:00
Hendrik Hofstadt ddd2c901bd solana: create sig verify account in instruction
This allows multiple guardians to submit the signatures in parallel without causing costs with all transactions because conflicting txs won't be mined.
2020-10-03 21:20:24 +02:00
Hendrik Hofstadt 25533f0264
bridge: add secp check instruction (#41)
* bridge: add secp check instruction

* solana: update to secp solana upstream

* solana: iteration on secp

* solana: fix secp instruction

serialization indices were off and secp ix data was serialized twice

* solana: optimize ix serialization

* agent: send multiple chunks of signatures

* doc: update protocol spec

* solana: store signatures in siginfo; reconstruct signed VAA in webinterface

* solana: reformat

* solana: add rustfmt config
2020-10-01 16:42:45 +02:00
Hendrik Hofstadt 4ba7885c62 solana: add retry/poking mechanism
Closes #6
2020-08-31 21:05:38 +02:00
Hendrik Hofstadt 941220bc85 bridge: optimize VAA claim derivation
Instead of hashing the body manually, we pass the body to the address derivation syscall.
2020-08-31 20:09:06 +02:00
Hendrik Hofstadt 45a25e0386 bridge: prevent multiple signatures from single guardian 2020-08-31 09:26:38 +02:00
Hendrik Hofstadt b4b0c61dfc bridge: require single step guardian set index changes 2020-08-31 09:25:41 +02:00
Hendrik Hofstadt f6750a3762 all: consider decimals on wrapped assets, fix VAA posting, fix solana account parsing 2020-08-28 15:10:42 +02:00
Hendrik Hofstadt 8e6dc495dc bridge: remove VAA timeout
Closes #35
2020-08-28 08:49:46 +02:00
Hendrik Hofstadt ed0a6d4b2e bridge: use proper source address 2020-08-28 08:36:33 +02:00
Hendrik Hofstadt 042ff4a14b bridge: properly handle VAA submissions 2020-08-24 12:56:19 +02:00
Hendrik Hofstadt 738967c8d0 bridge: fix quorum checks 2020-08-22 01:10:45 +02:00
Hendrik Hofstadt 6b113853bd solana: fix missing transfer info and cli checks 2020-08-21 23:41:54 +02:00
Hendrik Hofstadt e3dcc654fb bridge: simplify lockup serialization 2020-08-21 22:56:21 +02:00
Hendrik Hofstadt 549f7ad69c solana: track time on lockups 2020-08-21 19:51:45 +02:00
Hendrik Hofstadt 6a548e5695 bridge: use constant for max guardians 2020-08-21 15:02:02 +02:00
Hendrik Hofstadt 1d960405d1 bridge: check quorum 2020-08-21 12:45:40 +02:00