Commit Graph

126 Commits

Author SHA1 Message Date
Tom Pointon 079f8cc0b7
Add AptosAuthorizeUpgradeContractInstruction to xc-governance-sdk-js (#328) 2022-10-17 16:20:23 +02:00
Ali Behjati f77987df70
Fix logging of vaa as hex (#345) 2022-10-13 11:08:02 -05:00
Stanisław Drozd b3dbc96086
pyth_publisher.py: Add a new symbol every 2 minutes (#331)
This change will help us verify the correctness of the mapping
crawling logic in p2w-attest.
2022-10-11 13:46:26 +02:00
Stanisław Drozd 44559109f0
p2w-client: Remove --log-level, rely on RUST_LOG, provide default (#333) 2022-10-10 13:25:19 +02:00
Stanisław Drozd ef37c86b32
p2w-client: move rpc_interval to config, test fast rate accuracy (#334) 2022-10-06 17:44:26 +02:00
Ali Behjati d7f436a856
Cascade Pyth SDK JS update to downstream packages (#326)
* Fix annoying ethereum problem

* Update p2w-sdk

* rename + lint + format + bump to 1.0.0

* Update price service

* Bump version + format + add lint

* Fix price service linting issues

* Fix package rename issue

* Update package lock of dependencies

local dependency is aweful!

* Fix exclusion bug
2022-10-06 09:21:04 +02:00
Ali Behjati 983813d2f8
Use sdk getIxAuthorityPDA + format (#324) 2022-09-30 19:49:58 +02:00
Jayant Krishnamurthy 575199f724
set is-active fixes (#323)
* merge

* use the right command here

* fix handling of boolean

* cleanup

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-30 09:00:48 -07:00
Daniel Chew 29f53df71c
add support to execute tx through squads ui (#322) 2022-09-30 21:24:16 +08:00
guibescos 3a56d0a8d9
Fix error (#321) 2022-09-29 23:03:03 -05:00
Jayant Krishnamurthy 0d3f030ad2
update staleness check (#319)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-29 13:36:39 -07:00
guibescos 16bdc0f4c3
Guibescos/cli for attester admin (#314)
* Add payload generators

* Executor cli no longer a lib

* Expose instructions in client

* Format

* Cli

* Fix CI

* Fix CI, second try

* Fix CI, second try

* Fix CI, third try

* Fix CI, foruth try

* Remove pythnet from dockerfile wasm

* Test

* Revert "Test"

This reverts commit ffa702b249f821aee0a781b680bdf51d038859cf.
2022-09-29 15:24:47 -05:00
Jayant Krishnamurthy 89cc35d3a0
Run prettier (#318)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-29 13:22:14 -07:00
Jayant Krishnamurthy 863a983a1a
Add set-is-active instruction and some minor tweaks (#317)
* add set-is-active instruction and some minor tweaks

* stuff

* whoops

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-29 12:57:35 -07:00
guibescos c4238c7a91
Guibescos/expose attester instructions (#313)
* Add payload generators

* Executor cli no longer a lib

* Expose instructions in client

* Format
2022-09-29 09:15:42 -05:00
Daniel Chew 0a1f31a952
use squads mesh package instead (#310) 2022-09-28 15:24:13 +08:00
Daniel Chew 6d528ffbe2
update solidity package version (#304) 2022-09-26 23:43:47 +08:00
Jayant Krishnamurthy bf032f07c2
Delete one more noisy log message (#296)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-21 11:24:14 -07:00
Jayant Krishnamurthy 71a6ae687e
Make this log message less noisy (#285)
* make this log message less noisy

* build

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-09-21 11:06:13 -07:00
Stanisław Drozd fdafbe32a4
Drozdziak1/p2w client use mapping crawl (#294)
* p2w-client: Add attestation config merging logic

This change adds code to append new symbols to an existing attestation
config. In conjunction with the mapping crawling logic, this will aid
in hot reloading attestation configs in runtime

* pyth2wormhole-client: Use the crawled mapping symbols
2022-09-21 16:49:37 +02:00
Stanisław Drozd 163fa44f24
Drozdziak1/p2w client mapping crawl (#286)
* pyth2wormhole-client: Add a mapping crawling routine

* pyth2wormhole-client: Add mapping_addr for attestation config

* pyth2wormhole-client: cargo fmt
2022-09-21 10:38:17 +02:00
Ali Behjati 2ad991f4ab
Abehjati/add-eth-governance (#279)
Also add governance-sdk-js to generate messages (both in testing and in multisig)
2022-09-20 18:24:57 +02:00
Ali Behjati b86a9d1b38
Use hex payload instead of string (#284) 2022-09-19 15:38:49 +02:00
Jayant Krishnamurthy bfb3b7bab3
Move staleness check to new endpoint (#278)
* move staleness to new endpoint

* actually send the response

* Add schema

* Fix freshness metric to use publish time instead of attestation Time

* Rename endpoint to /api/ + small fix

* Bump version

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2022-09-14 19:57:38 +02:00
Daniel Chew f3e17ad307
add ledger support (#277)
* add ledger support

* address feedbacks
2022-09-15 01:26:39 +08:00
Daniel Chew 1c6977ec96
add pyth multisig cli program (#276) 2022-09-14 10:36:52 +08:00
Daniel Chew 8c0e9b6e2e
add new freshness check to price-service /ready endpoint (#275) 2022-09-12 15:57:45 +08:00
Daniel Chew 303385bfbd
enable verbose property to return metadata for ws endpoint (#271)
* enable verbose property to return metadata for ws endpoint

* remove console log

* fix test cases failing

* fix spelling errors

* update callback and listener to use PriceInfo

* isolate verbose flag to each client and add tests

* isolate verbose flag from clients
2022-09-07 23:27:44 +08:00
Stanisław Drozd 15f3175f91
p2w: Make commitment usage consistent (#270)
This changeset adjusts p2w_autoattest.py commitment to confirmed and
fixes a get_transaction() failure that happened due to the upstream
default finalized commitment setting (RpcClient's set value is not
used). This is fixed by using the chosen commitment explicitly via
get_transaction_with_config()
2022-09-06 16:21:02 +02:00
Daniel Chew b846fc3c84
add new latest_price_info endpoint (#264)
* add new latest_price_info endpoint

* add verbose query param to latest_price_feeds

* add back logging statement for VAA

* trigger CI
2022-09-06 00:02:57 +08:00
Stanisław Drozd aa7be4d1be
Drozdziak1/p2w client error logging and docker caching (#268)
* p2w-client: Fix silent logs, restore program log printing

For some time now, p2w-client error reporting would fail to show
daemon mode errors. The logs would only mention resends without ever
showing failed attempts.

with solana-program 1.10.31 came a newer, inferior program log
reporting which only says "N program logs" instead of saying what they
are. This changeset prints errors verbatim using formatted debug
"{:#?}" syntax.

* Docker: Improve p2w-attest/solana-devnet caching

This commit speeds up caching in two ways:

1. By severing the dependency on bridge-client in
Dockerfile.p2w-attest - mainly because of unnecessary `cargo install`
builds which even with target dir caching can take ~1 minute. The
bridge/token-bridge client binaries are not useful to p2w-client anyway.

2. By attaching cargo-install commands to a target dir cache via the
--target-dir option in cargo
2022-09-05 17:00:24 +02:00
Ali Behjati b4c8f2e470
Refactor our CW contract + cleanups (#262)
* Use the cw sdk

* Fix clippy warnings

* Use Addr instead of String

* Format the code (cargo +nightly fmt)

* Depend on wormhole git instead of local dependency

* Add error enum

* refactor

* Refactor errors

* certusone->wormhole-foundation rename

It will fix some compile problems

* Build wormhole contract from their repo

* remove wormhole package

* Remove memmap2 patch

It was not needed anymore with the newer
verison of solana (wormhole removed it too)

* Rename pyth-bridge to pyth-cosmwasm
2022-09-02 12:39:51 +02:00
Stanisław Drozd 6382f540db
Wormhole message reuse via post_message_unreliable (#261)
* pyth2wormhole: Implement reusable message PDAs

This changeset converts attest() to use a new PDA for
reusable/unreliable wormhole message account. Each PDA is tied to a
given attest() payer with an index that lets them rotate a number of
message accounts. Keeping the appropriate timing of the reuses is up
to the message owner, who should rotate a number of PDAs.

* pyth2wormhole-client: Add a message acc rotation impl

* p2w attest(): Integrate with bumped wormhole and fix call issues

* p2w-client: Format code, fix test_attest, refactor message index

* Dockerfile.client, Dockerfile.p2w-attest: Improve caching

The main improvement comes from running cargo-install from within a
workspace which lets us cache target/

* p2w-client: Make reusable messages configurable in yaml

* p2w on-chain: refactor to unreliable-only, adjust msg balance, nits

* p2w-client: P2WMessageIndex -> P2WMessageQueue, queue tests

* p2w-client: Add a hard limit to the message account queue
2022-09-01 18:47:24 +02:00
Stanisław Drozd a2a0f6e15b
Start depending on the upstream out-of-tree Wormhole (#258)
* Add out-of-tree dependency on wormhole v2.8.9

This lets us outsource all wormhole/solitaire code to the upstream
certusone repo

* Docker.client: Use cargo-install to install binaries from github

* p2w: fix solana-program wasm-bindgen

* pyth2wormhole: Fix code-level errors against newer solitaire

* p2w: Use upstream wormhole rust code, bump guardian to 2.8.9

* guardian: ensure solana is on, spy: bump image to 2.8.9

Co-authored-by: Reisen <reisen@morphism.org>
2022-08-29 16:18:41 +02:00
Daniel Chew 3100ab9e53
add api endpoint to get all supported price feed ids for price service (#259)
* add new /price-feed-ids rest endpoint

* add docker-compose.yaml and update README

* Update third_party/pyth/price-service/README.md

Co-authored-by: Ali Behjati <bahjatia@gmail.com>

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2022-08-26 07:27:03 +08:00
Ali Behjati 586eba0eb9
Abehjati/release-price-service (#251)
* npm audit fix

* Update package name

* Remove guardian image and use official ones

* Update README

* Fix config file name

* Use aws public repo
2022-08-22 10:05:22 +02:00
Ali Behjati bf021010cc
evm-watcher: Add logic to group events for dispatch (#242)
* Add logic to group events for dispatch

* Add comment about one important assumption

* Address review comments
2022-07-28 16:04:57 +02:00
Ali Behjati 07bf9dbee2
Abehjati/use-cw-1-for-contracts (#240)
* Bump version of cw packages from 0.16.0 to 1.0.0

* Fix build

* Update wormhole details

* Update js packages

* Update dockers, configs, to use cosmwasm 2 in tilt

* Update wormhole and pyth addresses everywhere

The migration file is probably not necessary for us.
To be deleted later.

* Update gh action name
2022-07-20 16:35:01 +02:00
Stanisław Drozd f0552e5f1b
pyth2wormhole-client: refactor into fully-async futures-based approach (#219)
* pyth2wormhole-client: refactor into fully-async futures-based approach

commit-id:2ed35045

* p2w-client: Change inconsistent rpc constructor

commit-id:cb3b2ff2

* p2w-client: Move job creation to a function, simplify comment

commit-id:35328b38

* pyth2wormhole-client: Use get_multiple_accounts

commit-id:7fc85157

* Implement a rate-limited mutex for RPC client

commit-id:1a243063

* pyth2wormhole-client: only guard beginning new requests in RLMutex

commit-id:d8251474

* pyth2wormhole-client: RLMutex: ensure the inner guard is not dropped

commit-id:c3513f5e

* pyth2wormhole-client: Clarify attestation_sched_futs comment

commit-id:97033670

* pyth2wormhole-client: Use CommitmentConfig's native FromStr parsing

commit-id:835d7125

* pyth2wormhole-client: doc comment typo

commit-id:5ee388de

* pyth2wormhole-client: move closures to their own async functions

This makes the main.rs async attestation routines easier to read.

commit-id:3565a744

* pyth2wormhole-client: fix merge typo

* pyth2wormhole-client: Apply Tom's readability advice

* pyth2wormhole-client reword attestation_sched_job() comment

* pyth2wormhole-client: expand attestation_sched_job() comment

* pyth2wormhole-client:   e  x  p  a  n  d   the comment

* Trigger CI

* p2w-client/main.rs: correct missing awaits after merge
2022-07-18 14:40:03 +02:00
Ali Behjati e76181ace6
Add pyth-evm-watcher to tilt (#238) 2022-07-15 17:37:58 +02:00
Ali Behjati 1f785d5a7f
Add watcher base files and structures (#237)
* Add watcher base files and structures

* Add missed files!

* Update package.json info

* Update PythUpdateEvent

* Restructure the code

* Fix division
2022-07-15 14:37:48 +02:00
Ali Behjati 6a46dfcb6e
Use single server for both ws and http (#230)
* Use single server for both ws and http

* Format code
2022-06-30 12:51:06 +02:00
Ali Behjati 21dfc32e43
Abehjati/pyth-evm-contract-fire-event (#229)
* Use new solidity sdk

* Emit events in contract

* Fix max gas issue that caused error

* Add tests for PriceUpdate event

* Delete a test network file
2022-06-27 17:41:55 +02:00
Ali Behjati 1a12005fbf
Use attestationTime instead of seqnum (#226)
SeqNum is not suitable for multiple sources, attestationTime is good
but we should be careful of solana clock falling behind

Also use this time for freshness metric because it's more useful.
2022-06-22 13:31:54 +02:00
Ali Behjati df1854752c
Add Websocket to price service (#221)
* Add initial working ws

* Add tests

* Add prom metrics + improve logging

* Handle ids with leading 0x

* Add a multi client test

* Minor code format

* Fix Typo

* rename PriceFeedPriceInfo to PriceStore

It is because in the future we might have multiple spies and this
will be a middleware store

* format the code
2022-06-17 17:32:50 +02:00
Ali Behjati b2becab951
Abehjati/cleanup again (#215)
* Remove unneeded and unused stuff

* removes guardian + use fixed version release of it

* Remove more stuff
2022-05-20 12:43:31 +02:00
Stanisław Drozd c613271a93
Bump Solana to v1.10.13, bump borsh to v0.9.3, bump clap to v3.18 (#210)
* Bump Solana to v1.10.13, bump borsh to v0.9.3, bump clap to v3.18

commit-id:519b2a6d

* p2w-sdk/rust: update Cargo.lock

commit-id:b7945666
2022-05-17 08:53:30 +02:00
Ali Behjati cabb5e08f5
Remove unneeded logging (#211) 2022-05-16 17:00:24 +02:00
Ali Behjati ce56351c3e
Abehjati/pyth-evm-update-method (#209)
* Add updatePriceFeeds to eth contract

* update gitignore

* Update typos

* Use calldata instead of memory for gas efficiency
2022-05-16 13:44:43 +02:00
Stanisław Drozd 941017de4b
p2w-client: Implement additional trigger conditions (#207)
* p2w-client: Implement additional trigger conditions

From now on, we support price change by a given percentage as well as
publish time changes for triggering attestations.

commit-id:9bd145e1

* p2w-client: Harden price_pct_change for negative values

commit-id:cb679208

* p2w-client: Make sure we always update each symbol's state

commit-id:27f276dc

* p2w-client: include resend state lookups in the RPC interval setting

commit-id:68de125f

* p2w-client: Improve local symbol state handling, min interval=60s

With this change, we update local state only if we meet a
condition. Additionally, the publish_time change becomes a
configurable minimal delta.

commit-id:f8139cd6

* p2w-client: Fix a state update bug for state updates

commit-id:29f44a39
2022-05-12 14:39:49 +02:00
Ali Behjati 1a3d8f211e
Make query parameters required (#204)
Apparently default is optional
2022-05-11 10:38:07 +02:00
Ali Behjati d997a9bcf2
Accept hex addresses with 0x in price service (#203) 2022-05-09 11:41:28 +02:00
Stanisław Drozd a1e50ae636
Drozdziak1/p2w client sym groups (#199)
* pyth2wormhole-client: Implement and use daemon mode

commit-id:7001bdf7

* pyth2wormhole-client: harden CLI, simplify attestation loop

commit-id:ad5e4857

* pyth2wormhole-client: Refactor symbol config into groups

This commit implements the notion of a symbol group - a collection of
symbols that are attested according to the specified set of
condition. Currently, only an attestation frequency is supported. In
the future, this value will serve as a fallback for symbols that
rarely trip other conditions.

commit-id:cf19cc41

* p2w_autoattest.py: Use symbol groups in config

commit-id:1153c5f7

* Dockerfile.client: bump toolchain version to mitigate compiler error

The previous compiler version encountered a bug when building
pyth2wormhole-client for testing. The error message mentioned serde,
which is tested inside the `attestation_cfg.rs` module.

commit-id:61c12427

* p2w_autoattest.py: Add another test group

commit-id:2e29583c

* p2w-client: Get rid of sent_at, clarify messages, add status setter

commit-id:87653ab1
2022-05-06 18:29:47 +02:00
Ali Behjati 6ce60e5ba6
Refactor Price Service + Add tests (#202)
* Add Rest Exception

* Add tests

* Update endpoint names and query params
2022-05-06 12:27:59 +02:00
Ali Behjati 11e15c96b0
On not found price id return list of not found ids (#200) 2022-05-05 13:10:35 +02:00
Stanisław Drozd 7b9d5b1c22
ethereum/: use publishTime instead of attestationTime for queries (#196)
commit-id:b3c87e4e
2022-05-04 21:29:35 +02:00
Ali Behjati ec7dcf7817
Price Service: Add support for multiple price id in vaa request (#198)
* Add support for multiple price id in vaa request
2022-05-04 10:00:24 +02:00
Eran Davidovich 5be5576f0c
fix: minor fixes to wasm and price dockerfiles (#197)
CU-2frzq03

Co-authored-by: Eran Davidovich <edavidovich@jumptrading.com>
2022-05-03 13:41:36 +03:00
Stanisław Drozd 97ebef0c6c
pyth2wormhole-client: Implement and use daemon mode (#192)
* pyth2wormhole-client: Implement and use daemon mode

commit-id:7001bdf7

* pyth2wormhole-client: harden CLI, simplify attestation loop

commit-id:ad5e4857

* pyth2wormhole-client: Use requires_if for batch_interval/daemon

commit-id:0da03fd5
2022-05-02 13:08:03 +02:00
Ali Behjati 60a69d3e83
Update terra contract to use new pyth sdk + new wiring format (#193)
* Update terra contract and terra relayer
2022-04-28 16:33:52 +02:00
Stanisław Drozd a4c749b99c
pyth2wormhole: implement wire format v3rev0 (#189)
* pyth2wormhole: implement wire format v3rev0

commit-id:c106d3b3

* pyth.js: Run prettier formatting

commit-id:fc9fb160

* ethereum: Fix tab indentation in Pyth contracts

commit-id:3d2ab7d8

* p2w-terra contract: fix formatting

commit-id:685dd14f

* p2w-sdk: Use wasm in the JS package, detect bundler/node via `window`

This commit makes sure that our wasm usage is more robust. We ensure
that the JSON representation renders all important numbers in their
string decimal form. b

commit-id:75f9c224

* p2w-sdk: review suggestions: field ranems, limit serde attributes

commit-id:9f596b80

* p2w-sdk/rust: Remove utils.rs and the helper type

commit-id:e72c6345
2022-04-25 18:32:25 +02:00
Ali Behjati 5b13be3bbf
Add logging & prom middlewares to Price Service (#191) 2022-04-25 16:05:43 +02:00
Ali Behjati e9807ade29
Add Price Feed to Price Service (#187)
* Update new PriceFeed in p2w-sdk based on sdk update
2022-04-22 17:36:26 +02:00
Ali Behjati 787ad7d190
Fix wrong metric name for success counter (#188) 2022-04-20 16:58:11 +02:00
Stanisław Drozd b41708e863
pyth2wormhole: Add compatible metadata, handle EVM fwd-compat (#165)
* pyth2wormhole: Add compatible metadata, handle EVM fwd-compat

commit-id:d92b42b5

* EVM unit tests: test the non-breaking format change fields

commit-id:3a26e554
2022-04-15 21:09:20 +02:00
Stanisław Drozd 035021905a
Enable and fix Rust unit tests in Tilt for p2w-sdk and p2w-attest (#184)
* Enable and fix Rust unit tests in Tilt for p2w-sdk and p2w-attest

commit-id:cae6ee05

* p2w-sdk/rust/src/lib.rs: comment about hex payload generation

commit-id:f9f3a249

* p2w-sdk/rust/src/lib.rs: Comment about hex payload generation

commit-id:352e74f9
2022-04-14 14:21:15 +02:00
Ali Behjati 58a5317bc5
Add metrics to pyth price service (#185) 2022-04-13 19:48:56 +02:00
Ali Behjati 2dd5357b46
Add readiness to Pyth Price Service (#183)
Also add it to Tilt
2022-04-13 10:28:30 +02:00
Ali Behjati 352fa64653
Merge Dev.v2 into main (#181)
* Move js sdk on p2w-sdk to js folder

Also modifies other dependencies to correct path

* Reversed removal of wasm build for nodejs

* Add newline to a file

* pyth2wormhole: Fix attestation validation bug

commit-id:567942d7

* Add p2w sdk

It uses Pyth clients structs and cleans some of definitions for Pyth2Wormhole structures.

* Add emitter type and add wasm function for it

- It requires solitaire and it requires nightly rust
- No logic is applied, code is from p2w solana contract. (Eventually will be removed from there)

* Add new line

* Move WASM gen docker to root

It is because wasm is going to be used for p2w-sdk too.

* Fix unchanged cache mount paths

* Move terra relayer into the repo

* Update readme

* p2w-client: Add lib target, make helpers into lib functions there

commit-id:3aeb9ee6

* pyth2wormhole-client: Implement retries

commit-id:462677a2

* Make p2w-sdk js use p2w-sdk rust wasm bindings (#65)

* Make p2w-sdk js use p2w-sdk rust wasm bindings (instead of solana contract bindings)
- Removes `wasm.rs` in solana contract too.

* p2w attester contract use p2w-sdk (#68)

* Make solana pyth2wormhole contract to use the sdk

* Use threadpool to set up price symbols (#69)

* Add solana feature flag for p2w sdk (#71)

* Pyth bridge terra contract support batch attestation + use p2w sdk (#72)

* Make terra contract to use pyth2wormhole-sdk and support batch attestation

* Update packages + code format

* Move terra dockerfile out to support third-party dependency

* pyth2wormhole-client: Add polling-based concurrent tx confirmation

commit-id:5d16d035

* chore: p2w spy guarding improve Dockerfile

* fix: p2w_autoattest don't die after initialization

also minimal formatting

* add P2W_EXIT_ON_ERROR

* set P2W_EXIT_ON_ERROR default to True

* Remove bool test

* hopefully this time.

* add tilt p2w-attest P2W_EXIT_ON_ERROR

* convert P2W_EXIT_ON_ERROR to "true"

* Fix pyth test publisher (#76)

* Fix test pyth publisher to actually publish price

- Uses newer pyth images and removes existing hacks for old versions. It essentially makes dockers cleaner.
- Also improve some adds in dockers to cache more efficiently

* Support Batch Price attestation for terra relay (#75)

* Support Batch Price attestation for terra relay

* Abehjati/update p2w sdk to pyth sdk (#83)

* Make p2w-sdk use pyth-sdk

* Correct test values to reflect .env.test

* update p2w sdk to use ema instead of twa (#84)

* Rename twa to ema in terra relay (#85)

* Bring PythStructs.PriceAttestation struct in line with new API

* Add ability to parse batch price attestations

* Pyth terra remove wormhole governance (#87)

* Pyth in terra: remove wormhole governance

* [WIP] p2w-relay-iface: Add NPM package with relayer interface PoC

commit-id:efcb9b34

* Define Pyth SDK Price struct

* Define internal PythStructs.PriceInfo struct

* Cache price updates in standardised PriceInfo format

* Cache price updates from batch attestations

* p2w-relay-iface -> p2w-relay-terra/src/relay/iface.ts

commit-id:ed9846e3

* p2w relay interface: remove config from Relay iface

commit-id:0359d886

* Remove now unnused parsePriceAttestation function

* Pyth terra bridge: add contract deployment script (#88)

* Add pyth deployment script

- Also updates build.sh to build pyth completely
- Add a readme for deployment guide

* Add test for partial update behaviour

* update p2w sdk to new pyth (#91)

* p2w-sdk/rust use pyth sdk solana v2

* Dockerfile.client: solana 1.8.1 -> 1.9.4

commit-id:643299d3

* p2w-terra-relay: ignore lib and node, own project dir in docker

commit-id:b084bc40

* p2w-terra-relay: iface.ts review nits, naive impl for Terra

commit-id:0ecbfdd6

* Terra contract public api (#79)

* Use pyth-sdk in terra contract
* Update terra contract according to agreed API
- Also adds v2 suffix to price_info key because this migration is breaking.

* p2w-terra-relay: apply review nits

commit-id:aec39c85

* p2w-terra-relay: make worker.ts generic w.r.t. Relay interface

commit-id:5937a08c

* terra.ts: add missing return statement

commit-id:ba0365e6

* Update worket to handle timeout in callback correctly (#97)

* Remove wormhole-based governance

* Remove now unused legacy governance state and variables

* Remove Pyth Implementation implementation

* p2w-terra-relay: run formatter

commit-id:df311e23

* p2w-terra-relay: apply review nits

commit-id:5034b061

* Run formatter to trigger CI

commit-id:7c643d79

* p2w-terra-relay: EVM boilerplate

commit-id:8ad73ded

* Remove old PythProxy inheritance hierarchy

* Remove now unnused initialized implementations map

* Remove old mock bridge implementation

* Remove dependency to wormhole sdk as path and cleanup wrong eth copies (#104)

* Dockerfile.pyth_relay: Fix lockfile issue in ethereum

This commit fixes a lockfile issue resulting from newer NPM in our
container.

Specifically, our Dockerfile is pinned, relaxes Ethereum's
lockfile (npm ci -> npm install) and hardens our lockfile (npm install
-> npm ci)

commit-id:3381c8ec

* p2w-terra-relay: Admit loss against mkdir -p

commit-id:3abdb58d

* Remove unused components from wormhole (#108)

* Remove unused components from wormhole

Removes the following:
- explorer
- e2e
- bridge_ui
- algorand stuff (teal dockerfile and third_party/algorand)
- ci_tests (testing directory)  which are for JS/Bridge UI

* Remove unused terra contracts (#109)

- Note: Terra contract addresses are changed by this PR due to deterministic ordering.
- Removed unused nft and token bridge, and migration contracts in Terra
- Modified documentation to remove info regarding removed contracts.(docs/devnet.md)

* Remove unused solana contracts and their wasm creations (#110)

Removes token bridge, nft bridge, migration. Also removes them from deployments and docs.

* Add fee estimate for terra relay (#112)

* Removes directores which are not related to p2w (#111)

Removes
- audits
- dashboards (dashboard is removed from Tilt)
- event_database (all of it's dependencies are removed from Tilt and it's not for p2w)
- lp_ui: a project (pressumably liquidity pool) not related to p2w
- sdk: wormhole sdk, p2w depends on it's npm package and there is no dependency to rust one
- spydk: it's not anywhere in p2w
- staging/algorand: these are for alrogrand which is not used in p2w
- whitepapers: these are for wormhole

* Add and update openzeppelin packages

* Add initializer to Pyth contract

* Add upgradable PythProxy contract

* Update tests to work with new proxy setup

* Update migrate script to work with new proxy setup

* Add tests for new proxy setup

* Inline PythStorage.Provider struct

* Make Pyth.verifyPythVM function internal

* Fix struct field names

* Rename Price to PriceFeed to be consistent with SDK

* Replace PythGetters.latestPriceInfo with Pyth.queryPriceFeed in public API

* p2w-terra-relay: Add a query() EVM call and Tilt boilerplate

commit-id:f97d0c16

* Clarify test comments

* Add health probe (#107)

* Rename PythProxy to PythUpgradable

* p2w-evm-relay: Backport the proxy address change from debug session

commit-id:55b63ed5

* p2w-terra-relay -> p2w-relay, split EVM relay into new service

commit-id:36d0db6e

* Tiltfile: typo

commit-id:3bbba986

* p2w-evm-relay.yaml: typo

commit-id:35c87c79

* p2w-evm-relay.yaml: typo 2: electric boogaloo

commit-id:40892265

* Add build folder to dockerignore

* Rename attestPriceBatch to updatePriceBatchFromVm

* Update comment on time check

* Trigger Build

* Tiltfile: Fix port forwards for p2w-evm-relay

commit-id:6e5e9c14

* p2w-relay: PythImplementation -> PythUpgradable

commit-id:bfea7eb5

* Remove unused Pyth Chain ID metadata

* Add the query() call

commit-id:02966ce5

* p2w-terra-relay: Fix evm.ts after contract rename

commit-id:87381bec

* Make truffle migrations directory configurable

* p2w-evm-relay: Fix wrong EVM contract ID, add a check for it

This commit takes care of an outdated pyth2wormhole EVM contract
address and implements a contract/non-contract check using
web3.eth.getCode() (empty for non-contracts).

This problem cost us several hours of debugging and resulted from an
EVM gotcha - a contract call to a non-contract address will simply
ignore the call payload and make a plain transfer. Additionally, ETH
accounts don't have a notion of initialization - used and unused
addresses are equally valid tx recipients. Resulting from both
properties, any unused address could potentially yield wrongly
successful calls, wasting funds and debug time over p2w-relay. Thus
the heuristic to protect us from this is to see if the address' code
storage is populated.

commit-id:b655a720

* p2w-relay: Also implement the contract check in EVM relay()

commit-id:e28709e5

* evm.ts: Fix wording in changed/unchanged logs

commit-id:13c81625

* Make terra relayer more resillient (#120)

- Increase retry attempts (4 to 6) and retry_delay (250ms to 1s) to be more resillient
  - This is because when account sequence mismatch happens it might take some time be fixed
- Removed estimate fee because it's being done in wallet.createAndSignTx (less requests)
- Improved logging on when error happens

* Update dockerfile to chown less files (#121)

* Update dockerfile to chown sooner

* p2w-relay: review nits

* p2w-evm-relay: make feed verification queries configurable

* p2w-relay: cache wormhole import

* p2w-relay: formatter, remove getcode() from relay(), add comments

commit-id:1a65c52c

* p2w-relay: typos and leftovers

commit-id:9b523b25

* Change websocket to json socket to support bsc testnet + improves env vars (#139)

* Change websocket to json socket to support bsc testnet + imporving env vars

* Add unit test to Pyth Terra Contract (#123)

* Add unit test to the terra contract

- Refactors the code into multiple functions to make unit testing easier
- Adds build and test of terra contract to CI according to #73

* p2w-relay: harden exception handling, yell about uncaught stuff

commit-id:24e14835

* p2w-relay: Correct outdated comment

commit-id:d0b57d33

* p2w-evm-relay: s/async (e)/(e)/

commit-id:11b3a474

* Modify proto docker and tiltfile to stop creating unnecessary files (#144)

* Remove sdk/spydk from wasm and remove buf gen web yaml (#145)

* Remove wormhole contract from wasm generation (#160)

* pyth2wormhole: Add num_publishers to libraries and contracts

commit-id:f7263eed

* pyth2wormhole: add max_num_publishers to cross-chain metadata

commit-id:7550fa50

* Move p2w relayer parsing to p2w sdk js (#162)

* Move Price Attestation parsing logic to the sdk

* pyth2wormhole: Add contract testing boilerplate for attest()

commit-id:51949fbe

* Create p2w-api base (from p2w-relay) (#142)

* Create p2w-api base (from p2w-relay)

* Refactor project structure

* Rename p2w to pyth price service (#166)

* Abehjati/price-service-add-rest-layer (#167)

* Add rest api for latest vaa

Co-authored-by: Stan Drozd <stan@nexantic.com>
Co-authored-by: Eran Davidovich <edavidovich@jumptrading.com>
Co-authored-by: Eran Davidovich <erancx@users.noreply.github.com>
Co-authored-by: Tom Pointon <tom@teepeestudios.net>
Co-authored-by: Stan Drozd <drozdziak1@gmail.com>
2022-04-11 18:15:20 +02:00
Stanisław Drozd 2ea41b8176
[WIP] Pr/drozdziak1/p2w batching/5e704f8b (#877)
* ethereum: p2w contract -> p2w emitter, fill in essential envs

Change-Id: I6fa9364a96738d2cc02ec829a31fedba0586d8e8

commit-id:0a56f1f8

* Add p2w-relay, a p2w-sdk integration test

commit-id:6bfab639

* p2w-sdk: Expand README

Change-Id: I17cb547d6aaddc240588923561c26d11a787df2e

commit-id:6ebd6a22

* p2w-sdk: don't build ETH contracts, only the types

Change-Id: I7cbd18328227700635d7688aa24a9671e8919fcd

commit-id:adf079f7

* p2w: configurability and sane envs

commit-id:f10fd90e

* Solitaire: Implement Option<T> support in structs

commit-id:31aa12d6

* bridge/governance.rs: Stop pestering about EMITTER_ADDRESS

commit-id:d5bd7234

* p2w-attest: price batching

This commit introduces support for multiple Pyth product/price pairs
per call. The initial maximum batch size is 5 and is enforced using a
`P2W_MAX_BATCH_SIZE` constant.

solana/pyth2wormhole/program:
* On-chain batching logic
* Batch message parsing logic

solana/pyth2wormhole/client:
* Off-chain batching logic - divides any number of symbols into
largest possible batches
* Use a multi-symbol config file instead of CLI arguments

third_party/pyth/p2w-sdk:
* Expose batch parsing logic

third_party/pyth/p2w-relay:
* Comment out target chain calls until ETH contract supports batching
* Test the batch parsing function

third_party/pyth/p2w_autoattest.py:
* Generate and use the symbol config file  with pyth2wormhole-client

third_party/pyth/pyth_publisher.py:
* Add a configurable number of mock Pyth symbols
* Adjust HTTP endpoint for multiple symbols

commit-id:73787a61

* p2w-attest: mention attestation size in batch

This commit ensures that no matter the attestation format, a batch
will never contain attestations of different sizes. This guarantee
enables forward compatibility by adding new constant-size fields at
the end of a batch at all times. An older implementation will simply
not consume the remaining newer values while respecting the stated
batch member alignment.

commit-id:210da230

* pyth2wormhole-client: use fresh blockhashes, harden batch errors

This commit makes sure we don't have to deal with expired transactions
due to stale blockhashes. The problem existed with larger symbol
configs as well as on Solana mainnet. Additionally, the attestation logic
now treats transaction errors as non-critical - a failure for a batch
does not prevent attestation attempts for batches farther in the queue

commit-id:5e704f8b
2022-02-23 19:12:16 +01:00
Evan Gray 075defa634 feat: improve bridge_ui tilt
properly cache npm ci in Docker container image
support hotloading outside ci
2022-02-14 07:56:38 -05:00
Stan Drozd 05edb3d14f pyth2wormhole: rename p2w-client service to p2w-attest
Change-Id: I34a53146919c12ab41b958cc8cd57108ee509faa
2021-11-15 15:22:29 +00:00
Stan Drozd 19c475e4a6 pyth2wormhole: share pending attestation information over HTTP
Change-Id: I585392f995f3d32b5e8152c08c79a012091c36ed
2021-11-15 15:22:29 +00:00
Stan Drozd 3e96438f4e pyth2wormhole: initial SDK skeleton
Change-Id: I8697ced892a1bf69f948c9743741d32a442a402f
2021-09-16 13:15:13 +00:00
Stan Drozd f24f86adf5 pyth2wormhole-client: Run an automated attestation script in Tilt
Change-Id: Id2e6def6c246862601a206084867c5f1b26a6673
2021-09-09 17:24:32 +02:00
Stan Drozd a97a34e174 Add a test pyth instance
Change-Id: Ifa5b50fb80f01f386fc8079eec3a0564df8072e1
2021-08-18 12:54:11 +02:00