Commit Graph

2409 Commits

Author SHA1 Message Date
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
Ali Behjati 11a0ba17d0
[eth] Deploy to gnosis mainnet (#892) 2023-06-15 20:58:39 +02:00
Jayant Krishnamurthy 25c1ac2c33
[xc-admin] Contract management tool (#885)
* cleanup

* blah

* gr

* stuff

* hm

* hmm

* wtf

* ah fix this

* ok finally it does something

* ok

* hrm

* hrm

* blah

* blah
2023-06-15 07:17:20 -07:00
guibescos e1377e5627
[Xc admin cli] add and remove members (#887)
* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Comment

* Comment
2023-06-15 13:08:14 +01:00
swimricky 9adc340f1d
feat(message-buffer): add .env.pythnet for message buffer init script (#889) 2023-06-14 08:03:02 -07:00
swimricky 23f676f99a
feat(xc-admin): enable message buffer for pythnet (#890) 2023-06-14 15:07:18 +01:00
swimricky 44cd5fc42d
[eth] more update/parsePriceFeed optimizations (#886)
* perf(ethereum): optimize gas & bytesize by changing  some function parameters to use bytes memory

change parseWormholeMerkleHeaderNumUpdates & parsePriceFeedMessage to use bytes memory instead of
bytes calldata for function parameters

* perf(ethereum): more optimizations

use bytes memory for more functions, change parsePriceFeedMessage to use offset instead of copying a
slice

* [eth] Add unsafe calldata bytes lib (#888)

* Copy UnsafeBytesLib to UnsafeCalldataBytesLib

* [eth] Add UnsafeCalldataBytesLib and update code

---------

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2023-06-14 09:20:52 -04:00
swimricky bc338ccfb5
[eth]: add forward compatibility test for accumulator updateData (#884)
* test(ethereum): add forward compatibility test for accumulator data

* test(ethereum): fix typo and rename
2023-06-13 11:02:41 -07:00
Jayant Krishnamurthy 3ffcf12a70
Encapsulate parameters to proposeX methods (#870)
* refactor

* stuff

* i think this works

* cleanup

* fix
2023-06-13 10:23:01 -07:00
Ali Behjati 29dad7acc7
[hermes] Add get_price_feed endpoint (#883) 2023-06-13 17:24:13 +02:00
Ali Behjati f394d9e761
[hermes] Fix memory leak (#881) 2023-06-13 17:11:47 +02:00
swimricky 19b77e2c84
[ethereum] - charge updateFee per number of updates (#878)
* feat(ethereum): charge update fee per numUpdates for accumulator updates

* refactor(ethereum): refactor, add benchmarks for getUpdateFee

* refactor(ethereum): add back parseWormholeMerkleHeaderNumUpdates

* refactor: increment totalNumUdpates by 1 for batch prices

* test(ethereum): add test for checking getUpdateFee for accumulator, clean up unused code
2023-06-13 07:25:46 -07:00
Ali Behjati 75abeb1553
[price-service] Add minSymbols check to liveness (#882) 2023-06-13 14:40:34 +02:00
Mohammad Amin Khashkhashi Moghaddam 211bf02450
Implement accumulator updates for cosmwasm (#880)
* Implement accumulator updates for cosmwasm

* Update fee calculation logic for accumulator messages

The fee for accumulator messages is base fee times the number of messages
but the logic remains the same for the batch method
2023-06-13 12:59:29 +02:00
Dev Kalra 3721dd2c57
[price_pusher] Injective: cache sequence number (#874)
* Empty-Commit

* support for sequence number

* cleanup

* bump version
2023-06-13 02:00:30 +05:30
Mohammad Amin Khashkhashi Moghaddam 6014400205
Move message structures from pyth-client repo to pythnet-sdk (#867)
* Move message structures from pyth-client repo to pythnet-sdk

All rust based smart contracts could leverage these structures for deserializing
pyth messages. But having them in pyth-client makes all the smart contracts packages
depend on irrelevant packages such as solana libraries which caused dependency conflicts
With these structs moved here it would be easier to reuse them in other places

The custom (de)serialization logic remains in pyth-client since it was only to reduce binary size of the program deployed on mainnet/pythnet, therefore not necessary to be exposed here.

* Put arbitrary implementations behind quickcheck feature flag

* Expose magic variables and define them once
2023-06-12 19:34:08 +02:00
Ali Behjati 91ce66d19b
[pythnet-sdk] Update wh seq address comment (#879) 2023-06-12 12:57:47 -04:00
Ali Behjati fbd0354b43
Update hermes-image-push.yml (#877) 2023-06-12 15:49:26 +02:00
Reisen 54b59e6644 fix: whitespace 2023-06-12 12:05:57 +01:00
Reisen 034dc15cfa feat: add go profiling 2023-06-12 12:05:57 +01:00
Mohammad Amin Khashkhashi Moghaddam e9aae684b1
Add support for 128bit numbers serde (#871)
* Add support for 128bit numbers serde

* Add comment for future plans on large integer serialization
2023-06-12 12:18:09 +02:00
Ali Behjati 7dea578416
[xc-server] Reliability improvements (#875)
* [xc-server] Bugfix and improvements

* Address review comments
2023-06-11 14:58:36 +02:00
swimricky 91ccaee57c
[message-buffer] improve logging for setup message buffer script (#872)
* chore: better loggging for init script

* fix: change init-buffer script to use npx
2023-06-09 13:44:33 -07:00
Ali Behjati c1ccef239c
[xc-admin] Fix frontend Dockerfile (#873) 2023-06-09 21:03:08 +02:00
Ali Behjati 95ca9d1d92
[xc-admin] Add message buffer instructions (#869)
* [xc-admin] Add message buffer instructions

* Use coral-xyz/anchor

* Address feedbacks

* Address feedbacks
2023-06-09 19:56:40 +02:00
Ali Behjati 183081cc20
Expose pythnet message buffer idls (#865) 2023-06-09 14:10:28 +02:00
swimricky 31e8d020cc
[eth] - optimize parse/updatePriceFeeds for gas & bytesize (#868)
* perf: optimize parse/updatePriceFeeds for gas & bytesize

* chore: cleanup

* refactor: renaming functions

* test: add benchmark tests for parse with wh merkle, clean up duplicate code
2023-06-08 13:49:21 -07:00
Reisen 624222e0c8
[pythnet-sdk] Allow as_bytes()/to_bytes() for MerkleRoot/MerklePath (#866)
* feat: allow as_bytes() for MerkleRoot

* feat: add borsh serialization to merkle types
2023-06-08 18:16:25 +01:00
Ali Behjati 7847a79b6a
Update rustfmt (#864) 2023-06-08 15:07:15 +02:00
Reisen 0b7805f285 fix: expose MerkleTree as a real interface that is accumulator friendly 2023-06-08 12:16:50 +01:00
Ali Behjati 0330c9d387
[ci] Fix pre-commit (#863) 2023-06-08 09:45:14 +02:00
swimricky 9ddc7fdc7d
Ethereum/parse price feed updates accumulators (#855)
* feat(target-chains/ethereum): add accumulator support for parsePriceFeedUpdates

* feat(target-chains/ethereum): working impl & test of parsePriceFeedUpdates w/ accumulator data

* refactor(target-contracts/ethereum): refactor pyth accumulator

* refactor: remove console logs & imports

* refactor(target-chain/eth): refactor and more tests

* feat(target-chains/ethereum): address PR feedback

refactor, add parse revert tests

* chore: fix comment

* test(target-chains/ethereum): add/clean up tests

* test: add another test

* test: address more feedback
2023-06-07 12:44:47 -07:00
Ali Behjati bdc3fede24
[eth] Deploy to Kava (#859)
* [eth] Deploy to Kava

* [eth] Bump sdk/js package version

* [eth] Fix pre-commit
2023-06-07 15:29:03 +02:00
guibescos e39db174d0
[pythnet-sdk] Add merkleRoot (#858)
* Add merkleRoot

* Restore file
2023-06-07 12:09:34 +01:00
Mohammad Amin Khashkhashi Moghaddam f764fc8411
Bugfix for magic value check and additional serde test (#860) 2023-06-07 12:50:24 +02:00
Jayant Krishnamurthy b5cfc0cddd
Update readme with hosting recommendations (#852)
* Update readme with hosting recommendations

* add cores
2023-06-06 15:51:49 +02:00
Ali Behjati 404bc6cb81
[ci] Fix pre-commit (#857)
* Update pre-commit

* Update CI rust
2023-06-06 13:15:32 +02:00
Reisen cf7c6839eb address feedback 2023-06-05 15:19:48 +01:00
Ali Behjati 3a1b2a36b3 Address comments 2023-06-05 15:19:48 +01:00
Reisen 468817c5bc Update p2p.go to use tabs 2023-06-05 15:19:48 +01:00
Ali Behjati 417fa50f14 Add Dockerfile + CI release action 2023-06-05 15:19:48 +01:00
Ali Behjati 02de29624c Add vaa cache 2023-06-05 15:19:48 +01:00
Ali Behjati 04806a551e Refactor 2023-06-05 15:19:48 +01:00