Commit Graph

119 Commits

Author SHA1 Message Date
Amin Moghaddam 1be8a02b94
Expose gas-price option for injective price pusher (#1185) 2023-12-14 14:19:36 +01:00
Jayant Krishnamurthy f36e868ef6
[entropy] Typescript code for coin flip example + docs (#1128)
* adding stuff

* add coin flip example

* it works

* docs

* hm

* pr comments
2023-11-01 10:30:04 -07:00
Jayant Krishnamurthy ddbbe2af14
Entropy Solidity SDK & usage example (#1124)
* grr

* revert

* ok

* ok

* ok

* deploy script

* implement interface

* doc comments

* fix comment
2023-10-31 06:32:21 -07:00
Amin Moghaddam d4fad5049c
Restart pusher on balance issues (#1125)
* Restart pusher on balance issues

* Bump
2023-10-31 08:39:22 +01:00
Amin Moghaddam 99eaab878d
Add option to choose a different account derived from the same mnemonic (#1116)
This is useful for running 2 pushers in parallel
2023-10-20 11:53:26 +02:00
Ali Behjati 65e21997e4 chore: remove price service mentions in the repo 2023-10-19 09:25:03 +02:00
Ali Behjati 49d1a579c3 chore: cleanup repo 2023-10-18 18:32:42 +02:00
Ali Behjati 2b51cffdc7 fix(price-service/client): remove axios version lock 2023-10-16 16:46:57 +02:00
Amin Moghaddam eb9526675c
[evm] parsePriceFeed with uniqueness validation (#1089)
* Implement uniqueness
* Add tests and update abi
* Fix MockPyth for the unique version
* Bump version
* Add gas benchmark functions
2023-10-13 14:15:42 +02:00
Amin Moghaddam a224199c8f
Add more debugging info for sui pusher (#1087) 2023-10-11 12:17:46 +02:00
Amin Moghaddam fe6d93fa2e
Include sui sdk js in pusher dockerfile (#1086) 2023-10-11 11:20:10 +02:00
Amin Moghaddam 879efe0e01
[price-pusher] Use sui pyth client and change flow for hermes messages (#1084)
* Use sui pyth client and change flow for hermes messages
2023-10-10 16:04:36 +02:00
Ali Behjati fe070baa48 feat(price-pusher): add gas multiplier cap for evm 2023-10-10 14:40:11 +02:00
Ali Behjati 5fdc0d2545 fix(price-service/server): add max payload size
By default ws library has max payload size of 100 MiB but actually the
biggest valid call is 20 KiB. This change sets the limit to 100 KiB to
add more resilliency on the web socket. The biggest call size can
increase when there are new symbols but this service is not going to
live seeing the 5x current price feeds!
2023-10-04 19:34:58 +02:00
Amin Moghaddam 9324c74569
[price-pusher] Sui pusher forward compatibility (#1072)
* Make sui pusher forward compatible

* Bump pusher version
2023-09-29 14:19:08 +02:00
Amin Moghaddam 061f6a028d
Fix sui js sdk and bump contract (#1071)
* Bump sui version

* Add sui cli package to lerna

* Fix bug in fetching price feed object ids after upgrade
2023-09-29 10:52:41 +02:00
Amin Moghaddam 940c2035f3
[sui-sdk] Sui sdk improvements (#1065)
* Split all coins in 1 transaction

* Use buffer library instead of built-in Buffer
2023-09-25 10:39:14 +02:00
Ali Behjati 65ecd890ae feat(price-service/sdk): add prev_publish_time metadata 2023-09-22 13:30:30 +02:00
Amin Moghaddam 2ec0f0a094
Handle locked gas coins case on sui price pusher (#1060)
* Handle locked gas coins case on sui price pusher
2023-09-22 09:43:12 +02:00
Ali Behjati d5c3090442 feat(price-service/client): add out-of-order flag support 2023-09-19 15:54:33 +02:00
Amin Moghaddam f2ca88176a
Add shimmer mainnet (#1053) 2023-09-15 18:23:12 +02:00
Amin Moghaddam 79ea43553f
Add sepolia testnet (#1051) 2023-09-13 15:53:18 +02:00
Ali Behjati a34f759061 chore(eth): deploy to horizen eon/gobi 2023-09-12 15:10:09 +02:00
Ali Behjati e1ae1ad1c4 fix(eth): update legacy updateFee method pricing 2023-08-31 11:51:27 +02:00
Amin Moghaddam a7d133d063
[cosmwasm] CosmWasm integration with contract manager (#1025)
* Integrate with contract manager for wormhole script

* Remove deprecated scripts and more integration with contract manager

* Remove cosmwasm tools store

These configs are now held in the contract manager

* Update docs on cosmwasm

* Split cosmwasm package into 2 for fixing dependency issues

* Fix cosmwasm README.md

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2023-08-25 16:38:42 +02:00
Mohammad Amin Khashkhashi Moghaddam ac0519b57a
[price-pusher] Bugfix in handling account sequence mismatch (#1028)
account sequence mismatch error could happen in the simulation but the
try catch did not cover that part
Verified the fix by manually incrementing the sequence number twice after
each transaction so a refetch was necessary
2023-08-24 10:57:30 +01:00
Mohammad Amin Khashkhashi Moghaddam 5a714662b0
[sui] Use manual serialization for vaas (#1016)
* Use manual serialization in most of the places

* Update sui js lib and change cli package config
2023-08-22 12:44:43 +02:00
Ali Behjati 1a00598334 feat(price-server): support parsing accumul data 2023-08-17 18:39:02 +03:30
Daniel Chew 110caed6be
change waitForMaybeReadyWebSocket to 5 seconds (#1017)
* change waitForMaybeReadyWebSocket to 5 seconds

* update package-lock.json
2023-08-16 17:37:20 +08:00
Mohammad Amin Khashkhashi Moghaddam b189937365
[sui] Sui dx improvement (#1011)
* Use the actual wormhole deployment on testnet for sui testnet config

* Simpler deployment script

* Bugfix in upgrade payload deserialization

* Bugfix in fetching upgrade digest

* Small contract manager refactoring and more integration for upgrade script in sui

* Remove old scripts

* Add script for just generating the sui contract digest

* Restrict HotPotatoVector borrow access

The return value of `create_price_infos_hot_potato` should not be inspectable
outside of the package.

* Reorganize the cli lib for sui

* Add minimal README for sui cli

* Update the general README for sui

* Reuse sui sdk logic in contract manager


* Manual serialization of accumulator updates for increasing payload size

Default payload size seems to be 1024 bytes which is not enough for messages
with multiple feeds

* Bump sdk version
2023-08-15 17:56:43 +02:00
optke3 55129e5b89
[Sui 21/x] - pyth-sui-js SDK (#1004)
* Add sui js sdk

* Update dependencies and package lock

---------

Co-authored-by: Amin Moghaddam <amin@pyth.network>
2023-08-15 10:52:16 +02:00
Ali Behjati 37ff02f1f9 fix(price_pusher): wait on tx to succeed 2023-08-11 13:14:39 +03:30
Mohammad Amin Khashkhashi Moghaddam caca2da9e2
[price-pusher] Fix fee calculation on injective price pusher (#1007)
* Fix fee calculation on injective price pusher

We used an optimization to calculate the update fee based on the number of VAAs. This used to be true before the accumulator messages but now since both formats can be used, it is not obvious what the final fee would be. We can again try to optimize this code and reduce rpc calls by replicating the fee calculation logic from the smart contract, but for now we have rolled back to the unoptimized version.
2023-08-09 14:43:06 +02:00
Ali Behjati f1eeb94210 chore(eth): add scroll sepolia 2023-08-08 10:21:05 +03:30
Mohammad Amin Khashkhashi Moghaddam 272f3c1984
[contract-manager] Contract manager improvements (#1000)
* Use arrays instead of separate files per config

* Remove redundant endpoint on cosmwasm

* Add functions for upgrading the wormhole guardian sets

* Add wormhole contract management on evm and cosmwasm

* Add getter functions to check what sort of wormhole-deployment is used

* Reorganize contract manager package to be used via other packages

* Remove .env files per network and create a script that outputs the same file

* Use env variables in truffle config and output config in deployments

* Add executeUpdatePriceFeed to contract interface

* Add update pricefeed script

* Add saving functionality to store

* Save new contract configs automatically on Evm

* Make deploy script use the create-env.js internally

* Add utility function to get implementation address for Evm Proxy contracts

* Add shimmer testnet and replace evmos nunfunctional rpc

* New procedure for contract verification

* Update docs and remove duplicate configurations

* Remove shimmer configs

* Read default data source configs via contract manager

* Remove flattened contract before compiling/deploying
2023-08-07 14:13:29 +02:00
Ali Behjati 928027a270
chore(ethereum): deploy to base and syndr_testnet (#988) 2023-07-27 16:16:45 +03:30
Mohammad Amin Khashkhashi Moghaddam 92b295bd7a
[contract-manager] Cosmwasm contracts (#986)
* Add stable testnet contracts

* Fix bug in creating InjectiveExecutor from mnemonic

* Import only from root library

* Code verification on proposals for cosmwasm

* Minimal script to upload wasm codes

* Use the netwrok parameter for InjectiveChain executor instead of endpoints
2023-07-27 14:36:16 +02:00
Mohammad Amin Khashkhashi Moghaddam 31ad2b66a3
[contract-manager] Evm upgrades (#971)
* Add evm contract infos + minor improvements

* Throw error if chainId is invalid instead of using 0 silently

* Add wormholeChainName property for chains to use in governance actions

* Return all signatures upon proposal execution

* Unify privateKey schema for contract manager

* Implement getLastExecutedGovernanceSequence for all contract types

* Unify getPriceFeed interface between contracts

* Add update price feed for evm

* Adjust gasPrice on evm

* Add setter for datasources + add global chain for universal governance instructions

* Add utility function to execute arbitrary governance Vaa

* Remove redundant contract

* Better error message when gas is not enough on deployment

* Add aptos mainnet config

* Restore sui override of setFee governance message generation

* Export executeVaa function

* Address PR feedbacks

* More documentation and cleanup

* Remove INFURA_KEY logic and replace RPC endpoints with public ones

* EVMContract -> EvmContract, EVMChain -> EvmChain

* Make executeUpdatePriceFeed interface on cosmos similar to evm

* Better error message and more comment regarding gas
2023-07-25 08:14:31 +02:00
Mohammad Amin Khashkhashi Moghaddam fbd004f359
[xc-admin-frontend] Xc admin minor fixes (#968)
* Simplify refresh logic

* Bump wormhole-sdk version to include new chain names
2023-07-21 07:31:55 +02:00
Ali Behjati e63490be48
[eth] Add EOS network (#963) 2023-07-18 23:00:47 +03:30
Ali Behjati dcec1e9328
[eth] Finalize accumulator contract (#960) 2023-07-18 12:57:29 +03:30
Mohammad Amin Khashkhashi Moghaddam c732fcf586
Abolish xc governance sdk (#957)
* Replace xc-governance-sdk with xc_admin_common package

xc_admin_package was not using the CHAIN overrides declared in the governance-sdk so it was moved
to that package as well

* Replace xc-governance-sdk with xc_admin_common in other packages

* Remove the package and all of its references

* Fix tests

* Fix bug in GovernanceDataSourceTransfer encoding

* Rename all references to the old package

* Redeploy neutron_testnet contract with new chain id

* Move SetWormholeAddress to separate file
2023-07-17 15:24:54 +02:00
Mohammad Amin Khashkhashi Moghaddam 6c52eb6606
Contract manager upgrades (#952)
* Reuse xc_governance logic as much as possible in contract manager

Some functions in xc_governance were moved and refactored in order to become usable in
contract manager

* Add getBaseUpdateFee function for contract manager

* Add method for executeGovernanceInstructions

* Move up SetFee method to base class

* Add governance upgrade instruction

* Move governance payload generators out of contract classes into chain classes

* Switch from json to yaml for storage

* Remove test script for ci

* Add minimal aptos implementation

* Remove global Chains and Contracts variable and put them in DefaultStore

* Move aptos getClient function to Chain class

* Make denom field in baseUpdateFee optional and remove it from non-cosmwasm chains

* More documentation and minor fixes

* Add vaults storage

Although the set of vaults used in testing/production is just 2 it's a good idea to
not set them as predefined constants. So that for development purposes, we can create
new vaults and test them on the fly without changing too many places.
2023-07-14 12:14:24 +02:00
guibescos a77ee78d13
[eth] Deploy to mantle (#948)
* Deploy mantle

* Update pyth-evm-ks

* Update docs
2023-07-12 14:18:56 +01:00
Ali Behjati 2a4045504d
[eth] Add Linea goerli network (#947)
* [eth] Add Linea goerli network

* Add linea_testnet to eth/sdk/js
2023-07-11 11:15:22 +01:00
Ali Behjati bef4073b54
[price-service/client] Crash by default on WsError (#934)
* [price-service/client] Crash by default on WsError

* Update docker-compose files

* Update package versions again
2023-07-07 11:43:04 +03:30
Ali Behjati aa0e6fdf22
[eth] Add WEMIX network (#940)
* [eth] Add WEMIX network

* Fix pre-commit

* Remove unnecessary change

* Fix prettier

---------

Co-authored-by: Guillermo Bescos <g.bescos@yahoo.com>
2023-07-05 18:15:43 +01:00
Jayant Krishnamurthy 78917f6d65
Implement PythGovernanceAction (#906)
* blah

* rename workflow

* grrr

* ok progress

* ok progress

* ok progress

* grrr

* ok

* fix

* fix layout
2023-07-05 08:35:47 -07:00
Ryu 5e44fa4c95
[price_service] js client: getPriceFeed() (#922)
* [price_service] js client: getPriceFeed()

* Fix pre-commit

* Bump package versions

---------

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2023-06-28 18:28:37 +02:00
optke3 f3edf9c971
[sui 9/x] - hot potato fix for price updates (#805)
* state getters and setters, change Move.toml dependency to sui/integration_v2

* finish state.move

* add new line to pyth

* use deployer cap pattern for state module

* sui pyth

* update price feeds, dynamic object fields, Sui object PriceInfoObject

* register price info object with pyth state after creation

* sui governance

* some newlines

* error codes

* update and comment

* unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades)

* updates

* test_get_update_fee test passes

* fix test_get_update_fee and test_update_price_feeds_corrupt_vaa

* test_update_price_feeds_invalid_data_source

* test_create_and_update_price_feeds

* test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure

* test_update_cache

* update

* test_update_cache_old_update

* update_price_feeds_if_fresh

* comment

* contract upgrades start

* contract upgradeability

* update clock stuff

* edits

* use clone of sui/integration_v2 for stability

* make contract_upgrade::execute a public(friend) fun, remove clock arg

* E_INCORRECT_IDENTIFIER_LENGTH

* comment and edit

* add a single comment

* upgradeability fixes, other fixes

* update, migrate, state, pyth, setup, version_control

* upgradeability, governance, LatestOnly

* - state init_version, init_package_info
- governance and contract ugpradeability stuff

* make several functions public(friend), and friend the right modules in data_source.move

* add comment

* fix bug in from_u8, so that value <= TRANSFER_FEE

* rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES

* set_last_executed_governance_sequence

* set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001

* update README

* Update README.md

* Update README.md

* delete comments

* Update README.md

* Update README.md

* change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt

do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence.

* state::set_last_executed_governance_sequence

* rename error

* add newline to setup.move

* delete space

* Update README.md

* mark test module as well as some imports #[test_only] so sui move build works

* scripts for Pyth contract testing and deployment
remove required_version.move, as it is no longer being used for access control
make init_and_share_state a public(friend) function

* add build to Makefile

* init pyth ts script

* sui deploy and testing scripts

* contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update

* init_pyth.ts, registry.ts, create_price_feed.ts

* create price feeds

* deploy script and Move.toml

* some contract updates to compile with WH branch sui/mainnet
deployment script updates

* update README

* update readme

* rename TS scripts, edit readme

* add rev for wormhole dependency, edit README

* edit create_price_feed script

* - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier
- add test for price_info::get

* contract updates

* script edits

* contract upgrade in version_control.move and fix pyth_create_price_feed.ts

* add get_price_info_object_id function to pyth::state

* tests and build pass

* update scripts

* Pyth mainnet deploy, create all price feeds script

* clean up script imports

* add mainnet addresses to readme

* correct Pyth Mainnet addresses

* create price feeds on mainnet

* use git dependency in Move.toml

* edits

* delete required contracts

* get price info object ids

* get price info object IDs

* add json file containing price feed id to price info object id

* comment

* clean up scripts folder and imports

* more script clean up (comments)

* script updates

* hot potato stuff

* create_price_infos_hot_potato and update_single_price_feed

* don't create hot potato in batch price attestation

* latest only checks in Pyth.move

* delete tab

* edit

* run pre-commit hooks

* update price feeds script

* update_single_price_feed_logic, give hot potato contents type T copy and drop ability

* delete custom price attestation test

* get update multiple price feeds POC to work

* formatting via pre-commit

* update Move.toml so can run "sui move test", delete some error codes that were unused

* update update_price_feeds demo to auto-retrieve price info object ids

* update readme

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* don't print map, get prices after update

* script comments

* Update update_price_feeds.ts

* Update update_price_feeds.ts

* Update README.md

* script for token transfers

* testnet "mainnet simulation" deployment (with 19 mainnet guardians), and testnet deployment (with single testnet guardian)

* mainnet deploy

* update Move.toml

* Update README.md

* Update README.md

* edit readme

* Update README.md

* Update README.md

* Update README.md

* add PRICE_INFO_OBJECT map ID to README

* common questions

* edit comment

* update readme

* fix link

* add comments for update_single_price_feed

* edits

* Update README.md

* Update README.md

* Update README.md

* pre-commit run --all-files
2023-06-20 00:04:01 -04:00