Commit Graph

28 Commits

Author SHA1 Message Date
Jonathan Claudius bad4f7061b
Adds unit-tests and functional improvements to guardian signature verification (#1068)
* Add more comprehensive structs unit-tests

* Make VerifySignatures fail on duplicate addresses

* Adjust duplicate detection to guard on signatures instead of addresses

* Add monotonic check in VerifySignatures

* Move logic into VerifySignatures and add more test cases

* Add a paranoid check for duplicate signers

* Make VerifySignatures unit-tests less contrived

* Add more verify signature test cases

* Refactor VerifySignatures tests

* Add VerifySignature fuzz tests

* Add tc.result checking instead of hardcoded true

* Change comparison so it throws debug on failure for fuzz tests

* Add unit-tests for observation signature logic

* Fix comment typos

* Refactor observation tests

* Add missing test case

* Fix VAAInvalidSignatures test case label

* Clean up unit-tests for observation and structs

* Change errorString convention in test

* Format Signature Verification Test Cases

* Remove unnecessary casting

* Add multi-signer same key cases

* Fix err usage in test cases

* Remove duplicate getVAA
2022-04-11 19:14:41 -04:00
Jonathan Claudius 36cabf0e6a
Remove dead code path (#1056) 2022-04-08 19:37:23 -04:00
Jonathan Claudius 5355f87206
Add unit test for 0 case and move to testify (#1023) 2022-03-28 09:54:18 -04:00
justinschuldt b73ebd1b9c fix digest string represenation
commit-id:617ade15
2022-03-18 10:49:34 -05:00
Hendrik Hofstadt 4bc5daa8d1
Hardening against governance message spoofing (#938) 2022-03-03 17:55:02 +01:00
Leo 68bdd4b0b6 node/pkg/processor: expire late observations
Fixes https://github.com/certusone/wormhole/issues/685.

Example occurrence this fixes: https://i.imgur.com/gZWKf1n.png

Possible future optimizations include:

- Ignore late messages in the processor (but we can only ignore
  them post settlement time, so we need the cleanup logic regardless).

- Ignoring late observations from other nodes.

- Using the stored VAA to calculate misses.

- Drop incomplete local observations. However, this is not trivial
  since we do not know the message ID for those.

commit-id:47e1e59f
2022-01-25 22:36:24 +01:00
Leo 8546ee6e14 node/pkg/vaa: remove error return value from SigningMsg
serializeBody always returns a nil error.
Remove the error return value.

commit-id:5e150f69
2021-12-20 16:05:22 +01:00
Leo 16c9f9036b node/pkg/processor: change threshold for Discord notifications
Change-Id: I09060ad46a47b6293b18cffd717492098ad6dda0
2021-11-05 15:42:15 +00:00
Leo f59f4bbb2e node/pkg/processor: ignore late observations for quorum VAAs
This avoids gossip spam and false positive Discord notifications
when a connected node catches up and late observations are made.

Change-Id: If9562661487d3d3d5138d27298b005f278f9e9ce
2021-10-29 19:14:05 +00:00
Leo 24ee63d9a1 node/pkg/processor: increase confirmed VAA timeout to five days
This'll make governance more relaxed.

Change-Id: I55946058f01ec4f08f60670725522f6d7d9346bb
2021-10-29 19:13:52 +00:00
justinschuldt 8fed2d0659 remove unused bigtable data
Change-Id: I2b4a798b99f11be2ce9869d15dc633e1568974e1
2021-10-29 12:56:27 +00:00
justinschuldt 5f1e5dd211 save inbound VAA to bigtable
Change-Id: Id8ca26088daff3734a32d061029231d5846a020e
2021-10-29 10:09:48 +00:00
Leo ee81e667d3 node/pkg/processor: kill "received observation by unknown guardian"
Log message keeps causing confusion even at WARN level
(who would've thought :D)

Change-Id: I3dc7d0ed054f1531a69953ebccee053f58f81ad5
2021-10-12 21:48:44 +00:00
Leo 659b7b2547 node: add Discord notifications for missing signatures
Change-Id: If09643c2e02c4c166577082cd9be9124d2e775d4
2021-10-06 14:12:21 +02:00
Leo b577b70b2e node: add MessageID to observation messages
This allows us to associate an observation from the log
for messages that the local node did not observe.

Change-Id: I6ece7bfe3e6b878bdb7ee4ac03c81cb424a329b3
2021-10-04 23:31:00 +02:00
Leo 39b41c2d6c node/pkg/processor: reinstate source label
This was lost when removing the v1 submission logic.

Fixes certusone/wormhole#440

Change-Id: Ic997421aed88f64949e2dd3c55ad9230cb80ea3d
2021-10-04 11:56:22 +02:00
Leo bd5f957e1b node: remove unused terraChainID command line flag
Change-Id: I5f02faa3f00098725e7242c289f65978c4879c3c
2021-10-03 21:03:43 +02:00
Leo 92d3ee577c node/pkg/solana: log quorum and emitter chain on settled VAAs
Change-Id: I8162ed3bfb77d0708a9dd910eb1ba757d73bc246
2021-10-01 16:18:16 +02:00
Leo 16391185ec node/pkg/processor: log quorum for unsubmitted nil VAAs
Change-Id: I4b29e2813209195c7e1698afb6772f2b18ebfde9
2021-10-01 09:43:18 +00:00
Leo 096707a9c4 node/pkg/processor: fix crash when observation is made while gs is nil
Rare race condition. Found locally when manually injecting observations.

Change-Id: Id10d10ad4cfe38b5f4b00a30978940e928e6bc96
2021-10-01 09:43:18 +00:00
Leo 0feaed4e80 node: include and log TxHash field in SignedObservation
Optional metadata for debugging. Allows tying a received observation
to an on-chain transaction even if the node missed the observation.

Change-Id: Ie50c10c8ab7f65469555674d90645f91092fb2e3
2021-10-01 09:43:18 +00:00
Leo 6ab0fe3855 node/pkg/processor: add more log fields to message observations
Change-Id: I19d804b6668623943f798356a7ed81c1000fa377
2021-10-01 09:43:18 +00:00
Leo 7998d04554 node/pkg/processor: increase timeout for observed VAAs to 24 hours
In cases where we observed a VAA, there is no possibility of gossip DoS.
Increase the timeout to 24 hours to facilitate manual interventions
(like submission of governance VAAs or node restarts/catchup).

Keep the existing five minute timeout for observation-less VAAs.

Change-Id: Ic626108190bd60cf812daadbe191b31cc48c7296
2021-10-01 09:43:18 +00:00
Leo 7914512797 node: handle inbound SignedVAAWithQuorum messages
Change-Id: I539155bb4e59d728ea528e6e2f70b6fbb3338a41
2021-09-13 17:51:47 +00:00
Leo ec07ed0288 node: broadcast a SignedVAAWithQuorum message when a VAA reaches quorum
Change-Id: I5dbefcbcf146bda6e3ef9607a7b49ca1cdf5321d
2021-09-13 17:51:47 +00:00
Leo 9a85dbafe5 Add Go linting stage to CI
rustfmt appears to be a little more complicated since it wants to
download dependencies and needs nightly Rust.

Change-Id: Ia348def30a6459ae2ab6c29a8c3a413216f5eb4b
2021-08-31 08:58:17 +00:00
Leo 4ac19518bd node: remove remaining "bridge" mentions
Ensure there's no core vs. token bridge ambiguity.

Breaking changes to the CLI:

* "guardiand bridge" CLI is now "guardiand node"
* --solanaBridgeAddress is now --solanaContract
* --bridgeKey is now --guardianKey

The Heartbeat proto message had one of its fields renamed from
BridgeAddress to ContractAddress, but this won't break the wire
format and the only consumer appears to be the CLI.

Change includes a "go mod tidy" - it insisted.

Change-Id: Id8b312827737f07f2d5f3944ebce469d946e7f51
2021-08-31 08:58:17 +00:00
Leo e98463cfe3 node: rename bridge/ to node/
Calling guardiand a bridge dates back to v1 and no longer makes sense.

Change-Id: I27d24a5d7a64c3e37d6a5ce9c402c6248ad9c59e
2021-08-26 11:36:36 +02:00