Commit Graph

49 Commits

Author SHA1 Message Date
Mattia Papa
3013cd9bfd Sfraxeth adapter and substream with SDK integration (#87)
* first commit

* feat: implemented get tokens and improved modifier

* feat: added missing functions (to implement)

* feat: implemented getPoolIds

* feat: implemented getCapabilities

* feat: implemented getLimits function

* fix: fixed constructor

* feat and fix: implemented testGetLimitsFraxEthV3 and fixed getLimits

* feat: implementing getPriceAt function

* feat and fix: finished implementing getPriceAt, fixed modifier

* feat: price function and tests implemented

* fix: removed onlySupportedTokens modifier from getPriceAt and applied it in price and swap function

* feat: implemented sell, buy, and swap functions

* implementing final tests

* aligned with main branch

* fixes

* fix: Review Fixes

* feat: 🎨 sfraxeth substream initial scaffolding

* fix: 🎨 protocol component creation at deployment block

* build: 💚 cargo build

* feat: 🎨 map proper event to balance changes

* fix: 🚚 remove unnecessary files

* fix: 💚 ci checks

Due to the CI checks requiring the latest rust nightly, the rust-lang organisation
introduced new doc related rules. This commit fixes the CI errors by making
the necessary changes to the comments in substreams-balancer comments

* fix: 🐛 wasm output name

* fix: 🐛 update starting block = deployment block -1

* feat: 🎨 add store for reward cycles and update balances accounting after after deposit before Withdraw

* feat: 🎨 finish setting up block reward logic

* docs: 📝 add comments on extra module

* build: 📌 adapt dependencies to workspace dependencies

setting prost-types to workspace version causes build errors

* feat: 🎨 add support for several EVM compatible networks

* fix: 🐛 update balance delta accounting logic following the `NextRewardCycle` event only

* fix: 🐛 hex address string param encoding

* fix: 🐛 deployment transaction check

* ci: 💚 ci check passing

* fix: 🐛 issues with hex-binary encoding

* refactor: ♻️ address mappings for various networks

* fix: 💚 formatting

* feat: Implemented testPoolBehaviour

* chore: Removed unused comments

* feat: ⬆️ update to recent sdk

* feat: 🎨 testing setup

* test:  setup test environminte for sfraxeth

* fix: 🐛 unwrap error in map_protocol_changes

* build: ⬆️ update rust version

* build:  remove unnecessary deps

* build: 🚚 remove unnecessary pb/tycho

* fix: 🐛 remove balance owner attribute

* fix: 🐛 remove unnecessary static attributes

* fix: 🐛 remove manual updates

* fix: 🔥 remove unused data model from contract.proto

* fix: 🐛 filter by known components

* feat:  use store delta for reward change accounting

* refactor: ♻️ remove shallow create vault component

* feat:  replace is_deployment_tx logic with simpler txn match

* test:  manual testing with inspection against etherscan

https://etherscan.io/address/0xac3E018457B222d93114458476f3E3416Abbe38F#events

* ci: 💚 ci checks

* fix: 🐛 map_protocol_components output data

* fix: 🐛 output type on map_protocol_changes

* test: 🧪 skip balance checks

* fixed FraxV3FrxEthAdapter arguments for constructor in manifest.yaml

* fix: 🐛 adapter error with overflow/underflow and addresses

* restore: restored previous adater version

* fix: set minimum swap amount to prevent overflow/underflow

* fix: set minimum swap amount only for sfrxETH -> frxETH

* improve: added print block_number to runner.py when get_amout_out fails

* removed console.log

* alignment with propeller main

* Update forge-std submodule reference to include ds-test

* installed protosim_py 0.21.0

* commented out minimum swap amount for sfrxEth -> frxEth pair

* updated adapter limits

* working on fixes

* fix: Adjust getLimits according to protocol limitation.

Previously limits were estimated with token supplies, this commit simplifies limits and adjusts them so they correspond closely with what is supported by the sfrxETH contract.

* chore: fmt

* wip: Changed ubuntu to 20.04, fmt adapters

* wip: Updated python tests

* wip: Trying with ubuntu: latest

* chore: fmt adapters

* wip: Using ubuntu 20.04

* chore: Switched back to ubuntu-latest

---------

Co-authored-by: Ignazio Bovo <ignazio@jsgenesis.com>
Co-authored-by: domenicodev <domenico.romeo3919@gmail.com>
Co-authored-by: kayibal <alan@datarevenue.com>
Co-authored-by: domenicodev <domenico.rom3@gmail.com>
2024-10-23 14:17:45 +01:00
kayibal
378c1c2786 feat(testing): Test multiple amounts. 2024-10-23 12:54:15 +01:00
zizou
c90b190936 fix: correctly handle hexbytes convertion
There was a bug if the value was already a HexBytes that would lead to some tiny changes on the HexBytes, leading to our test being too permissive.
2024-09-06 17:27:31 +02:00
zizou
0e3c1268dd fix: correctly run pre_build.sh in setup_env context instead of in a subshell 2024-09-04 11:14:09 +02:00
Zizou
9c140a71af Merge pull request #67 from propeller-heads/zz/sdk/improve-onboarding-process
refactor: make onboarding easier
2024-08-20 11:33:20 +02:00
Florian Pellissier
c7b1796f7d refactor(testing): make setup_env.sh runnable only from within /testing 2024-08-20 09:07:34 +02:00
Florian Pellissier
2ad12cb659 docs(indexing): miscellaneous small docs improvements 2024-08-20 09:06:52 +02:00
Florian Pellissier
37f1fbfe04 docs(substreams): miscellaneous docs improvements and update 2024-08-19 11:56:55 +02:00
Florian Pellissier
bc2cd6bab2 refactor(testing): miscellaneous improvements and bugfixes
Includes bugfix on `tycho-indexer-client` and `protosim_py`, a script to simplify setting up testing python env and cli improvements. Also add support for building runtime for SwapAdapters with many args that was bugged before.
2024-08-19 11:56:52 +02:00
Florian Pellissier
1f2316713f fix(curve): Update integration tests 2024-08-09 10:39:58 +02:00
Thales Lima
5eea31db40 Rename adapter_handler to adapter_builder and move responsibilities 2024-08-08 17:58:20 -03:00
Thales Lima
c0382fefdf Add aftermath logs 2024-08-08 17:58:20 -03:00
Thales Lima
c4024b9849 Better error diff and colorize it 2024-08-08 17:58:20 -03:00
Florian Pellissier
139f7ac3f5 refactor(substreams-testing): Remove shallow functions, be more 🐍 2024-08-08 17:58:20 -03:00
Florian Pellissier
1f9fe8d583 refactor(substreams-testing): Use Pydantic validators, Hexbytes and improve description 2024-08-08 17:58:20 -03:00
Florian Pellissier
95efda0423 refactor(substreams-testing): Use Pydantic to deserialize test_assets.yaml 2024-08-08 17:58:20 -03:00
kayibal
09d266a810 fix: Update requirements.txt
Assume both protosim_py and tycho-client are available from pypi.
2024-08-08 17:58:20 -03:00
kayibal
e302bfb4a6 feat: Request only contracts of interest
Instead of requesting all contracts just get what is specified by the components.
2024-08-08 17:58:20 -03:00
kayibal
9f4503e2a9 fix: Misc fixes around byte encoding.
Also initialize TychoDB for each test case individually.
2024-08-08 17:58:20 -03:00
Thales Lima
5238141771 Fix hexbytes comparison, fix attribute access 2024-08-08 17:58:20 -03:00
Thales Lima
cb6e997375 Add token_factory 2024-08-08 17:58:20 -03:00
Thales Lima
d0c248fcb6 Add build_snapshot_message method 2024-08-08 17:58:20 -03:00
Thales
d893ab264c Start using external modules 2024-08-08 17:58:20 -03:00
Thales Lima
8ea02613a2 Improve README, add foundry to docker, add handler to build targets 2024-08-08 17:58:20 -03:00
Thales
11619bf8be Add initialization-block to tycho runner, fix docker and improve docs 2024-08-08 17:58:20 -03:00
kayibal
2e50eaf4ba feat(testing): Nicer cli; expose trace parameter
Nicer name for the cli args and expose the vm_traces flag to quickly enable/disable tracing.
2024-08-01 12:09:58 +02:00
kayibal
75b66a85af fix(balancer): Get all balancer tests working. 2024-08-01 12:03:01 +02:00
Florian Pellissier
a6cff51bf6 feat: SDK improvements
Add a way to pull stateless contracts code from node, add more settings to test_assets.yaml, add logic to allow dynamic stateless contract by calling another contract
2024-07-30 16:24:20 +01:00
kayibal
3fab5d6ea7 chore(testing): Move requirements.txt 2024-07-30 11:48:16 +01:00
kayibal
cc91ee27f6 chore(testing): Remove hard sell limit flag.
The setting is now inferred from the adapters capabilities.
2024-07-29 16:49:02 +01:00
kayibal
add412d712 fix(testing): Do not include balances with contracts.
Manually inserted contracts do not have balances attached to them so this would lead to 500 errors on the tycho side. With balances disabled, things work fine now.
2024-07-29 16:47:21 +01:00
kayibal
7beaf731bf fix(testing): Fix postgres volume.
The volume was not mapped to the correct directory and when it was, the bitnami container would have no access for writing into that directory. That was limiting since we could only write about 100MB which for some tests is not enough. Now we simply increase the SHM and do not use any mapping to sidestep the permission issues.
2024-07-29 16:46:23 +01:00
kayibal
4c337a36d1 feat(runner): Support initialized accounts + misc fixes.
Simplifies a lot the setup of testing:

- Looks up tycho-indexer under the usual paths no OS specific naming necessary.
- Simply assumes that protosim can be pulled from our private PyPi
- Navigates the foundry out folder to find solidity runtime binaries

Includes some additional fixes to deal with some attribtues that may have to be reflected to defibot later on.
2024-07-25 19:31:54 +01:00
kayibal
fcaae2f643 chore: Move runner app to separate package 2024-07-25 14:11:29 +01:00
Florian Pellissier
ec435d6094 refactor: Several testing SDK improvements such as:
fix db reset, use latest wheel, print trace in case of failure and add logic to pull stateless contracts
2024-07-25 15:02:57 +02:00
Thales Lima
19bf222e8e Add Balancer test, move requests to RPC Client class 2024-07-23 15:32:52 +02:00
Thales Lima
3ccf0a8a1f Add skip balance check flag for testing module 2024-07-23 15:32:52 +02:00
Thales Lima
e0c1ba3b50 Make tycho_client a python package, small bugfixes 2024-07-23 15:32:52 +02:00
Thales Lima
13c1db8171 Rename tycho to tycho_client 2024-07-23 15:32:52 +02:00
Thales Lima
183868e536 Load Snapshot from RPC request 2024-07-23 15:32:52 +02:00
Thales Lima
5e6c7d4647 Add relative imports, small bugfixes 2024-07-23 15:32:52 +02:00
Thales Lima
ac863a495d Make db url configurable 2024-06-27 21:07:19 +02:00
Thales Lima
a9954873d9 Wrap testing module inside a docker-compose 2024-06-27 16:02:19 +02:00
Florian Pellissier
a96d246e11 fix(test runner): fix how we check balances and stout full buffer 2024-06-14 21:17:32 +02:00
Florian Pellissier
c8f4fd611c chore: add requirements.txt for testing script 2024-06-14 21:17:32 +02:00
Florian Pellissier
bcf11876d2 fix: update docker-compose port for db 2024-06-14 21:17:32 +02:00
Florian Pellissier
30eb0d5add feat(testing): add readme for testing 2024-06-14 21:17:32 +02:00
Florian Pellissier
9a647b76ce feat(testing): add balances check 2024-06-14 21:17:32 +02:00
Florian Pellissier
8cc526527e feat(testing): add a script for Tycho integration testing 2024-06-14 21:17:32 +02:00