Commit Graph

78 Commits

Author SHA1 Message Date
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
Leo 79cc6a9f46 bridge: allow specifying skip_preflight in debug VAA submission
This allows forcibly submitting a failing VAA on-chain in cases where
the preflight check would hinder debugging.

It does not change behavior of guardiand.

Co-authored-by: Hendrik Hofstadt <hendrik@nexantic.com>
Change-Id: I63df22049ad27f659dc0638190edd20628b7a338
2021-05-31 13:33:43 +00:00
Leo 45639b18fb bridge/pkg/solana: fix package name and remove unused lockChan
Increase VAA submission timeout.
Change-Id: I5e774f2930e2f0d865d733eee2f0bb01da1b82f3
2021-05-31 13:33:32 +00:00
jschuldt 16157d339d Add publicrpc endpoint for external clients.
- Distribute raw heartbeats via new proto package publicrpc

- Manage channel subscription on client req/close.

- Expose publicprc endpoint in devnet Service.

Change-Id: Ic96d624733961aa56e00b03c3b5cff6af11523a4
2021-05-24 13:38:58 -05:00
Hendrik Hofstadt 9f514e2786 rename ChainLock to MessagePublication
Change-Id: If74e74c00957c202c7de1cc61204b6cc12ad3a8a
2021-04-19 14:27:06 +02:00
Leo 9c1d6ee00c bridge: add network heights and guardian address to heartbeat message 2021-02-10 01:57:54 +01:00
Yuriy Savchenko f36ecc34f7
Terra support enabled in production mode (#173)
* Terra support enabled in production mode
2021-02-04 11:26:01 +01:00
Leo 5256d2025a bridge: refuse to use deterministic keys in production 2021-01-29 12:40:55 +01:00
Leo ff298ffac6 bridge: fix one more Terra typo 2021-01-27 14:52:32 +01:00
Leo c5b59ac6a0 bridge: fix terraChainID typo
I share the blame for missing this during review :P
2021-01-27 01:58:18 +01:00
Leo 14441680d0 bridge: add initial set of basic Prometheus metrics 2021-01-25 20:17:58 +01:00
Hendrik Hofstadt fd6c54de83
bridge/pkg/solana: use polling GetProgramAccounts watcher (#156)
This mitigates https://github.com/solana-labs/solana/issues/9909 by
polling GetProgramAccounts with a server-side filter. It also removes
the agent dependency for the lockup observation logic - the agent is now
used for transaction construction only.
2021-01-21 11:31:32 +01:00
Leo c0eef2fe9b adminGuardianSetUpdateToVAA: check for duplicate guardian keys
Sanity check.
2021-01-21 00:25:38 +01:00
Leo ea21b1782f Explicitly document required command line arguments
Cobra does not support automatic documentation of positional arguments
(see https://github.com/spf13/cobra/issues/378).
2021-01-21 00:01:34 +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
Leo b077104086 bridge: log own peer ID at startup 2020-12-06 20:26:12 +01:00
Yuriy Savchenko cc412605c7
Terra key moved out from env variable, VAA submission on Terra made async (#129)
* Terra fee payer key moved from environment variable into the separate file

* Removed closed issues from the comments, VAA submition made async

* Review comments fixed
2020-11-30 19:24:39 +01:00
Leo 106fecca00 bridge: always gate Terra features on the main feature flag 2020-11-30 17:13:48 +01:00
Leo 120dfab49e bridge: type alias for readiness components 2020-11-29 17:07:15 +01:00
Leo c31777d1b3 e2e: add bidirectional end-to-end tests 2020-11-29 17:07:15 +01:00
Leo 561852d499 bridge: simple readiness check 2020-11-29 17:07:15 +01:00
Leopold Schabel 8306a83833
solana/agent: listen on UNIX socket (#122)
This allows us to use UNIX filesystem permissions for access control.

Previously, any process in the network namespace could connect to it,
which is insecure for obvious reasons.

Verified that correct permissions are set:

```
# ls -lisa /run/bridge/
total 8
31996269 4 drwxrwxrwx 2 root root 4096 Nov 23 21:58 .
14676759 4 drwxr-xr-x 1 root root 4096 Nov 23 21:58 ..
31996306 0 srwx------ 1 root root    0 Nov 23 21:58 agent.sock
```

Fixes #119
2020-11-24 09:48:44 +01:00
Leo 471417cd6e bridge: use GPG-armored binary protobufs for keys 2020-11-20 22:40:42 +01:00
Leo 0152a00114 all: rename LockupObservation to SignedObservation
We observe things other than lockups, account for it.
2020-11-20 22:35:00 +01:00
Leo 3e3e9dd651 bridge: fix typo in flag errors 2020-11-20 21:18:29 +01:00
Leo 66430cb5be bridge: implement guardian set update submission node admin service
Tested on a live devnet via `scripts/test-injection.sh 0`.

ghstack-source-id: 92489c2455
Pull Request resolved: https://github.com/certusone/wormhole/pull/104
2020-11-19 12:57:21 +01:00
Leo 7545d2b803 terra: disable in production mode
ghstack-source-id: c22885f121
Pull Request resolved: https://github.com/certusone/wormhole/pull/103
2020-11-19 12:57:21 +01:00
Leo 798ffec09c bridge: implement keygen command
Tested using `/guardiand keygen /bar --desc foobar`.

ghstack-source-id: 9f96ce7c0c
Pull Request resolved: https://github.com/certusone/wormhole/pull/91
2020-11-19 12:57:21 +01:00
Leo d9f8174d76 bridge: implement bridge key serialization
ghstack-source-id: f218021514
Pull Request resolved: https://github.com/certusone/wormhole/pull/90
2020-11-19 12:57:21 +01:00
Yuriy Savchenko 1ca2e29916
Terra support added (#79)
This commit adds initial support for the Terra blockchain.
2020-11-16 13:28:07 +01:00
Leo a4058512d5 bridge: migrate cmd/ to cobra
Reviewer note: Does not touch any of the business logic. Avoided
renaming files whereever possible to make it easier to spot differences.

Verbatim migration, in a future CL, we could replace some of the
flag validation code with cobra features and eliminate the global vars.

Moved the dlv tool definition out of the way for the top-level wrapper.

tools/bin/cobra is a helper utility that generates boilerplate
(we slightly deviate from their default scheme by having guardiand
in a separate package, rather than stuffing everything into cmd/)

ghstack-source-id: caec9a38a6
Pull Request resolved: https://github.com/certusone/wormhole/pull/67
2020-10-28 22:47:12 +01:00
Leo 6c7ca964e4 Remove outdated TODO comments
- Metrics tracked in #11.
- Timeout and retransmits covered in #21.
- Dependency injection doesn't make sense at this scale.
- `-1` on `GenerateKeyPair` means "this doesn't make sense for Ed25519,
  please crash if anyone ever tried to generate RSA keys".

ghstack-source-id: 8951628351
Pull Request resolved: https://github.com/certusone/wormhole/pull/66
2020-10-28 22:47:12 +01:00
Leo 11c74dd692 bridge: refactor p2p logic into pkg/p2p
ghstack-source-id: 86417c1301
Pull Request resolved: https://github.com/certusone/wormhole/pull/65
2020-10-28 22:47:12 +01:00
Leo fd27570637 bridge: remove all supervisor.SignalHealthy calls
Supervisor does not back off tasks that failed in a healthy state.

There are a couple places where we rely on supervisor for
application-level backoff, so we always want back-off. The distinction
is meant to enable runnables to implement their own specific back-off
logic, which we don't, so we can safely ignore it.

Fixes #37

ghstack-source-id: c756381b1b
Pull Request resolved: https://github.com/certusone/wormhole/pull/64
2020-10-28 22:47:12 +01:00
Leo 8be34ac657 bridge: refactor processor logic into pkg/processor
This increases modularity in preparation for integration testing
and addition of a CLI command hierarchy.

ghstack-source-id: 9c94373236
Pull Request resolved: https://github.com/certusone/wormhole/pull/63
2020-10-28 22:47:12 +01:00
Leo bdd9d96559 bridge: bypass p2p for our own signatures
ghstack-source-id: ce2bbc780f
Pull Request resolved: https://github.com/certusone/wormhole/pull/60
2020-10-28 22:47:12 +01:00
Leo 45d10618ce bridge: verify LockupObservation signature
Final missing piece of the aggregation mechanism - signatures are now
verified before storing them in the aggregation.

ghstack-source-id: 3bb57c4886
Pull Request resolved: https://github.com/certusone/wormhole/pull/59
2020-10-28 22:47:12 +01:00
Leo 55fd671228 bridge: correctly calculate 2/3+ majority
Adds test vectors.

ghstack-source-id: 1f7e0d783f
Pull Request resolved: https://github.com/certusone/wormhole/pull/58
2020-10-28 22:47:12 +01:00
Leo 509d9c3d73 bridge: use mlockall(2) to prevent pages from being swapped out
The extra capability is harmless and is, at worst, a DoS risk.

ghstack-source-id: d30b50dbca
Pull Request resolved: https://github.com/certusone/wormhole/pull/55
2020-10-22 16:51:56 +02:00
Leo f872d0be44 bridge: improve VAA submission logging 2020-10-22 13:36:08 +02:00
Leo 096d048703 bridge: log submission for cross-submissions to Solana
ghstack-source-id: 1cf9ff2244
Pull Request resolved: https://github.com/certusone/wormhole/pull/54
2020-10-22 12:20:14 +02:00
Leo 58dcc43f17 bridge: do not resubmit submitted VAAs during aggregation
Fixes #49

ghstack-source-id: 8e03ec38f6
Pull Request resolved: https://github.com/certusone/wormhole/pull/53
2020-10-22 12:20:14 +02:00
Leo e5e6690f35 bridge: have all nodes submit VAAs to Solana
VAAs are deduplicated by the on-chain contracts. For Ethereum,
submission happens outside of the bridge anyway, and for Solana, the
first tx to be confirmed wins. Subsequent attempts to submit it
will fail in preflight, so the fee won't be spent multiple times.

This eliminates the need for leader selection and fixes #20.

ghstack-source-id: 60388d532c
Pull Request resolved: https://github.com/certusone/wormhole/pull/51
2020-10-22 12:20:13 +02:00
Leo 08156ca438 bridge: move initial guardian set fetching to pkg/ethereum/watcher.go
This removes the special case in the processor. The initial guardian set
is now treated like a regular guardian set update, and the devnet
update check is executed on every update.

Fixes an edge case where processing a guardian set update would fail
with a spurious `abi: attempting to unmarshall an empty string while arguments are expected`
error, leaving the node in a bad state since restarting ethwatch
wouldn't cause the guardian set to be re-fetched.

ghstack-source-id: e580a65e90
Pull Request resolved: https://github.com/certusone/wormhole/pull/46
2020-10-22 12:20:12 +02:00
Leo 3b35ddc1ce bridge: propagate panics from runnables
Any error that can be recovered by restarting a runnable
can also be recovered from by restarting the entire process.

If we encounter a panic, it's safer to restart the process than
attempting to limp along by restarting the runnable.

We always assume that an external process manager will restart
our process if it crashes. We already rely on this behavior for
libp2p errors which we handle by terminating the process, since libp2p
maintains global state that we can't clear.

ghstack-source-id: 2f20ef764d
Pull Request resolved: https://github.com/certusone/wormhole/pull/45
2020-10-22 12:20:11 +02:00
Hendrik Hofstadt d537f976f9 bridge: setup pubsub before connecting to bootnodes; buffer observations 2020-08-31 16:11:09 +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
Leo 5a72d9029a VAA guardian devnet submission 2020-08-27 17:46:40 +02:00
Leo afa70fd473 Submit ETH VAAs to Solana for data availability 2020-08-24 16:13:27 +02:00
Leo c370a94911 Remove instructions for running devnet_setup.sh 2020-08-22 11:03:20 +02:00