Commit Graph

143 Commits

Author SHA1 Message Date
Ali Behjati 183081cc20
Expose pythnet message buffer idls (#865) 2023-06-09 14:10:28 +02:00
Ali Behjati 989ac4653a
Update .dockerignore (#722)
* Update .dockerignore

* Update .dockerignore + .gitignore

* Fix docker issue

* Update .dockerignore again

* Fix precommit
2023-03-27 16:44:08 +02:00
Jayant Krishnamurthy e995a2b89e
Add CI workflow to publish javascript packages (#707)
* workflows

* try private

* private

* more private

* update files

* fix workflow

* hm

* hm

* bump version

* bump version

* another bump

* text

* update readme

* update package lock
2023-03-21 12:25:30 -07:00
Stanisław Drozd bbc140f2e4
[wormhole-attester] Increase accuracy and improve logging (#653)
* Tiltfile: TILT_DOCKER_REGISTRY def behavior, re-add namespace_create

* wormhole_attester/client v5.0.0: accuracy and logging opimisations

* [BREAKING CHANGE] min_interval_secs switches to milliseconds under
  min_interval_ms
* attestation jobs no longer use preflight checks - this includes a
custom variant of send_and_confirm_transaction(), see util.rs for details
* attestation error logging no longer pretty-prints the error
  structs ({:#?} became {:?})
2023-03-03 13:34:39 +01:00
Stanisław Drozd 1978d73b94
attester: Add an on-chain last attestation timestamp and rate limit arg (#622)
* attester: Add an on-chain last attestation timestamp and rate limit

In consequence, attester clients are able to rate-limit attestations
among _all_ active attesters - because the new last attestation timestamp is kept up
to date on chain. Ultimately, this value being shared by concurrent clients,
this feature limits our tx expenses while fulfilling our preferred attestation rates.

* attester: Use custom error code instead of log for rate limit

* attester: Add defaults for default attestation conditions

* attester: Use a dedicated function for rate limit default

* attester: Option<u32> -> u32 rate limit interval

This lets users pass 0 to disable the feature (0-rate limiting means
no rate limiting at all), which was not possible with the Option type.
2023-02-24 15:03:57 +01:00
Ali Behjati 3f7cffd5b2
[price-service/client] Add e2 test (#559) 2023-02-06 10:04:52 +01:00
Ali Behjati 481c61bc2c
[refactor] Improve typescript codebase (#553)
* Use base tsconfig

* Add lint check

* Fix tilt
2023-02-01 11:26:23 -06:00
Ali Behjati 4c5d0d5e1b
[refactor] Add global lerna (#546)
* Move lerna to the top

* Set version to independent

Packages are versioned independently

* Update packages and the lock

* Add build cache and better reference

* Add lerna docker base

* Add wormhole_attester sdk and some minor impr

* Update tsconfig to fix outDir impact by composite

* Update eth package

* Update p2w to use solidity-sdk

* Change xc-admin CI to lerna CI action

* Add more packages to the list + bugfixes

* Update dockerfiles to have tilt working

* Format the code

* Fix some issues

* Fix the change of usePyth.ts

* lerna build fix

* Fix foundry
2023-01-31 17:09:31 +01:00
Ali Behjati 70fd0a6c15
[wormhole-attester] Move p2w-sdk inside wormhole_attester directory (#534)
* Move p2w-sdk to wormhole_attester

* Update references to the sdk
2023-01-25 18:14:02 +01:00
Ali Behjati b4cf527f00
[price-service] Add price service client and sdk to this repo (#525)
* Move price service to server directory

* Update references to price service

* Add pyth-common-js as the service client

* Update package names

* Add pyth-sdk-js

* Rename the sdk

* Change readme a bit
2023-01-25 17:17:32 +01:00
Ali Behjati 084acdb57e
[refactor] Convert hyphen to underscore in the directory tree (#524)
* Move price-service to price_service

* Update references to price-service

* Rename target-chains to target_chains

* Update references to target-chains

* Rename tilt-devnet to tilt_devnet

* Update references to tilt-devnet

* Rename wormhole-attester to wormhole_attester

* Update references to wormhole-attester

* Rename multisig-wh-message-builder

* Update references to wh-msg-bldr

* Fix dockerfile issue

* Rename remove-executor to remote_executor

* Update references to remote-executor

* Rename xc-governance-sdk-js

* Update references to the governance sdk

* Move docker-images to docker_images

* Update references to docker-images
2023-01-24 19:06:22 +01:00
Stanisław Drozd 7202b9339e
wormhole-attester: Add a previous attestation timestamp field (#488)
* wormhole-attester: Add a previous attestation timestamp field

This change bumps price batch format to v3.1 with a new backwards
compatible field - prev_attestation_time. This is the last time we've
successfully attested the price. If no prior record exists, the
current time is used (the same as attestation_time).

The new field is backed by a new PDA for the attester contract, called
'attestation state'. In this PDA, we store a Pubkey -> Metadata
hashmap for every price. Currently, the metadata stores just the
latest successful attestation timestamp for use with the new field.

* wormhole-attester: Use publish_time instead of attestation_time

* wormhole_attester: use prev_publish_time for non-trading prices
2023-01-19 14:38:45 +01:00
guibescos f3f28b4214
[tilt] make multisig approvals easy (#512)
* For convinience

* Fix comment
2023-01-18 22:05:16 -06:00
guibescos 0812994745
[tilt] Bump pyth-client to 2.20 (#505)
* Bump to 2.20

* Rename to pyth_oracle.so

* Cleanup
2023-01-18 11:35:02 -06:00
Stanisław Drozd 99246c24d4
Drozdziak1/refactor p2w autoattest py (#502)
* p2w_autoattest.py: Stop using non-daemon mode

* wormhole_attester: Remove non-daemon mode and its uses, v3.0.0

We used to need non-daemon mode to run a manual healthcheck on the
attester process and its configuration. Currently, we're able to
handle this much better with the build-in healthcheck HTTP
endpoint. For production, we should be able to get rid of
p2w_autoattest.py entirely.

Co-authored-by: Stan Drozd <stan@pyth.network>
2023-01-17 16:01:16 +01:00
Ali Behjati daad5c6dc5
[governance] move governance related components under this directory (#489)
* [governance] bring related stuff in governance dir

* [governance] fix changes
2023-01-13 18:58:44 +01:00
guibescos 7cc5123a53
Cleanup local environment (#487)
* Cleanup local environment

* Default Pyth address to match Pythnet

* Cleanup

* Make vault the same as on mainnet

* Fix mesh

* Pyth owner address updated

* Revert some changes lol

* Revert more changes

* Restore oracle address

* Add comment to create key
2023-01-13 11:18:48 -06:00
Ali Behjati 0e55d0808d
[price-service] Move to top (#474)
* Move price service to top

* Update the paths and docs

* A little cleanup
2023-01-13 16:26:43 +01:00
Daniel Chew ad864c697a
[price-service] add /get_vaa endpoint that serves cache and db vaas (#482)
* add /get_vaa endpoint that serves cache and db vaas

* update env vars

* fix precommit errors

* fix precommit errors

* rename removeExpiredValuesFromVaasCache to runCacheCleanupLoop

* move initialized envOrErr to constructor or func arg

* use setInterval

* update pyth-price-service env vars on tilt devnet

* use undefined instead of null

* use status code

* make web-api an env var

* update env var

* fix precommit

* fix precommit

* fix changes

* remove env vars from tilt-devnet

* address changes

* fix lint issues

* fix linting issues again

* bump package version

* remove unused imports
2023-01-13 16:08:27 +01:00
Ali Behjati fedb92e446
Remove unused components/projects (#481)
* Remove unused components/projects

* --amend
2023-01-12 13:52:43 +01:00
Jayant Krishnamurthy 7c2e02ea0b
[price-service] Document the spy filters in .env.sample (#472)
* document the filters

* better doc

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2023-01-11 18:58:33 +01:00
Stanisław Drozd 0a93d47391
wormhole-attester: port the v1.3.0 healthcheck hotfix (#454)
* wormhole-attester: port the v1.3.0 healthcheck hotfix

This PR fixes a missing assignment to HealthCheckState's enable
flag. This would cause the attester to ignore all settings (including
defaults) and keep the enable flag set to false because we would never
bother setting it from attestation_cfg that came at runtime.

The bug is fixed and the healthcheck behavior is hardened. Currently,
the lazy_static block will explicitly initialize the global with
default values from attestation_cfg (enable is true, window size is
100). This prevents a similar human error from disabling the
healthcheck. Secondly, main.rs overwrites the default values using the
HealthCheckState::new() constructor, instead of individual struct
member assignments. This ensures that all necessary values or their
defaults are passed as the desired healthcheck state.

* p2w_autoattest.py: Get debug output from first attestation

* wormhole-attester: fix ()-less function bug, harden usize convertion

This change fixes a bug that would cause a gigantic allocation to
happen, after the attestation_cfg::default_healthcheck_window_size
function is taken without being called and converted to a very large
usize value. This would result in a big allocation which would crash
the attester. At the core it's a misunderstanding about "Fn() as
usize" conversion which unfortunately is safe Rust.

* Trigger build

* wormhole-attester: Fix a misuse of a mutex guard

This commit changes the `let hc = <lock the mutex>` into a direct
assignment to the locked mutex guard. Rust mutices are typically
scope-based which makes using them in variables more error prone.

* Dockerfile.client: Remove unused ADD wormhole-attester.

This speeds up the build of the container, and prevents useless
triggers from the attester codebase

* p2w_autoattest.py: simplify log filtering to just info
2023-01-05 15:27:15 +01:00
Stanisław Drozd 01c4661985
Repo structure refactor (#449)
* Repo structure refactor

This change introduces major codebase layout changes in three areas:
* Tilt devnet lives in tilt-devnet/ - all k8s and docker files,
scripts, local testing private keys are moved to this directory.
* pyth2wormhole becomes pyth-wormhole-attester and is relocated to
wormhole-attester/ - This long-needed rename will hopefully eradicate
most of the confusing naming around the attester. The Rust client binary
becomes pyth-wormhole-attester-client.
* Target-chain code lives in target-chain/ - This leaves just the
attester, third_party and pythnet-specific things at top-level.

Other opportunistic changes:
* Fixed rebuild trigger for Dockerfile.wasm

These items are a fraction of the necessary structure changes in the repo.

* cosmwasm: fix contract after faulty merge

* .github: remove unused dependabot config

* Fix path references in .github and .pre-commit-config.yml

* .github: Rename attester references to pyth-wormhole-attester

* .pre-commit-config.yaml: fix paths and run all commit hooks

* p2w-relay: Fix faulty merge resolution in favor of origin/main

* Dockerfile.pyth_relay: Fix Ethereum path reference

* Dockerfile.solana: Trip early cache with arbitrary change

* Dockerfile.pyth_relay: typo

* p2w-relay: fix evm build in npm script

* Dockerfile.solana: Retry invalidating cache again

* near -> target-chains/near

* wormhole-attester: bump on/off-chain major versions due to rename

Attester packages were renamed. This possibly breaks most dependees.

* Dockerfile.solana: Improve decoy-crate to have a real lib target

* .github/[...]/pyth-cosmwasm-contract.yml: typo

* rust-toolchain: Bump rust to stable 1.63

* rust-toolchain: use christmas nightly

* empty commit to trigger build

* attester-image-push.yaml: keep xc-attest image name intact

* multisig-wh-message-builder: remove accidental revert
2023-01-04 14:46:42 +01:00
Daniel Chew 378e99b345
add binary query string to /latest_price_feeds (#445)
* add binary query string to /latest_price_feeds

* fix precommit

* fix both rest and ws tests

* bump package version

* fix tests to use the latest schema
2023-01-02 17:38:52 +09:00
Jayant Krishnamurthy 695b096bb8
[cosmos] Misc code cleanup (#446)
* cleanup some stuff

* store things as Coin

* fix ci

* cleanup

* fix

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-29 07:01:19 -08:00
Daniel Chew 9ac61742c3
add binary option to subscribe to binary vaas (#444)
* add binary option to subscrube to binary vaas

* change property name

* combine verbosity and binary to a single config

* add tests
2022-12-29 18:35:12 +09:00
Jayant Krishnamurthy 6b07ae607c
Add query methods to cosmwasm contract (#441)
* implement query operations

* more governance

* revert

* update the terra sdk?

* wtf

* fix ci

* add tests

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-27 09:59:48 -08:00
guibescos bddcb69351
[multisig-cli] Refactor check that multisig vault already exists (#437)
* Refactor check that multisig vault already exists

* [Multisig] add transfer auth to multisig (#439)

* Checkpoint

* Cleanup

* Revert "[Multisig] add transfer auth to multisig (#439)" (#440)

This reverts commit 5fcbb4ca1f071f9da98946aededc2174f3e917bb.
2022-12-21 17:26:33 +01:00
Ali Behjati 54846061dd
[price-service] Update docs + compose-file (#432)
* [price-service] Update docs + compose-file

* Address reviews

* Fix pre-commit issues
2022-12-20 10:08:06 +01:00
Thomaz Leite 3da1e86d56
Update README.md (#435) 2022-12-19 18:02:07 +00:00
Jayant Krishnamurthy 6b29d9704a
[cosmos] Pay fee + mock wormhole for testing (#433)
* added handler

* create binary for vaas

* updating tests

* add fee test

* blah

* simplify

* simplify

* cleanup5

* Add fees to the terra relayer

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2022-12-19 06:44:57 -08:00
guibescos f6ad2d6544
Refactor (#431) 2022-12-19 13:20:32 +01:00
guibescos 51754457a6
[multisig-cli] Add support for json (#430)
* Draft

* Add verify for instruction payload

* Typos

* Refactor json parsing
2022-12-15 21:45:58 +08:00
guibescos e484f5cbb7
Check duplicates (#427)
* Check duplicates

* Cleanup

* Multisig/refactor wormhole to avoid many rpc calls (#428)

* Refactor wormhole

* Fix wasm bug

* hasWormholePayload becomes sync
2022-12-15 01:38:13 +08:00
Ali Behjati 09f8af74ed
[eth] Complete syncPythState.js (#425) 2022-12-13 17:54:15 +01:00
Jayant Krishnamurthy 024d73a8a8
[cosmos] Implement set fee governance instruction (#423)
* cosmos stuff

* it builds

* fix existing tests

* adding tests

* adding tests

* tidy

* cleanup

* fix

* update deploy script

* doh

* gr

* mabye

* mabye

* pr comments

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-13 08:46:07 -08:00
Ali Behjati f45d6757e2
[price-service] Make gap metrics more accurate (#426)
* [price-service] Make gap metrics more accurate
* Bump version to 2.2.3
2022-12-13 15:52:02 +01:00
Stanisław Drozd f69a91d97c
Add the Squads Mesh program to Tilt and initialize a Vault for it (#421)
* solana-devnet: Deploy a copy of the Mesh multisig program

* solana/keys: Add keys for multisig testing

* *.py: Remove airdrop, use devnet_setup.sh keypair instead

* Dockerfile.p2w-attest: Improve caching

- Move cheap Python script additions after the expensive rust build
- Cache Cargo's package cache to shorten the "updating crates.io registry" build steps

* Add a multisig Tilt resource, k8s yaml and runtime script

This contains most of the work on Tilt/testing harness side.

* multisig-wh-message-builder: Add init-vault subcommand

This new subcommand enables the runtime Python script to create a
multisig vault on the fly on the mock Solana devnet.

* multisig-wh-message-builder: findProgramAddress -> getMsPDA

* mutlisig-wh-message-builder: apply review advice

- Use default mesh program address
- remove unused program.json
- remove redundant null checks
- hardcode vault address (it is deterministic against the constant
mesh program pubkey)
- Start depending on solana-devnet in Tilt
- Add carol to vault and set threshold to 2
2022-12-13 14:05:06 +01:00
Ali Behjati 20abde050b
Fix Vaa key for cache/metrics (#424) 2022-12-09 18:19:39 +01:00
Ali Behjati 6e279c84bb
Update the VAA hash to use payload hash (#422)
* Update the VAA hash to use payload hash

* Bugfix
2022-12-09 14:53:01 +01:00
Ali Behjati b1aea626e9
[eth] Add new networks and their configurations (#418)
* Add new networks RPCs

* Update governance sdk to support Wormhole receiver

* Fix receiver deployment script bugs

* Add new network configurations

* Add a comment about merging wh and receiver chains
2022-12-08 18:14:18 +01:00
guibescos a0d2422cf4
[multisig] Improve verify, add localnet (#420)
* Improve verify, add localnet

* Restore something

* Format

* Remove option
2022-12-08 22:27:31 +08:00
Ali Behjati e536b3a61e
[attester] Remove mapping from testing config (#419) 2022-12-08 14:03:27 +01:00
guibescos 90a9037ae1
Add some function to fetch the multisig state (#416)
* Add fetchers

* Cleanup

* Cleanup

* Restore index

* Format

* Typo

* Fix for loop

* Add offset option
2022-12-07 19:07:32 +08:00
guibescos a17e5b0cc0
Fix typo (#417) 2022-12-07 11:33:06 +08:00
Jayant Krishnamurthy a3199b7d28
Integration test for attestations (#413)
* integration test ???

* update

* better logging

* hm

* convert ids

* fix conversion

* what

* speed things up

* handle dynamic symbols properly

* pr comments

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-06 09:57:43 -08:00
Ali Behjati 4821b877e3
[eth] Improve and automate deployment process (#412)
* Bump contract version

* Some refactoring to add types with JSDoc

* Use better RPCs for some networks

* Remove unneeded migration files

* Add initial syncPythState script that does upgrade

* Update truffle-config for new gas values
2022-12-06 17:56:21 +01:00
Jayant Krishnamurthy 15708d552d
Fix formatting for new nightly rust (#415)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-05 10:02:58 -08:00
Ali Behjati df3297e430
[attster] Remove while true and wait instead (#411) 2022-12-05 18:34:31 +01:00
Jayant Krishnamurthy 3beffdfe46
Configure symbol groups by name (#403)
* Refactor to make this change easier

* stop mutating AttestationConfig

* get the product names also

* ok

* refactor

* cleanup

* more cleanup

* more cleanup

* comment

* i think this works

* fix stuff

* clippy

* more cleanup

* main

* main

* fix formatting

* blah

* test

* cleanup

* fix python

* config

* fix test

* grr

* grr

* comments

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-02 09:35:33 -08:00