Commit Graph

2198 Commits

Author SHA1 Message Date
Ali Behjati df3297e430
[attster] Remove while true and wait instead (#411) 2022-12-05 18:34:31 +01:00
Jayant Krishnamurthy 3beffdfe46
Configure symbol groups by name (#403)
* Refactor to make this change easier

* stop mutating AttestationConfig

* get the product names also

* ok

* refactor

* cleanup

* more cleanup

* more cleanup

* comment

* i think this works

* fix stuff

* clippy

* more cleanup

* main

* main

* fix formatting

* blah

* test

* cleanup

* fix python

* config

* fix test

* grr

* grr

* comments

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
2022-12-02 09:35:33 -08:00
Ali Behjati 06b24609e1
[price-service] Bump version to v2.2.0 (#409) 2022-12-01 19:33:35 +01:00
Ali Behjati 27f9f75b79
[price-service] Fine-tune metrics (#401)
- Remove nodejs default metrics. We don't use them.
- Remove response time metric.
- Remove freshness metric and add gap metric for attestationTime and publishTime.
  They are similar; however, freshness was measured upon user request but gap is
  measured upon receiving the next update.
- Change receivedVaa to actually represent distinct vaa received. Prior
  to this, the older vaas, or vaas with same attestation time were
  not counted in this metric. This will also improve the performance.
- Refactors the code a little. `vaaBytes` type was not string and was
  Buffer. It is fixed now.
2022-12-01 18:37:02 +01:00
Ali Behjati 8d9a707b48
Remove seq output log and py server for that (#408)
Co-authored-by: Stanisław Drozd <stan@nexantic.com>
2022-12-01 18:30:34 +01:00
Ali Behjati f8447f871e
[eth]: Improve optimization runs to 10000 (#406)
* Update a deprecated state var comment

* Improve optimization runs 10000
2022-11-30 15:56:44 +01:00
Ali Behjati 33f5b8a5bf
[eth] Remove ownership entirely in favor of governance (#405) 2022-11-30 12:13:46 +01:00
Ali Behjati c3461e5e1c
[eth] Use PythErrors everywhere (#404)
* Remove unnecessary check
* Use PythErrors everywhere
2022-11-29 18:30:45 +01:00
Ali Behjati b31f768d37
Update wormhole receiver contract (#398)
- Add chainId
- Remove receiver ownership
2022-11-29 13:39:39 +01:00
Ali Behjati 45ce07725f
Update contract initializer (#397)
* Update contract initializer
* Reduce optimizer runs to 1000
2022-11-29 12:11:49 +01:00
Ali Behjati 51514dcd9b
Add clippy to all rust projects (#400) 2022-11-28 18:22:48 +01:00
Ali Behjati 895f053e00
Update remove executor job name to test (#399)
It was named "precommit" before.
2022-11-25 18:02:24 +01:00
Stanisław Drozd bbe35df8cf
drozdziak1/pyth attester prometheus metrics (#396)
* Add prometheus to Tilt with attester metrics

* Dockerfile.prometheus: re-add after faulty merge

* p2w-attest: Clarify port number, remove subpage config

* p2w-attest/util.rs: fix warnings

* p2w-attest: typo
2022-11-25 16:35:32 +01:00
Ali Behjati becc216853
Abehjati/repo-improvement (#395)
* Use a new rustfmt file

* Run cosmwasm action only when needed

* Remove pre-commit from remote-executor action

* Fix formatting

* Run precommit for all files

As previous PR was merged without pre-commit
2022-11-25 11:16:58 +01:00
Ali Behjati c3fefc78fa
[eth] Add CI for Foundry tests (#394)
* [eth]: Add eth contract ci (foundry)

* Update the ci

* Fix ci

* Add paths
2022-11-24 17:32:40 +01:00
Ali Behjati d6e25d9209
Add pre-commit globally (#393)
* Add pre-commit globally

* Fix CI errors
2022-11-24 14:14:29 +01:00
Ali Behjati 275c7b8d1a
[eth] Add parsePriceFeedUpdates method (#392)
* Add the implementation with tests and benchmark

* Refactor the contract to reduce redundancy

* Reduce optimization runs as the contract was huge

It has 177 more gas usage on some benchmark tests
2022-11-23 17:16:28 +01:00
Ali Behjati 598b0dde1b
[eth] Gas improvement: Increase optimizer runs to 10000 (#390)
* [eth]: Gas improvement: Increase optimizer runs to 1_000_000
Increasing optimizer runs will optimize the gas usage of methods more and will increase the contract size, hence the deployment cost.

Snapshot difference:
```
testBenchmarkGetUpdateFee() (gas: -101 (-0.076%))
testBenchmarkUpdatePriceFeedsIfNecessaryNotFresh() (gas: -334 (-0.189%))
testBenchmarkUpdatePriceFeedsNotFresh() (gas: -1312 (-0.416%))
testBenchmarkUpdatePriceFeedsIfNecessaryFresh() (gas: -1626 (-0.430%))
testBenchmarkUpdatePriceFeedsFresh() (gas: -1576 (-0.441%))
testBenchmarkGetPrice() (gas: -259 (-0.969%))
```

p.s: I read one place that `runs` is an estimate of how many times the contract is expected to be called as opposed to number of optimization passes through the code!

* Change optimizer_runs to 10000
2022-11-18 15:42:19 +01:00
Ali Behjati bb06fdb831
[eth] Gas improvement: Optimize getPrice and getEmaPrice (#389)
* Optimize getPrice and getEmaPrice
2022-11-18 14:42:06 +01:00
Stanisław Drozd b1afaacabf
drozdziak1/pyth attester rpc timeout fix (#391)
* pyth2wormhole-client: Stagger attestation sched jobs

* pyth2wormhole-client 1.0.0-rc1

This is an initial semver release for the pyth2wormhole-client package.

* p2w_autoattest.py: Add env for atteser --timeout option

* pyth-attesster v1.0.0-rc2

* pyth-attester-v1.0.0-rc3

This fixes a typo in p2w_autoattest.py

* pyth-attester-v1.0.0
2022-11-18 14:00:44 +01:00
Ali Behjati 9c5425d829
Optimize updatePriceFeedsIfNecessary (#388) 2022-11-17 20:41:02 +01:00
Ali Behjati 2597596022
[eth] Gas improvement: Optimize events (#387)
* Update pyth-sdk-solidity version

* Add parsePriceFeedUpdates as an empty method

To be implemented in the future

* Update events

* Fix tests

* Address Tom review comment

* Fix Pyth forge test
2022-11-17 17:44:21 +01:00
njkumr 3b80bda833
updating security.md (#385) 2022-11-14 13:07:06 +00:00
Ali Behjati ca7441fd68
[eth] Gas improvement: Use optimized version of BytesLib (#380)
* Copy BytesLib.sol to OptimizedBytesLib.sol

* Remove `require`s from OptimizedBytesLib

* Use OptimizedBytesLib

* revert to use BytesLib for governance

* Rename to UnsafeBytesLib + use it explicitly
2022-11-10 17:17:16 +00:00
Turbo-Gus 1a5b31f41a
test: use proper aptos addresses for tests (#384) 2022-11-09 21:54:58 +00:00
Turbo-Gus 0f42b66438
fix: use correct struct in update_cache_for_test (#382) 2022-11-09 08:37:03 +00:00
Ali Behjati 9d5cc533ea
Change internal storage layout and order (#379) 2022-11-07 13:01:49 +01:00
njkumr 81325a5a0d
njkumr/audit report (#369)
* updating SECURITY.md with audit reports

* adding Zellic's pyth-evm report

* adding OtterSec's pyth-aptos reports
2022-11-07 10:42:57 +00:00
Ali Behjati b0a2b13e22
[eth] Wrap parsing method with unchecked (#378)
* Move parsing method to unchecked

There is no overflow possible there

* Update another for loop to be unchecked
2022-11-04 17:48:20 +01:00
Ali Behjati 8db2af6ee5
Use latestPriceInfoPublishTime when possible (#377) 2022-11-04 17:16:14 +01:00
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 61b84c84ac
[test-publisher]: Set cap on dyn added symbols (#371)
* [test-publisher]: Set cap on dyn added symbols

Currently the test publisher creates a new symbol every two minutes
without any cap and running tilt for a
long time will eventually drain all the resources.

This change sets a cap of PYTH_TEST_SYMBOL_COUNT
on the dynamically added symbols. It means that the publisher
starts with PYTH_TEST_SYMBOL_COUNT and will add at most
PYTH_TEST_SYMBOL_COUNT new symbols after that

* Update third_party/pyth/pyth_publisher.py

Co-authored-by: Stanisław Drozd <stan@nexantic.com>

* Update third_party/pyth/pyth_publisher.py

Co-authored-by: Stanisław Drozd <stan@nexantic.com>

* Update third_party/pyth/pyth_publisher.py

Co-authored-by: Stanisław Drozd <stan@nexantic.com>

Co-authored-by: Stanisław Drozd <stan@nexantic.com>
2022-11-03 13:58:44 +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
Stanisław Drozd 2c542f9aa6
xc-tool: Initial commit (#366) 2022-11-02 13:38:00 +01:00
adirutwn c3f34a087a
[FEAT] Allow any contract to update the cache in test (#370)
* feat: allow public to update cache in test

* chore: change according to code review

* chore: rename func
2022-11-02 09:59:58 +00: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
guibescos a19cd93cd3
Update example to use APT pricefeed (#365)
* Update example

* Update address of example contract
2022-10-28 09:31:09 -05:00
Ali Behjati a9a1fb7b5a
Add deployment files of optimism goerli + fix bugs (#364) 2022-10-27 20:01:14 +02:00
Ali Behjati 044a867e11
Add verify command for wormhole msg (#363) 2022-10-27 10:02:38 +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 eea42578b0
Abehjati/simplify-multisig-cli (#361)
* Move some configs to a config file inside code

* Remove redundant ledger logs

* Use getSquads for execute too

* Refactor ledger logging removal

* update Readme
2022-10-25 14:45:26 +02:00
Ali Behjati 4629f689e4
Add receive time to the price service (#360)
* Add receive time to the price service

* Bump version to 2.1.0
2022-10-24 19:16:56 +02:00
Stanisław Drozd 3eb2beabe7
Drozdziak1/p2w attest cont mapping reload (#330)
* pyth2wormhole-client: automatically crawl mapping based on interval

* Make the mapping crawl automation seamless

* pyth2wormhole-client: Make mapping crawling routine more robust

This change takes care of recoverable mapping crawling
errors (e.g. malformed single price on single product is no longer
dropping otherwise good different prices and products in the mapping
in favor of a warn message)

* pyth2wormhole-client: Move mapping crawl sleep near logic it affects

* pyth2wormhole-client: remove stray comment

* pyth2wormhole: Fix faulty merge with master

* pyth2wormhole-client: Fix mapping crawl price counting

* pyth2wormhole-client: split daemon/non-daemon, improve readabi[...]

...lity and remove most warnings

* pyth2wormhole-client: parts-per-thousand -> base points

* pyth2wormhole-client: inaccurate comment

* p2w-client: review advice - bp -> bps, std hasher -> sha256

* pyth2wormhole-client: reuse message queue across mapping lookups
2022-10-24 17:19:25 +02:00
Ali Behjati d9e94b284d
Refactor the governance code a bit (#359) 2022-10-21 17:04:19 +02:00
Stanisław Drozd 0a8db01c10
Dockerfile.client, Dockerfile.solana: harden caching to cut CI time (#332)
* Dockerfile.client, Dockerfile.solana: harden caching to cut CI time

This change attempts to add useful items to the docker caching which
should save time downloading crates and by adding path=<full path> and
dropping id=<name> ensure that no Dockerfile cache mismatches occur. I
think the id= param is meant to help group builds that benefit from
common cache, but in case of pyth2wormhole-client/SOL contract builds
it became a competition between the two replacing the other's caches

* Dockerfile.client: remove malformed id= params
2022-10-20 12:33:18 +02:00
Daniel Chew b784abd144
add change-threshold, add-member, and remove-member (#358) 2022-10-20 17:25:53 +08: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
guibescos 808e9392e3
Update address again (#357) 2022-10-18 20:45:09 -05:00