Commit Graph

2501 Commits

Author SHA1 Message Date
Jayant Krishnamurthy aa76c15d1c
Log sui errors (#951)
* log sui errors

* fix precommit
2023-07-13 15:41:29 -07:00
optke3 e3fe85c312
[Sui 18/x] - governance action tests (#949)
* on-chain tests for governance actions

* edit name

* edit

* remove governance data source test that is not working

* edit comment
2023-07-12 12:47:45 -04:00
Mohammad Amin Khashkhashi Moghaddam eddb789134
Restore accidentally removed file (#950) 2023-07-12 16:12:57 +02:00
Mohammad Amin Khashkhashi Moghaddam 66e5f186b2
Initial version of contract manager sdk (#943)
* Initial version of governance sdk

* Add more functionality to Sui contract manager and migrate variable naming to camelCase

* Refactor sui functions

* Add prettier

* Add SuiAuthorizeUpgradeContractInstruction for governance

* Update cosmwasm deploy tools entry point and expose some classes

* Remove console.logs from CosmWasm

* Refactor storage logic and add sui docs

* Use relative path for default path of store

* More documentation and minor fixes

* Rename package

* Add EVM classes

* Implement getters for data sources

* Use Google naming convention for abbreviations

More info here:
https://google.github.io/styleguide/tsguide.html#identifiers-abbreviations

* Change package license

* More comments and documentation

* Store code proxy function in CosmWasm
2023-07-12 15:50: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
Daniel Chew 8752291aa2
fix broken links (#945)
* fix broken links

* undo import order changes

* Fix more links

* Fix more broken links

* Fix more broken links

* Fix more broken links

* Fix precommit

---------

Co-authored-by: Thomaz Leite <thomaz@pyth.network>
Co-authored-by: Guillermo Bescos <g.bescos@yahoo.com>
2023-07-11 11:41:43 +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
optke3 0ec7b69031
[Sui 15/x] - Pyth upgrade script + bug fix (#936)
* upgrade script for Pyth, so far getting the dependencies and digest works

* upgrade_pyth

* made progress: works up until verify_vaa

* delete some comments

* upgrade almost works, on last step now

* comments

* edit

* upgrade process pretty much works (we got an IncompatibleUpgrade error)

* fix bug in pyth migrate process (handle_migrate threw error because take_digest was destroying non-empty cursor and not removing prefix bytes)

* comments and toml file

* revert change to Move.lock file

* remove migrate__v__0_1_1

* prettier
2023-07-10 09:43:27 -04:00
optke3 2c334b6b92
[sui 16/x] - update imports (#942)
* update some script imports

* another one

* remove @optke3/sui.js from dependencies
2023-07-07 11:17:29 -04: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
Sturdy 4f41525a2f
fix: Use generic_err constructor instead of literal (#941)
* fix: Use generic_err constructor instead of literal

* bump version

---------

Co-authored-by: Jayant Krishnamurthy <jayantkrishnamurthy@gmail.com>
2023-07-06 11:02:32 -07:00
swimricky ac97b4d35d
[eth] - Aave FallbackOracle Integration (#924)
* feat(eth): aave integration

Add IPriceOracleGetter and PythAssetRegistry mapping

* feat(eth): remove IPriceOracleGetter from PythAssetRegistryGetter

* refactor(eth): flatten PythAssetRegistySetter/Getter into PythAssetRegistry

* feat(eth): address feedback

move aave related contracts into separate directory, add explicit exponent/decimal handling, add
staleness check

* refactor(eth): minor rename to avoid shadowing

* fix(eth): handle exponent conversion and add tests

* chore(eth): remove unused console import

* feat(eth): address PR feedback

add more checks, tests & minor refactoring

* feat(eth): add more tests and address feedback
2023-07-06 08:29:08 -04:00
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
Jayant Krishnamurthy 52ae0b853a
Update aptos pusher to support high TPS (#937) 2023-07-04 19:33:47 -07:00
guibescos 387f172fc6
Update readme (#939) 2023-07-04 14:49:38 +01:00
Mohammad Amin Khashkhashi Moghaddam 14fd210a16
[sui] More documentation on sui (#938) 2023-07-04 15:24:38 +02:00
Mohammad Amin Khashkhashi Moghaddam 9d2d673d01
[WIP] Finalize SUI contracts and make it backward compatible (#935)
* move test accumulator message details to above the definition

* camel case to snake case

* deserialize and check header inside of parse_and_verify_accumulator_message

* factor out cleanup / destruction function for worm / pyth states and clock

* take_wormhole_and_pyth_states to simplify 9 tests

* get_balance for price_info_object

* Store fees as dynamic fields

* Rename functions and modules back to the published version to remain bacward compatible

* Remove withdrawal functionality for now

This functionality can always be added via contract upgrades

---------

Co-authored-by: optke3 <optke3@gmail.com>
Co-authored-by: optke3 <108488464+optke3@users.noreply.github.com>
2023-07-04 09:40:32 +02:00
Mohammad Amin Khashkhashi Moghaddam 3170e3fc92
[sui] Simplify some tests and add more (#933)
* move test accumulator message details to above the definition

* camel case to snake case

* deserialize and check header inside of parse_and_verify_accumulator_message

* factor out cleanup / destruction function for worm / pyth states and clock

* take_wormhole_and_pyth_states to simplify 9 tests

* update

* Simplify some tests and add more

---------

Co-authored-by: optke3 <optke3@gmail.com>
Co-authored-by: Amin Moghaddam <amin@amins-mbp.tail922f3.ts.net>
2023-07-03 14:45:22 +02:00
optke3 fb1a35af76
[sui 12/x] - updates to pyth accumulator and merkle tree (#926)
* move test accumulator message details to above the definition

* camel case to snake case

* deserialize and check header inside of parse_and_verify_accumulator_message

* factor out cleanup / destruction function for worm / pyth states and clock

* take_wormhole_and_pyth_states to simplify 9 tests

* update
2023-06-30 12:02:38 -05:00
optke3 5e064b0a30
[sui 14/x] - PyCharm Move linter (#928)
* linting stuff

* more linting

* more linting
2023-06-30 12:02:20 -05:00
Mohammad Amin Khashkhashi Moghaddam e5fd5a9d81
[target_chains] Add deployment information for neutron mainnet (#930)
* Deploy pyth cosmwasm 1.2.0 contract to neutron mainnet
2023-06-30 14:33:25 +02: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 a7383a3648
[sui 11/x] - pyth merkle accumulator (#910)
* merkle tree impl

* - take leftmost 20 bytes in hash
- don't assign output of cursor::take_rest to _, instead just drop it

* push PREFIXes (MERKLE_LEAF_PREFIX, MERKLE_NODE_PREFIX) to front instead of back

* delete testXOR

* test construct merkle tree depth exceeded error

* invalid merkle proof test cases

* comments

* rename failure tests

* simplification for initializing a vector

* fix leafHash bug, add tests for hashLeaf and hashNode

* pyth accumulator start, extract_price_info_from_merkle_proof, parse_price_feed_message

* parse_price_feed_message, parse_and_verify_accumulator_updates

* implementation + debugging for merkle pyth accumulator

* edit merkle tree

* testNodehash

* test hash

* delete prints

* test case for parse and verify TEST_ACCUMULATOR_3_MSGS

* hot potato vector -> authenticated price infos

* refactor - move tests from pyth_accumulator to pyth to avoid dependency cycle

* remove _ from deserializing unused vaa

* add sui-contract.yml for github actions

* AuthenticatedPriceInfos -> AuthenticatedVector

* charge base update fee per call to update_single_price_feed

* add back multiple tests, including test_create_and_update_price_feeds_insufficient_fee, update cache, update cache old update

* test multiple price feed creation and update accumulator

* authenticated_price_infos.move -> authenticated_vector.move

* 5 * single_update_fee

* delete some comments, add accumulator test info

* don't make TEST_VAAS test_only in pyth.move

* remove #[test_only]s

* assert price info object contains correct price feed info

* factor out some constants from accumulator test cases to reduce duplicate code

* add sui-contract.yml file for github actions CI

* more refactor and clean-up

* assert price_info_object_1 is correct in test_create_and_update_price_feeds_with_batch_attestation_success

* removed the parse_and_verify_accumulator_message_with_worm_state entirely, and instead added the helper parse_vaa_bytes_from_accumulator_message

* edit comment

* update comment

* edit sui github ci

* fix for sui-contract.yml

* MINIMUM_SUPPORTED_MINOR_VERSION and MAJOR_VERSION

* remove test_get_price_feed_updates_from_accumulator and  parse_vaa_bytes_from_accumulator_message from pyth_accumulator.move

* test_parse_and_verify_accumulator_updates_with_extra_bytes_at_end_of_message

* sui contract yml update

* use rev to cargo install sui in github actions ci

* cargo install --locked for github CI
2023-06-28 10:09:50 -05:00
Ali Behjati 96cb221a3a
[hermes] Fix concurrency issue (#925) 2023-06-28 12:30:06 +02:00
Jayant Krishnamurthy c4c4a6384a
[price_pusher] Create gas pool for Sui (#923)
* [sui][price_pusher]Implement gas pool

* Add the option to specify gas budget to avoid dry run

* Avoid for loop in constructing transaction block

* Improve error handling

* Implement coin consolidation

* minor tweaks

* k

* cleanup

* fix

---------

Co-authored-by: Chris Li <chris@mystenlabs.com>
2023-06-27 09:05:30 -07:00
optke3 382a6fc9a4
[sui 10/x] - merkle tree (#903)
* merkle tree impl

* - take leftmost 20 bytes in hash
- don't assign output of cursor::take_rest to _, instead just drop it

* push PREFIXes (MERKLE_LEAF_PREFIX, MERKLE_NODE_PREFIX) to front instead of back

* delete testXOR

* test construct merkle tree depth exceeded error

* invalid merkle proof test cases

* comments

* rename failure tests

* simplification for initializing a vector

* fix leafHash bug, add tests for hashLeaf and hashNode
2023-06-26 12:05:06 -05:00
Reisen 7c037ed6fb fix: avoid EnumAccess deserialization paths 2023-06-26 14:12:55 +01:00
Mohammad Amin Khashkhashi Moghaddam ee6a744a33
Fix test by increasing major version instead of minor version (#921)
SDK now allows minor version updates, so the test was not failing anymore
as expected
2023-06-26 12:31:06 +02:00
Ali Behjati e39277dd9c
[eth] Add setWormholeAddress governance message (#917)
* [eth] Add setWormholeAddress governance message

* Address review feedbacks

* Add signatures to errors

This will help with debugging

* Update abi
2023-06-26 11:31:19 +02:00
Jayant Krishnamurthy e4d494db9f
[price_pusher] fix bug from last PR (#916) 2023-06-23 10:33:30 -07:00
Ali Behjati dfc2df779c
[hermes] Use raw_message for future-compatibility (#913) 2023-06-23 19:31:44 +02:00
Jayant Krishnamurthy 742c37ed88
Sui pusher updates (#914)
* split into ptbs

* update sui logic

* fix stuff

* revert

* use Map
2023-06-23 09:20:01 -07:00
Mohammad Amin Khashkhashi Moghaddam 69a0a9ec98
Update README.md (#912)
Add PR naming convention
2023-06-23 14:05:02 +01:00
Mohammad Amin Khashkhashi Moghaddam 955c81b1cc
Make AccumulatorUpdateData deserialization accept minor version bumps (#909)
* Make AccumulatorUpdateData deserialization accept minor version increases

* Add test for additional bytes at the end of the message
2023-06-23 14:04:05 +01:00
Mohammad Amin Khashkhashi Moghaddam fb6672fbfb
Aptos accumulators (#904)
* Pin dependency versions

* Implement accumulator support on aptos

* Fix formatting on error.move in aptos

* Add CI workflow for aptos

* Upgrade to aptos cli 1.0.4
2023-06-23 11:27:25 +01:00
swimricky 919f71e68f
[eth] - optimize ReceiverMessages parseAndVerifyVM (#901)
* feat(eth): optimize ReceiverMessages parseAndVerifyVM

* test(eth): update test setups to use wormholeReceiver

* chore(eth): remove console logging

* feat(eth): optimize & revert return type for parseAndVerifyVM

* fix(eth): add index boundary checks

* perf(eth): optimize verifySignature by passing in primitives instead of structs

* test(eth): add wormhole tests related to guardian set validity

* test(eth): add more parseAndVerify failure test cases

* test(eth): add more failure tests for parseAndVerify

* test(eth): add empty forge test, refactor/deduplicate
2023-06-22 14:11:54 -04:00
Ali Behjati d07cc9d1ea
[hermes] Add storage tests + refactor (#907)
* [hermes] Add storage tests + refactor

* Bump pythnet_sdk version + update cosmwasm

* Address review feedbacks
2023-06-22 14:38:56 +01:00
Mohammad Amin Khashkhashi Moghaddam c9c20310d3
Add slot variable in constructing fake wormhole payloads (#908)
The structure of the fake payload was not as expected.
Some tests were failing for the wrong reason but with the right error code.
Added one testcase to make sure the default behavior of the forging function
is correct.
2023-06-22 10:26:34 +01:00
Mohammad Amin Khashkhashi Moghaddam ef963cdfc6
Cosmwasm refactor and preparation for parse price feeds (#895)
* Add more tests for update_fee_amount

Restructure code to split parsing and updating logic so that all
messages can be parsed without being applied

* Fix docker build command for cosmwasm contract

* Refactor is_fee_sufficient tests

Extract out the chain specific part into separate function
Merge test_accumulator_is_fee_sufficient back into is_fee_sufficient

* Rename function and simplify process_batch_attestation tests
2023-06-22 09:49:05 +01:00
Jayant Krishnamurthy 339b2f6ce0
Update price feeds early if part of a batch (#905) 2023-06-21 14:07:35 -07:00
Dev Kalra 8f7b6ee4ba
[price_pusher] fix account sequence mismatch bug (#902)
* fix

* bump version
2023-06-20 22:56:37 +05:30
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
optke3 f34c9df224
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783)
* 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

* pre-commit run --all-files
2023-06-19 23:05:33 -04:00
Ali Behjati 26f3fc3653
[hermes] Add health probe (#899)
* [hermes] Add health probe

* Address feedbacks

* Address feedbacks
2023-06-19 19:25:29 +02:00
Ali Behjati b596090bd8
[hermes] Switch to message structs in pythnet_sdk (#897) 2023-06-19 18:21:39 +02:00
Ali Behjati 4c2dfad755
[hermes] fix cors bug (#896)
* Fix cors policy error

* Bump version

* Remove unused dependencies
2023-06-19 17:15:12 +02:00
Jayant Krishnamurthy 92aa157e85
fix docker build (#898) 2023-06-16 10:39:26 -07:00
Reisen 2b829f36a0
feat: guardian source from ethereum to pythnet (#894) 2023-06-16 15:48:36 +02:00
Ali Behjati b8778c02d5
[price-service] Update readiness probe (#893)
* [price-service] Update readiness probe

This also refactors and explains the last changes on the liveness probe.

* Update comments

* Address review comments
2023-06-16 12:38:25 +02:00