Commit Graph

168 Commits

Author SHA1 Message Date
Ali Behjati b23258112d
Remove middle structs (#375)
* Remove middle structs

* Parse and process attestation in place

It helps a lot because we won't expand memory anymore

* Update comments

* Remove unusued PriceAttestation struct
2022-11-04 16:44:07 +01:00
Ali Behjati 61651a10f2
Modify PriceInfo struct for gas optimization (#373)
This PR removes unneeded PriceInfo fields and rearranges the struct in a way that it takes less storage.
2022-11-04 11:41:01 +01:00
Ali Behjati 1a9dfb6c0d
[eth]: Fix gas benchmark to generate useful gas snapshot (#372)
* [eth]: Fix incorrect gas usage problem

* Make gas report more accurate

* Update readme

* Address Jayant comment
2022-11-03 12:18:48 +01:00
Ali Behjati 0df243ba9e
[eth] Add benchmark tests (#368)
* Add remappings

This helps vs code solidity LSP work

* Remove unused wormhole contract

* Format foundry config file

* Fix install foundry script

* Add benchmark tests and its utils
2022-11-02 10:59:39 +01:00
Ali Behjati a9a1fb7b5a
Add deployment files of optimism goerli + fix bugs (#364) 2022-10-27 20:01:14 +02:00
Ali Behjati 1c17499d03
Add foundry base (#362)
* Add foundry base

* Address Reisen comments
2022-10-25 17:49:24 +02:00
Ali Behjati d9e94b284d
Refactor the governance code a bit (#359) 2022-10-21 17:04:19 +02:00
Ali Behjati bdc492f919
[eth] Some contract improvements (#356) 2022-10-19 19:47:09 +02:00
Ali Behjati 398b18743d
[eth] Make governance transfer less error-prone (#355) 2022-10-19 19:46:26 +02:00
Ali Behjati d3d10f2ce2
Add set fee to tests + add some sanity checks (#350)
* Add set fee to tests + add some sanity checks

* Add fee to evm relayer
2022-10-18 19:07:37 +02:00
Ali Behjati c47199d6cb
[eth] contract improvement (#348)
* Make Pyth.initialize private

* Make contract upgrade more resillient + add fail test

* Remove deployCommitHash

The deployCommitHash process is error-prone and it's alternatives
require changing many parts of the code.
And as it is not used anywhere. I believe it is not
worth the effort.

* Improve price not found log
2022-10-17 16:19:55 +02:00
Ali Behjati 62ef9d7d1f
Add set fee mainnet deployment info (#349) 2022-10-17 13:46:11 +02:00
Ali Behjati f7958e387f
[eth] Add set fee migration step + deployment process improvement (#346)
* Remove celo conf files as we are not there

* Remove some unused files

* Move common variables to cluster env
Also rename mainnet to ethereum

* Update migration scripts

* Remove ropsten, it's decommissioned

* Update template

* Create deployment script

* Add set fee migration step

* Comment out old upgrade process with good comments

* Address Tom comments

* Use a helper function for loading env
2022-10-13 19:09:52 -05:00
Ali Behjati 8760bfb739
Add deployment files (#320) 2022-09-30 10:38:05 +02:00
Ali Behjati d5b4f571f0
Set/Update governance emitter addresses (#307) 2022-09-28 09:22:50 +02:00
Ali Behjati 4cec02d4da
Upgrade bnb testnet and renounce ownership (#303) 2022-09-28 00:44:51 +02:00
Ali Behjati 9a285cf799
Abehjati/eth-update-interface (#301)
* Update contract interface to the latest sdk

* Add migration step

* Fix eth2 chainid change

* Address reviews
2022-09-23 19:19:02 +02:00
Ali Behjati 44111714f9
Add new contract memory layout (#293) 2022-09-21 15:00:44 +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 05c631b022
Add mainnet networks (#274) 2022-09-10 08:35:07 +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
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
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
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 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 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 d5186f8d56
Update 4_pyth_add_events_and_update_fee.js (#244) 2022-07-29 15:57:10 +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
Tom Pointon 8f8eee7c92
Make Pyth contract abstract (#234) 2022-07-13 11:02:37 +01:00
Tom Pointon b062cd51fa
Remove unnecessary payable marker from wormhole address (#235) 2022-07-13 11:02:22 +01:00
Ali Behjati c69d372ea5
Update Deploying.md (#231) 2022-07-07 18:37:31 +02:00
Stanisław Drozd da1f19bf0b
ethereum: Add support for multiple emitter/chain ID pairs (#228)
* ethereum: Add support for multiple emitter/chain ID pairs

* ethereum: Simplify data source methods, add tests, fix flag bug

* ethereum: Fix incorrect removeDataSource condition, harden its test

* ethereum: Add the multi-source migration to prod-receiver

* PythState.sol: rephrase comment about new data source API

* ethereum/test/pyth.js: run prettier formatting

* ethereum: replace multi-source migration with addDataSource call

* ethereum: mark older chain/emitter ID state as deprecated
2022-06-29 15:10:53 +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 a0d47178bf
Add aurora_testnet deploy data (#223)
* Add aurora_testnet deploy data

* Add wasm as dependency to tilt

As Stan figured out in another PR
2022-06-20 10:22:25 +02:00
Ali Behjati b5555b80f7
Deploy Pyth to testnet networks (#218)
* Deploy Pyth to testnet networks

Deploys to:
- Goerli and Ropsten (eth testnet)
- Fuji (Avalanche testnet)
- Fantom Testnet
- Mumbai (Polygon testnet)
- BNB Testnet

* Update deploying doc for testing

* Improve docs

* Add manual verification process
2022-05-24 13:28:02 +02:00
Ali Behjati 2c1e987b31
Add networks configs (#217)
* Add networks configs

Wormhole addresses are available here:
https://github.com/certusone/wormhole/blob/dev.v2/sdk/js/src/utils/consts.ts

* Fix typo

* Fix a bug in ropsten env
2022-05-20 15:16:24 +02:00
Ali Behjati 09fcb158dd
Add wormhole receiver + docs on how to use it (#216)
* Add wormhole receiver + docs on how to use it

* Fix a mistake in comment

* Update docs + add wormhole receiver address to the registry
2022-05-20 13:12: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
Ali Behjati a1507952f6
Cleanup Ethereum from unused stuff (#214)
Also moves wormhole stuff to a separate directory
2022-05-18 15:12:26 +02:00
Ali Behjati 4dc863abc9
Update contract (#213) 2022-05-18 12:53:20 +02:00
Ali Behjati 75e354f0f6
Update deployment doc (#212) 2022-05-18 10:40:48 +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
Tom Pointon 4f4bec508e
EVM deployment scripts and documentation (#141)
* Make Migrations contract Ownable

* Add prod deployment migrations

* Add BSC Testnet deployment configuration

* Add documentation for deploying contracts to production

* Fix test environment script for deployment to development network

* Fix tilt issues + refactor

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2022-05-13 10:25: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
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
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 ded0fb37bd
evm unit tests in tilt (#186)
* 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

* Fix and enable EVM unit tests in Tilt

commit-id:11bcb841

* EVM p2w tests: ensure true negatives in "should cache price updates"

commit-id:3aaa0527

* pyth.js: typo

commit-id:f76c5465

* EVM: Remove unrelated setup scripts, build contracts in Dockerfile

commit-id:b09c1d83

* ethereum/dockerfile: Remove node_modules caching

commit-id:c66c79c1

* EVM: revert dockerfile

commit-id:2b9e0b7a

* trigger build

commit-id:c7689ec4

* EVM: change stale timestamp test to the exact edge case

commit-id:d2709f47
2022-04-15 13:39:02 +02:00
Tom Pointon 3dbc0f3304
Use pyth-sdk-solidity in EVM contracts (#182)
* Add pyth-sdk-solidity as dependency

* Remove obselete PythSDK contract

* Use PythStructs from pyth-sdk-solidity package

* Make Pyth contract inherit from AbstractPyth

* Update tests to reflect changes
2022-04-12 11:59:43 +01:00