Commit Graph

1942 Commits

Author SHA1 Message Date
guibescos c32f2d99b9
Setting up rust tests (#292)
* Add tests

* Add tests to CI

* Remote test from precommit hook

* New test

* Remove merge error

* Comments and increase seqno

* Remove unnecesary dep

* Fix rebase

* Fix feedback
2022-09-21 12:51:57 -05:00
guibescos 1ad419e0ba
Guibescos/executor deser test (#290)
* Add tests

* Add tests to CI

* Remote test from precommit hook
2022-09-21 10:11:14 -05: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
Ali Behjati 44111714f9
Add new contract memory layout (#293) 2022-09-21 15:00:44 +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
guibescos 48a5902cb0
Boolinator (#288)
* Start anchor program

* pythnet folder

* Renames

* Implement processor

* Comments

* More comments

* Bump anchor

* Use new version of the wormhole package

* Get Solana chain id from wormhole core

* Pythnet bridge address

* Remove comment

* Fix borsh headers

* Format

* Fix precommit

* Fix precommit

* Precommit

* Add to CI

* Fix CI

* Use boolinator

* Enable boolinator

* Remove duplicate macro
2022-09-20 16:01:24 -05:00
guibescos e7b9c883ff
Feature flag for bridge address (#289)
* Feature flag for bridge address

* Feature flag for bridge address
2022-09-20 15:20:18 -05:00
guibescos c367812fe4
Format and lint executor (#287)
* Start anchor program

* pythnet folder

* Renames

* Implement processor

* Comments

* More comments

* Bump anchor

* Use new version of the wormhole package

* Get Solana chain id from wormhole core

* Pythnet bridge address

* Remove comment

* Fix borsh headers

* Format

* Fix precommit

* Fix precommit

* Precommit

* Add to CI

* Fix CI
2022-09-20 13:55:01 -05:00
guibescos d20099a3c6
Guibescos/executor (#283)
* Start anchor program

* pythnet folder

* Renames

* Implement processor

* Comments

* More comments

* Bump anchor

* Use new version of the wormhole package

* Get Solana chain id from wormhole core

* Pythnet bridge address

* Remove comment

* Fix borsh headers
2022-09-20 11:33:55 -05: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
guibescos f4cf96bd1f
Start anchor program (#282)
* Start anchor program

* pythnet folder

* Renames
2022-09-16 13:15:24 -05: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
Ali Behjati 05c631b022
Add mainnet networks (#274) 2022-09-10 08:35:07 +02: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
Ali Behjati bd90203cdf
Fix a bug in the id of price attestation (#273) 2022-09-07 14:57:15 +02:00
Ali Behjati dd3f5a57ee
Abehjati/fix-deployment-bugs (#272)
* Fix migration files

* Use another rpc endpoint for bnb

* Fix the bogus commit hash replacement instruction

* Use a more clear placeholder
2022-09-07 12:00:18 +02: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
Stanisław Drozd 94aab8af8f
Drozdziak1/p2w init rent adjustment (#269)
* pyth2wormhole: add rent adjustment to the initialize() instruction

* pyth2wormhole migrate(): Leave a note about rent adjustment

The migrate() ix won't be called in the nearest future - it does not
make sense to bloat the program bytecode with the rent adjustment. The
note describes the what and why in detail.
2022-09-06 16:06:07 +02:00
Ali Behjati 65c273fa0a
Add pythnet migration files (#246)
* Add pythnet migration files

Also:
- Add related env vars for testnet networks. Mainnet ones to be added
when it's ready.
- Rename Pyth2Wormhole env vars to solana

* Add mainnet emitter

* Fix migration file numbers

* Address Jayant comments
2022-09-06 13:03:21 +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 5c48dacee0
Hack the rent exempt bug (#265)
* Hack the rent exempt bug

* Fix compile bug

* Fix account resize potential problem

* Use invoke transfer instead of playing with lamports
2022-09-05 13:32:41 +02:00
Ali Behjati 19e34f5c00
Fix bugs related to P2WMessage being owned by wormhole (#266)
* Fix caused by wormhole owning P2WMessage

* Refactor the code

* Comment the integration test

It seems that solana test suite has bug,
An error occurs after tx is finished successfully. Also,
it appears as a segfault for Reisen.

* Add more comments

* Add manual check for seeds

* Add more comments

* minor comment change

* Improve comments
2022-09-05 12:36:59 +02:00
Stanisław Drozd 19047c13b4
p2w-client: add get-emitter for printing emitter address (#267)
* p2w-client: add get-emitter for printing emitter address

* Move get-emitter before CLI checks
2022-09-05 12:01:12 +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
Daniel Chew 8cea878c34
remove resource memory limit (#263) 2022-09-02 12:36:56 +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
Jayant Krishnamurthy b485ef4d16
Use Confirmed confirmation level instead of Finalized (#256)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-08-29 11:23:17 +02:00
Ali Behjati 56563599ac
Abehjati/update-target-chains (#260)
* Disable storage collision check on some migrations

Some changes after them have storage collision and this requires them to
disable it too

* Add new implementation memory layouts
2022-08-26 12:01:30 +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 a17b27f3d1
Eth contract fix memory + new sdk + refactor (#257)
* Update sdk version

* Update the contract according to the sdk changes

- Change some memory modifiers to improve gas efficiency
- Implement getValidTimePeriod() and remove old staleness logic
- Update the tests

* Update latest migration descriptions

* Add version

* Update Deploying.md

* Add test to validate version of the contract

* Add deploy commit hash

* Rename the placeholder

* Fix placeholder
2022-08-24 19:33:49 +02:00
Ali Behjati 995c886804
Update solidity sdk version (#255)
* Update solidity sdk package.

* Add migration files
2022-08-23 09:48:24 +02:00
Ali Behjati f09c46b1cd
Make validTimePeriod configurable (#249)
* Make validTimePeriod configurable
2022-08-22 20:13:13 +02:00
Ali Behjati c058f2fff7
Rename image push gh actions (#254) 2022-08-22 13:28:57 +02: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
Stanisław Drozd 130c0522f0
pyth2wormhole: Fix a cfg migration bug, fix cfg lockout (see below) (#253)
This commit resolves a runtime problem in migrate() which occurred on devnet, as
well as invalid mutability for the old config and misuse of the
checked_sub() method.

The runtime problem came from a non-zero balance existing on
not-yet-used PDA. Effectively, this means permissionless
initialization of PDAs on Solana. Anyone can send lamports to any
account on Solana (existing or not), and it doesn't take much funds to
keep an empty account exempt. While it is possible to recover from it,
this case is relatively rare and takes a lot of code to
automate. Instead, we settle for a dumb bump of the config PDA
seed (see config.rs).

This measure is best used sparingly, as it imposes the same static
seed on all SOL networks. This will cause headaches if the attester
tooling grows a third-party user base.
2022-08-19 08:45:47 -07:00
Ali Behjati 22cdd5efb1
Abehjati/update-eth-contract-prev-price (#252)
* Set prev* to current* when price gets stale

* Add new solidity sdk

* Add migration files for this update

* rename diff to absDiff

Strangely, although you cannot use parent private method, you cannot
define a method with same name

* Add a comment to explain the prevPrice replacement
2022-08-19 13:42:19 +02:00
Ali Behjati 2a5b98187b
Add p2w-attest image (#250)
* Add p2w-attest image

Also rename pyth-price to xc-server

* bugfix
2022-08-16 10:53:08 +02:00
Ali Behjati 6fc11fc289
Upgrade testnet contracts (#248)
* Upgrade testnet contracts

And fixes some issues for it. Specially it uses
unsafeSkipStorage to skip OZ collision check
as they are very conservative and doesn't
cover our valid memory changes.
We should be very careful in memory
changes now that we cannot use
OZ collision check.

* Address Tom comments
2022-08-10 15:58:13 +02:00
Ali Behjati 2361793147
Enable multiple datasource in cw contract (#247) 2022-08-02 11:30:32 +02:00
Ali Behjati d5186f8d56
Update 4_pyth_add_events_and_update_fee.js (#244) 2022-07-29 15:57:10 +02:00
Ali Behjati f0e88848eb
Abehjati/cleanup-cosmwasm (#243)
* Remove unneeded stuff and warnings

* Remove old readme and replaye pyth readme with it

* Fix build issue

* Revert wormhole contract.rs change

* Address review comments

* Address review comments

* Make Readme more clear
2022-07-29 09:53:21 +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 5320c58cf6
Implement the new IPyth events and methods (#241)
* Implement the new IPyth events and methods

* Check contracts gets the fees in tests

* Fix the fee variable position to avoid conflict

* Add migration files.

* Add events to migration names and docs

* Fix pyth contract address in tests

Very strangely after adding migration steps the old address
used in evm relay became wormhole implementation address
I looked at eth-0/tests container logs and saw the
address is entirely different (before and after the change)

* Fix previous migration bug.

* rename instance to proxy to be more clear

* Update Deploying.md
2022-07-28 14:56:13 +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