Commit Graph

643 Commits

Author SHA1 Message Date
Zizou
12369c3981 fix: update get_block_storage_changes to correctly emit previous value (#280)
Before this commit we were using the latest `ContractSlot` for both previous and new value. This is not correct because if the value changed twice we would have the middle value emitted as "previous". For example if a value was changed like this in a single transaction 1 -> 10 -> 2 we would have `new_value=2` and `previous_values=10` while the previous value was actually 1.

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-09-25 17:41:07 +02:00
zach
486bd0c9e9 fix: build cmd 2025-09-25 21:00:04 +08:00
Tamara
eaca47479b feat: Simulate txs against RPC (#261)
* feat: (WIP) Simulate txs against RPC

* fix: include test_executor_addresses.json

We should probably fetch this from execution instead. Will do later

* feat: (WIP) Attempt to use TokenProxyOverwriteFactory

* feat: (WIP) Attempt to use TokenProxyOverwriteFactory

* feat: Add simulating execution using debug_traceCall

Decoded amount out from execution and compared with the one from simulation
Allow for printing the execution traces
Moved all execution methods into execution.rs
Created traces.rs (heavily clauded) that prints the traces nicely and gets the function selectors frm 4byte (I decided not to use EtherscanIdentifier from foundry because adding foundry as a dependency is really heavy and I expect problems because of it)

Temporary: hardcoded storage slots for test_weighted_pool_v4 to pass

#time 1h 55m

* feat: Use BalanceSlotDetector and AllowanceSlotDetector from tycho_ethereum

#time 1h 14m

* fix: Improve traces.rs

#time 2m

* feat: Add skip_execution

Also get tycho router bytecode at compile time

#time 22m

* test: Skip tests that are before the Shanghai upgrade

Remove unnecessary TODOs

#time 35m

* feat: Point tycho dependencies to specific commits

#time 9m

* fix: Set historical_trade to true in TychoRouterEncoderBuilder

#time 41m


#time 0m

* feat: Improve traces.rs (use foundry instead of 4bytes)

Improved the format of the printed trace as well

#time 1h 7m

* fix: After merge fixes

#time 3m

* feat: Use new executors_addresses in tycho-execution and read it at startup

#time 1h 25m

* feat: Create a new flag to enable execution_traces

#time 9m

* fix: Small code, log and trace improvements

Add trying to decode method's calldatas in tracing

#time 1m

* fix: Simplify simulate_transactions_with_tracing by introducing a new method: bytes_to_fixed_32

#time 13m

* fix: After merge fixes

#time 1m

* fix: Include executor's bytecode at compile time

#time 11m

---------

Co-authored-by: TAMARA LIPOWSKI <data.lipowski@extaccount.com>
Co-authored-by: Diana Carvalho <diana@propellerheads.xyz>
2025-09-23 15:57:43 +01:00
TAMARA LIPOWSKI
dbabda84f2 chore: improved logging and comment 2025-09-23 00:42:23 -04:00
TAMARA LIPOWSKI
69352511e7 chore: Make CI happy
Errors such as...
error: struct `Pools` is never constructed
2025-09-23 00:42:23 -04:00
TAMARA LIPOWSKI
2c0c4d97fb refactor: Move module_name to integration test yaml
It's not good to keep this in the test_runner because then we have multiple points that we need to edit the test config, which can be hard to find.

We need this because the module name for uniswap_v2 is so far different from the rest of the protocols.
2025-09-23 00:42:23 -04:00
TAMARA LIPOWSKI
99c8a32d23 feat: Add test for PancakeswapV2
- There are some ugly hardcodings here that I hope to improve.
2025-09-23 00:42:23 -04:00
TAMARA LIPOWSKI
1c5cf42d00 feat: Add test for UniswapV2
- Used a random post-Shanghai-created USV2 pool state with enough liquidity for the test

Necessary fixes:
- Don't hardcode to EVMPoolState
- Don't expect adapter to always be set.
- UniswapV2 names its module differently for some reason... this seems like a special case so instead of updating all integration test yamls, I'm just hardcoding it in test_runner.rs. Perhaps not the best decision?
- Log the static attributes if not found.
- Get the substreams yaml path from config instead of hardcoding it.
2025-09-23 00:42:23 -04:00
TAMARA LIPOWSKI
12e6e48a78 feat: Add test for UniswapV2
- Used a random post-Shanghai-created USV2 pool state with enough liquidity for the test

Necessary fixes:
- Don't hardcode to EVMPoolState
- Don't expect adapter to always be set.
- UniswapV2 names its module differently for some reason... this seems like a special case so instead of updating all integration test yamls, I'm just hardcoding it in test_runner.rs. Perhaps not the best decision?
- Log the static attributes if not found.
- Get the substreams yaml path from config instead of hardcoding it.
2025-09-23 00:42:23 -04:00
adrian
9f4ff71b70 refactor: remove skip_balance_check from run_test signature
This field is redundant, as it can be read directly from `config`
2025-09-18 20:00:06 +02:00
adrian
a895d7e1fe fix: add protocol_system key to ekubo test definition 2025-09-18 20:00:06 +02:00
adrian
323063da23 fix: move adapter contract building/finding after filtering components 2025-09-18 20:00:06 +02:00
TAMARA LIPOWSKI
ca7998c5ce fix: Curve SDK tests
- Don't care about token order when comparing. We did not care in the python package. Not sure there is any advantage to caring.
2025-09-18 11:51:38 -04:00
TAMARA LIPOWSKI
8ad709b07a fix: Maverick V2 SDK tests
- substreams.yaml was missing.
- verified both integration tests now pass in Rust and Python test suites
2025-09-18 11:18:41 -04:00
TAMARA LIPOWSKI
0cf444c5f9 fix: Remove failing Balancer V3 tests
- These were also failing in python.
2025-09-18 11:18:25 -04:00
TAMARA LIPOWSKI
0226bda482 fix: Compare lowercase component IDs
- This was failing. Make this more lenient so the user can specify component id in the test file in a non-case-sensitive manner.
- Also switched around a wrong token order which was causing a failure (not sure we care about token order but we may in the future? Python didn't care...)
2025-09-18 11:18:25 -04:00
TAMARA LIPOWSKI
779c690b6d fix: Fix python tests
- These are just used for comparison purposes and will eventually be deleted.
- Also balancer v3 test fix: add protocol_system to yaml, and remove "excludePaths" from protobuf in substreams.yaml (this entry was not supported)
2025-09-18 11:18:25 -04:00
adrian
f00a625182 fix: remove break-lines from "Get changed substreams folders" step output
When multiple changes were detected, each one was written in a separate line, causing an error on github actions
2025-09-18 15:22:00 +02:00
adrian
b1315d1863 test: remove test_composable_stable_pool_creation for balancer-v2 2025-09-17 10:27:44 +02:00
adrian
e1d0c58e64 test: add ci workflow for substreams tests 2025-09-17 10:27:44 +02:00
adrian
183c034204 chore: remove ./substreams/target/wasm32-unknown-unknown/release/*.d files 2025-09-16 11:31:19 +02:00
adrian
b4bf7b770a chore: add missing evm file 2025-09-16 11:31:19 +02:00
adrian
e684a64002 fix: logs handling 2025-09-16 11:31:19 +02:00
adrian
b0f620539b feat: rollback cargo-chef usage 2025-09-16 11:31:19 +02:00
adrian
a3f7a2eac4 feat: improve run.Dockerfile 2025-09-16 11:31:19 +02:00
adrian
3332a88e6f fix: version handling in protocol-testing 2025-09-16 11:31:19 +02:00
adrian
d728440048 feat: add evm and wasm files 2025-09-16 11:31:19 +02:00
adrian
46cfaefbd6 feat: print version and hash when protocol-testing binary is run 2025-09-16 11:31:19 +02:00
dianacarvalho1
89b56e2d42 fix: Pass vm_traces to DecoderContext (#264)
#time 2h 39m
2025-09-12 16:51:19 +01:00
adrian
298bf13e87 refactor: use image field in docker-compose to leverage docker buildx for caching purposes 2025-09-12 10:59:17 +02:00
adrian
92336df9bb feat: skip tests run if the config is invalid 2025-09-12 10:59:17 +02:00
adrian
85080dd6c7 feat: set tycho_logs to false by default 2025-09-12 10:59:17 +02:00
adrian
a84b6518cf chore: remove unused AUTH_API_KEY from docker-compose 2025-09-12 10:59:17 +02:00
adrian
2ea296fb8b fix: pass RUST_LOG down to tycho-indexer 2025-09-12 10:59:17 +02:00
adrian
2a0af6c733 feat: upgrade tycho deps in protocol-testing 2025-09-12 10:59:17 +02:00
adrian
bd532c40b0 feat: bump tycho-indexer to 0.83.3 in docker file 2025-09-12 10:59:17 +02:00
adrian
e6822ae29d fix: run forge build in ./evm directory 2025-09-11 16:27:01 +02:00
adrian
fc56311a81 refactor: add a root-path argument to build the necessary paths ouf of it, instead of passing them separately 2025-09-11 16:27:01 +02:00
adrian
aedab8e8b2 fix: installation of substreams cli 2025-09-11 16:27:01 +02:00
dianacarvalho1
22843cfd3b feat: Add encoding to test suite (#259)
* feat: Add encoding to test suite

Use execution from simulation
Add protocol_system to all test files and pass it to run tycho
Add encoding_utils.rs

#time 5h 0m

#time 1m

#time 7m

* refactor: Move encoding swap to its own method to simplify main code

Rename encoding_utils.rs to encoding.rs

#time 20m


#time 0m

#time 0m
2025-09-11 14:30:49 +01:00
adrian
db5c418e57 feat: test-runner return error if one of the tests failed 2025-09-11 10:59:00 +02:00
adrian
894b169e6f feat: add --evm-path argument to test CLI 2025-09-11 10:59:00 +02:00
adrian
805447f82b feat: install foundry binaries into run.Dockerfile 2025-09-11 10:59:00 +02:00
adrian
0de847740a feat: in the docker-compose, wait until the db is ready before starting the test runner 2025-09-11 10:41:19 +02:00
TAMARA LIPOWSKI
4aaaa0f3e3 test: Improve block header test assertion
Don't be lazy, check the actual number.
2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
1d8a0069e2 fix: Use permutations to get token directions
- This is needed for pools which have >2 tokens.
2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
cb3b06bb02 feat: update tycho-simulation version 2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
e121f86ff1 feat: get amount out for both directions
Basically same as before but now in a loop - once per direction - to match the python test suite.
2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
76c9461eb0 feat: Clear PreCachedDB account storage btw tests
[copied from tycho-simulation commit msg]

Main issue:
- This was causing a big issue in the SDK testing, since accounts were being leaked between test cases. Adding this functionality provides an easy way to clear storage on the rust side, by calling .clear() between subsequent tests.

How this manifested:
- Incorrect pool balances were being loaded in the BalancerV2SwapAdapter if tests were run altogether.
- Pool balances were correct if tests were run in isolation.
- We checked that tycho-indexer returned correct pool balances, and we checked pool balances for that block on-chain to be double-sure
- In the python test suite, which was passing, there was code which dropped the whole database between subsequent tests, which was not being duplicated in the rust suite.
2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
d75e62ed3d feat: Fetch proper block header for simulation
- Similarly to the way it was done in the python package.
2025-09-10 11:44:16 -04:00