Commit Graph

129 Commits

Author SHA1 Message Date
bruce-riley 44d6bf84fc
Deploy Unichain testnet (#4134)
* Deploy Unichain testnet

* Add snaxchain to proto
2024-10-10 11:01:08 -05:00
bruce-riley 9bd569d9db
Node: Observation batching with override (#4066)
* Node: Observation batching with override

* Add cutover time

* Code review rework
2024-08-13 11:49:33 -05:00
John Saigle 5042ff14d3
node: Flow cancel enhancements and bug fixes (#4016)
* node: Fix issue where transfers that were loaded from the DB did not add
a flow-cancel transfer on the TargetChain

Flow-canceling is done in the `ProcessMsgForTime` loop when a new
message occurs. However, this was not done when a node restarted and
reloaded transfers from the past 24 hours. As a result it was possible
for the node to calculate a result that showed that the outgoing
transfers for an emitter chain exceeded the daily limit. In effect this
is true but only with the condition that there was incoming flow to
allow this to happen. This appeared to violate an invariant and so the
node did not start properly.

node: Add unit tests when reloading flow cancel transactions from the
database

node: fix lint errors in governor_test.go

* node: Add a command-line flag to enable or disable flow-canceling on restart

Added a command-line flag to enable or disable flow-canceling when
starting the node. This should allow Guardians to disable flow canceling
in the case of future bugs or during a security incident. This should
prevent the need to rollback to earlier Guardian versions. (@mdulin2 )

* node: Use deterministic iteration order over chains when changing Governor state

- Adds a field that stores a sorted slice of chain IDs to the governor.
- Use this field to iterate in a determinstic order when performing
  actions that change the state of the Governor
- This should help Guardians reach a more similar view of the Governor
  in scenarios where iteration order might impact whether a transfer is
  queued. (This is relevant especially in the case of Flow Canceling)
- Cases where only a single VAA is being modified were not changed.
  Iteration order should not matter here and determinstic order may
  may worse for performance when searching for a particular element.

* node: Fix tokenEntry when checking flow cancel for pending transfers

(Squash and merge bug fix from PR #4001)
Similar to a previous issue in the function `ProcessMsgForTime`, the
tokenEntry was not being generated properly.
This should result in queued "small transfers" being able to flow cancel
when they are released from the queue.
Also adds a comment on the CheckedInt64 function to indicate what its
error states mean and when they occur.

Add comments and change variable names for governor_monitoring
- Add function comments to explain what they do and what their error
  states mean
- Adds governor logging to error cases
- Change variable names in publishStatus function. `value` was used
  first to indicate the "governor usage" and then reused to indicate the
  remaining available notional value for a chain. This refactor tries to
  make it clear that these are different concepts

Add unit test for flow cancelling when a pending transfer is
released

- Add a unit test to ensure that, when a pending transfer is released,
  it also does flow-cancelling on the TargetChain (previously we had a
  bug here)
- Add documentation for CheckPendingForTime to clarify that it has
  side-effects

* node: Modify error handling for CheckPending method in the Governor

Previous rollouts of the Flow Cancel feature contained issues when
calculating the Governor usage when usage was near the daily limit. This
caused an invariant to be violated. However, this was propagated to the
processor code and resulted in the processor restarting the entire
process. Instead, the Governor should simply fail-closed and report that
there is no remaining capacity, causing further VAAs to be queued until
the usage diminishes over time.
The circumstances leading to the invariant violations are not addressed
in this commit. Instead this commit reworks the way errors are handled
by the CheckPending, making careful choices about when the process
should or should not be killed.

- Change "invariant" error handling: instead of causing the process to
  die, log an error and skip further for a single chain while allowing
  processing for other chains to continue
- Remove 'invariant error' in TrimAndSumValueForChain as it can occur
  somewhat regularly with the addition of the flow cancel feature
- Return dailyLimit in error condition rather than 0 so that future
  transfers will be queued
- Do not cap the sum returned from TrimAndSumValueForChain: instead
  allow it to exceed the daily limit.
- Modify unit tests to reflect this
- Add unit tests for overflow/underflow scenarios in the TrimAndSumValue
  functions
- Change other less severe error cases to log warnings instead of
  returning errors.
- Generally prevent flow-cancel related issues from affecting normal
  Governor operations. Instead the flow cancel transfers should simply
  not be populated and thus result in "GovernorV1" behavior.
- Add documentation to CheckPendingForTime to explain the dangers of
  returning an error
- Reword error messages to be more precise and include more relevant
  fields. Add documentation explaining when the process should and
  should not die

* node: Add additional metrics for Governor status

Modify the monitoring code and protobuf files to make the status of the
Governor more legible when flow-canceling is enabled. This can be
consumed by Wormhole Dashboard to better reflect the effects of flow
cancelling.

On the level of the Governor:
- whether the Guardian has enabled flow cancel or not

On the level of the Governor's emitters, reports 24h metrics for:
- net value that has moved across the chain
- total outgoing amount
- total incoming flow cancel amount

Currently big transfers are not accounted for as they do not affect the
Governor's capacity. (They are always queued.)

* node: Add new flow cancel parameter to Governor in tests

* node: goimports formatting

* node: Bug fix in changes to governor monitoring

- Fix issue where stats weren't being populated unless flow cancel was
  enabled
- Fix wrong return value used in unit test
- Fix typo in proto variable name
- Move sorting outside of a for loop for efficiency
- Restore unit test that was deleted in the process of rebasing

* node: address prealloc lint error in governor code

* node: Fix "generated proto differs from committed proto"

* node: Fix bug in chainIds allocation

- This resolves a mistake with allocating the chainIds in the governor
initialization that causes nil entries in the slice.
- Add unit tests to ensure that the chainIds slice matches the chains
  map
- Add unit test to ensure that TrimAndSumValueForChain checks for a nil
  pointer to avoid panics

* node: Fix returning nil on err in governor_test.go

* node: Cleanup comments in governor code

* node: fix governor comment

* node: enable flow cancel in governor_monitoring tests

* node: Add flow cancel information to p2p heartbeat features

* node: Remove outdated comment from governor

* node: Upgrade logs to Error from Warn when reloading transfers from
database

* node: Enable flow cancel in check_query test function

* node: Cleanup comments and redundant code in governor

* node: Refactor how the flow cancel token list gets populated

- Only populate the flow cancel tokens list once
- Change default behavior to use an empty flow cancel assets list, rather
than first populating the list and then clearing it
- Refactor the logic around enabling the flow cancel token field for
  governed assets. Now it only executes if flow cancel is enabled,
  rather than operating over an empty slice when flow cancel is disabled
- Modify devnet/testnet configs so that they are responsible for
  returning the correct list of flow cancelling assets

* node: Add unit test for flow cancel feature flag

* node: Move new Governor status proto fields from Emitter to Chain

* node: lint governor_monitoring

---------

Co-authored-by: Maxwell Dulin <strikeout@maxwells-mbp.lan>
2024-07-30 10:27:05 -04:00
Jason Matthyser 627faa7e69
node: governor custom reset release timer delay (#3983)
* Update ChainGovernorResetReleaseTimerRequest protobuf message

* Add numDays argument to governor-reset-release-timer command

* Update governor backend to support numDays argument

* Address review comments

* Add test for resetReleaseTimerForTime()'s numDays parameter

* Address review comments

* Add adminrpc test for ChainGovernorResetReleaseTimer

* Replace hardcoded upper boundaries with maxResetReleaseTimerDays

* Update governor whitepaper to reflect the new argument

* Added default value to governor whitepaper

---------

Co-authored-by: Jason Matthyser <jason@asymmetric.re>
2024-06-20 08:40:03 -04:00
Evan Gray cb34e194f5 proto: sync chains with sdk/vaa/structs.go 2024-05-28 16:43:24 -04:00
Csongor Kiss 9620fca895
node: generalised governance (#3895)
* node/admin: add generalised EVM call governance handler

Handles governance requests of the form:

```
current_set_index: 4
messages: {
  sequence: 4513077582118919631
  nonce: 2809988562
  evm_call: {
    chain_id: 3
    governance_contract: "0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB"
    target_contract: "0xF890982f9310df57d00f659cf4fd87e65adEd8d7"
    abi_encoded_call: "6497f75a000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000f890982f9310df57d00f659cf4fd87e65aded8d70000000000000000000000000000000000000000000000000000000000000140bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe000000000000000000000000000000000000000000000000000000000000000268690000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004beefface00000000000000000000000000000000000000000000000000000000"
  }
}
```

* node/admin: add admin template for evm governance call

* node/admin: add generalised Solana call governance handler

handles governance requests of the form

```
current_set_index: 4
messages: {
  sequence: 4513077582118919631
  nonce: 2809988562
  solana_call: {
    chain_id: 3
    governance_contract: "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5"
    encoded_instruction: "BEEFFACE"
  }
}
```

* node/admin: check address lengths and fix typo in governance handler

* node/admin: better error handling and fix comments

* sdk/vaa: add constants for general purpose governance actions
2024-04-23 11:28:02 -04:00
bruce-riley a883b7f351
Deploy Polygon Sepolia Testnet (#3723)
* Deploy Polygon Sepolia Testnet

* Code review rework
2024-03-12 09:46:28 -05:00
Kevin Peters c7a7d1a56b node: Added RecoverChainId governance support 2024-02-06 16:49:20 -05:00
Ben Guidarelli 7f0a2a29c9
constants: Add Dymension to cosmwasm chains (#3763) 2024-02-01 14:40:37 -05:00
Evan Gray 937af99b94 node: remove batchVAA remnants 2024-01-30 18:05:56 -05:00
Nikhil Suri 9f0892d579
sdk: add stargaze and seda chain IDs (#3726) 2024-01-30 14:40:34 -05:00
bruce-riley a10aab1c6d
Node: Remove Neon support (#3732)
* Node: Remove Neon support

* Code review rework
2024-01-25 12:55:02 -06:00
Nikhil Suri e70f215311
sdk: vaa: add missing chain IDs for gnosis and rootstock (#3624)
* sdk: vaa: add missing chain IDs for gnosis and rootstock

* Add chain IDs to structs_test.go

* Regerate publicrpc protobuf with rootstock chain ID
2024-01-10 15:16:43 -05:00
bruce-riley b7631bfbba
Deploy Holesky Testnet (#3630) 2024-01-08 16:42:10 -06:00
bruce-riley 818038ef80
Deploy Sepolia based L2s (#3606)
* Deploy Sepolia based L2s

* Code review rework
2023-12-20 08:56:14 -06:00
bruce-riley a2cb2a1226
Deploy Mantle to testnet (#3438) 2023-12-11 10:26:56 -06:00
Paul Noel bf9660f75b node/pkg/proto: add wormchain 2023-12-08 10:06:55 -06:00
bruce-riley 0c0158ac13
Node/SDK: Add neutron support via IBC (#3563)
* Node/SDK: Add neutron support via IBC

* Set core addresses in SDK
2023-12-07 09:42:09 -06:00
Paul Noel dee0d1532b node/pkg/telemetry: prometheus remote write 2023-12-06 10:01:37 -06:00
bruce-riley e308b87062
Node: Add cosmos chains over IBC (#3562)
* Node: Add cosmos chains over IBC

* Avoid data race in watcher

* Add Osmosis as an IBC chain
2023-12-01 10:21:07 -06:00
bruce-riley 0a89e23589
Deploy scroll to testnet (#3429)
* Deploy scroll to testnet

* Don't allow scroll in mainnet

* Add scroll to ccq, use batch poller
2023-11-08 14:14:47 -06:00
bruce-riley 9be9a564b6
Node/EVM: Track latest block (#3470)
* Make finality an enum rather than a bool

* Significant code review rework

* Fix merge errors

* Code review rework
2023-11-02 11:59:40 -04:00
Paul Noel b6a5245f89 node: Add get-and-observe-missing-vaas command 2023-10-27 14:44:09 -05:00
bruce-riley 669e2bc40e
CCQ/Node: Guardian Changes (#3423)
* CCQ/Node: Guardian Changes

* Code review rework
2023-10-12 13:20:42 -05:00
Steve 6b3819cc41
wormchain: add upgrade vaa and upgrade handler. Removes set params vaa. (#3292)
* Add chain upgrade vaa and upgrade handler. Removes set params vaa.

* Update node package

* Fix vaa payload test
2023-08-16 20:24:57 -04:00
Nikhil Suri 6aa80d459c
wormchain: setparams gov vaa (#3285)
* node: add new governance VAA for setting default tokenfactory and packet forward middleware params on Gateway

* wormchain: add msg_server handler to set default tokenfactory and pfm params

* node: add gateway template command

* node: fix lint errors

* Update goverance message to be generic

* x/wormhole: add RunInPlaceUpgrade tx cli command

* Merge gateway governance VAAs into a single rpc handler

* update admin client naming for gateway governance messages
2023-08-14 20:37:50 -04:00
Steve 3337783c6d
wormchain: add ibc-composability-mw to gateway (#3273)
* Add ibc-composability-mw to gateway along with updates to node for
ibc-composability-mw and ibc-translator.

* Move governance action to new GatewayModule

---------

Co-authored-by: Nikhil Suri <nikhilsuri@comcast.net>
2023-08-14 10:49:02 -04:00
Nikhil Suri aa44e82f7c
Instantiate allowlist (#3181)
* sdk: add wormchain instantiate allowlist governance VAA

* wormchain: add wasm instantiate allowlist msg handler

* Add cli for instantiate allowlist (#3199)

* Add cli for instantiate allowlist and fix
vaa.BodyWormchainAllowlistInstantiateContract deserialization

* Lint fixes

* Add instantiate allowlist to codec and genesis

* Add MsgDeleteWasmInstantiateAllowlist, update naming to be consistent across all types

* Fix key prefix for GetAllWasmInstiateAllowedAddresses

* Update wasmd tag version

* Fix 5 bit encoding bug

* Add query cli and rpc handler

* Add query cli and rpc files

* use cosmos-sdk method for computing bech32

---------

Co-authored-by: Steve <1848680+misko9@users.noreply.github.com>
2023-08-07 11:18:40 -07:00
derpy-duck 3c0fecc3fa
Relayer: Generic Relayer Guardian Changes for Merging into Main (#3041)
* gRelayer: surrounding files

* modification to get compilation

* restore devnet

* remove generic relayer docker

* remove wait for relayer engine

* keep build time 20

* sh -> bash

* sh -> bash

* Remove comment

* bash -> sh

* Revert "bash -> sh"

This reverts commit 5c37e92fa1.

* bash->sh

* gRelayer: ethereum folder changes for generic-relayer-merge

* add eth-devnet

* Adds .github because workflow needs to install forge

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* update package.json and package-lock.json

* Remove unnecessary types from package.json

* ts-node

* gRelayer: ethereum folder changes for generic-relayer-merge

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* update package.json and package-lock.json

* remove these changes

* Relayer: Natspec documentation in IWormholeRelayer (#3032)

* WIP

* Fixes

* Updated interfaces

* remove bash

* Forward uses same refund chain id and refund address (#3034)

* WIP

* Fixes

* Forward uses same refund chain id and refund address

* Updated interfaces

* Adds .github because workflow needs to install forge

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* SDK minus payload tests

* Rename sdk relayer folder and file

* modify index.ts

* modify path

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* Add three governance VAA actions for generic relayers

* demandOption and const

* Remove forge build warnings

* Add note to interface for resend

* Verify additional VAAs in SDK

* via-ir on unless in Tilt

* Correct IWormholeReceiver interface

* Wormhole message fee now part of quoteDeliveryPrice (#3043)

* Fix to PR 3043

* Remove compiler warning

* Remove files

* remove generic relayer docker

* Fix typo

* Relayer/address drew review (#3060)

* Fix typo in Create2Factory

* Add event for contract upgrades

* Prevent registering contract if it is already registered

* Prevent allowing unset chainId for default delivery provider governance VAA

* memory to calldata for external functions in WormholeRelayerSend

* continue memory to calldata for external functions

* Fix pricing in delivery provider

* Sanity check new default delivery provider isn't 0 address

* Don't save vaaKey as local variable

* cache the length of array rather than iterate every time for vaaKeys

* Replacing memory with calldata in few locations

* Remove stale file DeliveryProviderMessages

* Remove batch VAA sender script

* Remove batch VAA from WormholeSimulator

* Wait for a confirmation in deploy scripts

* remove unnecessary comments

* Fix Delivery Provider Pricing and add a test

* remove console logs

* Revert "continue memory to calldata for external functions"

This reverts commit f322afb6c0.

* Revert "memory to calldata for external functions in WormholeRelayerSend"

This reverts commit 42fcaad884.

* Revert "Don't save vaaKey as local variable"

This reverts commit a9172379c5.

* Revert "cache the length of array rather than iterate every time for vaaKeys"

This reverts commit d61380a9b0.

* Revert "Replacing memory with calldata in few locations"

This reverts commit 94e47b6e72.

* Revert "Fix typo in Create2Factory"

This reverts commit a9f7bdf461.

* Update contract addresses for via-ir

* Update register chain test to only do one registration

* Slight improvements to delivery provider implementation

* typed errors for delivery provider

* Update SDK to have via-ir devnet address

* Fix test

* enable VIA-IR in CI and not in Tilt

* Fix chain id

* get register chain test to work

* correct contract address for via ir

* update sdk consts for via ir address

* base 32 address

* merge

* -f to -r

* relay provider -> delivery provider

* fix await

* Readme changes
2023-06-14 10:27:00 -04:00
Nikhil Suri ee7d0765f9
sdk: add new governance VAA for IbcReceiverUpdateChainConnection (#2590)
* sdk: add new governance VAA for IbcReceiverUpdateChainConnection

* Enforce connectionId to be 64 bytes, add tests in rust sdk

* Update PrependBufferBytesFixed to LeftPadBytes, add template function + command for IBC governance VAA

* Add >64 length check for ibcReceiverUpdateChainConnectionConnectionId in runIbcReceiverUpdateChainConnectionTemplate command

* Update naming of governance VAA to reflect new mapping of channelId -> chainId

* Add TargetChainID to admin commands

* Node: Add IBC update channel to admin verify cmd

---------

Co-authored-by: Bruce Riley <briley@jumptrading.com>
2023-05-12 06:11:21 -04:00
bruce-riley 8a866c3c1d
node: sei testnet support (#2660)
* Sei testnet support

* Set contract addresses

* node/pkg/watchers: add RunWithScissors

* SDK tweaks

* node: revert "node/pkg/watchers: add RunWithScissors" (#2620)

This reverts commit 9b8bed4dbf.

* Make Sei use IBC watcher

---------

Co-authored-by: Paul Noel <panoel007@gmail.com>
Co-authored-by: Paul Noel <35237584+panoel@users.noreply.github.com>
2023-04-18 09:34:01 -04:00
bruce-riley f9758b38e7
SDK/Node: Sepolia deployment (#2567) 2023-04-03 09:24:17 -05:00
bruce-riley 18e8e14402
Node: Circle Integration governance fixes (#2507) 2023-03-16 09:13:50 -05:00
Conor Patrick 0f123dedb1 node: use new action and module for accountant modify_balance 2023-03-16 08:48:25 -05:00
bruce-riley 5023ffec2b
Node: Circle Integration governance support (#2444)
* Node: Circle Integration governance support

* Fix spacing

* Code review rework
2023-03-06 13:23:48 -06:00
marcus-jump 6a1271c824
node/p2p: Protect P2P peers (#2344)
Co-authored-by: marcus-jump, tbjump
2023-02-23 15:51:27 -08:00
bruce-riley a2d09dad4b
Node: Base watcher support for testnet (#2424)
* Node: Base watcher support for testnet

* Add a comment

* Add base to rpc dump command
2023-02-23 18:37:35 -05:00
Conor Patrick b35480f966 accountant: address review comments for modify governance vaa 2023-02-15 06:23:25 -08:00
Conor Patrick 4640b6ae73 node: add modify governance vaa for token bridge 2023-02-15 06:23:25 -08:00
Paul Noel ca72e25a48 node: add dump-rpcs command 2023-02-13 14:47:30 +00:00
Conor Patrick aac92a19e7 wormchain: add migrating contracts with vaa 2023-02-07 12:15:11 -06:00
Hendrik Hofstadt fc64658ce8
node: add admin command to sign existing VAAs (#2183)
* node: add admin command to sign existing VAAs

Change-Id: Ia59c077db1817a3f35ec30544c307448e01455ca

* node: add tests for signing of existing VAAs

Change-Id: I16fca1181fc9d96abb4ebdfad91bc686da517090
2023-01-10 17:54:35 +01:00
Nikhil Suri 0e7c085d71
node: inject wormchain cosmwasm governance messages (#2057)
* node: inject wormchain cosmwasm governance messages

* Use nested hash for defense in depth

* Use keccak.Reset() instead of creating new hash objects

* fix msg_server_wasmd_test

* Updated based on jynnantonix comments

* Check return value of binary.Write

* Include actual error in binary.Write panic case
2022-12-06 11:10:32 -08:00
Josh Siegel 3413f09b8f WH-1921: stub out btc chain @ Closes #1921 2022-11-15 14:45:55 -06:00
Justin Schuldt 1b3590b9ce
BatchVAA protos and Spy updates (#1691)
* gossip.proto - add nonce to SignedBatchObservation

* publicrpc.proto - add nonce to BatchID

* spy.proto - filters for BatchVAA, new VAA endpoint

* node - spy.go allow subscribing to BatchVAAs

* add built Go protos to node/pkg/proto

* improve & simplify Publish logic

* simplify filter match logic

* update protos - consistent naming & types for transaction identifiers

* add Spy unit & e2e tests
2022-11-09 10:39:57 -06:00
bruce-riley 61454a39bd
Node: remove support for Ropsten (#1818)
* Node: Remove support for Ropsten

* Node: Remove support for Ropsten

* Fix build  error
2022-10-31 09:14:01 -05:00
Bruce Riley 58cd430541 node: add xpla to protobuf 2022-10-12 14:23:57 -04:00
bruce-riley 2b582b10b8
node: governor publish gossip (#1538)
* Governor publish gossip

Change-Id: I2b8b1ea84a0c411101a7027acd3a27a6d6464d59

* Update the config publish time

Change-Id: Ic6abf84befb1c20756da2ff66b15a8325dc46067

* Not setting value on enqueued VAAs correctly

Change-Id: I9fd3a5d8fc574f8382125445fa688efdae45b88c

* Publish at most 20 VAAs, not 20 per chain

Change-Id: Ic9dff99c59ee89d57fd79158844a1fe1a0003112

* Switch to using signed messages

Change-Id: I66cddc7477cd477aa77bdadfc346b588f2ae645b

* Publish status only once per minute

Change-Id: I972fb0cf868e89c6f74ae4441471a55df389f4dd

* Minor comment change

Change-Id: I0d3e443cbec7edd282f89c1a5cce5d5ec8776d55
2022-09-26 11:24:30 -05:00
bruce-riley fb9f93e892
node: add command to purge pythnet VAAs (#1636)
* Add command to purge pythnet VAAs

* Add test for purging a single emitter address

* Fix lint error

* Using the wrong delete primative

Change-Id: I80d5294c17279d4e49220d81807e5964a5591721
2022-09-26 09:04:30 -05:00
Justin Schuldt d83e44cf6b
proto - BatchVAA gossip and publicrpc (#1563) 2022-09-09 12:30:22 -05:00