22 Commits

Author SHA1 Message Date
dianacarvalho1
243cf14c3e feat: Upgrade tycho dependencies (#289)
Don't use tycho_execution from tycho_simulation

#time 8m
2025-09-30 14:33:01 +01:00
dianacarvalho1
b577e7d6b2 refactor: Misc improvements to code (#277)
* refactor: Misc improvements to code

- Decouple validating logic from TychoRunner
- Move all data fetching and decoding the tycho message into the same method
- Split validate_state into validate_state, validate_token_balances and simulate_and_execute
- Make rpc_provider and runtime attributes of TestRunner
- Add references where possible to avoid clones
- Remove unnecessary code
- Make clippy happy

#time 2h 36m

#time 0m


#time 3m

* chore: Use tycho deps and foundry from tycho_simulation

This is to try to decrease the risk of using conflicting versions in the different repositories

#time 32m


#time 0m

* chore: Read RPC_URL in main.rs

#time 10m

* fix: Support eth trades (skip balance and allowance overwrites) and set balance overwrite to amount in

For tokens like USDC setting the balance super high was making us getting blacklisted

#time 1h 12m

* fix: Fix curve tests and filter components_by_id with the expected_component_ids

#time 1h 30m


#time 0m

* fix: Don't use all the possible executor addresses. Hardcode just one for the test

Refactor overwrites logic:
- renamed functions
- moved logic around that fits together
- don't use StateOverrides and then convert to alloy overrides. Use alloy's directly

#time 1h 21m

* fix: Assume that the executors mapping starts at storage value 1

Move setup_router_overwrites away from the rpc and into the execution file
Delete unnecessary get_storage_at

#time 33m
2025-09-25 17:27:05 +01: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
dianacarvalho1
89b56e2d42 fix: Pass vm_traces to DecoderContext (#264)
#time 2h 39m
2025-09-12 16:51:19 +01:00
adrian
2a0af6c733 feat: upgrade tycho deps in protocol-testing 2025-09-12 10:59:17 +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
TAMARA LIPOWSKI
cb3b06bb02 feat: update tycho-simulation version 2025-09-10 11:44:16 -04:00
TAMARA LIPOWSKI
f5bcd31d66 feat: Rust testing SDK - implement get_amount_out simulation 2025-09-10 11:44:16 -04:00
adrian
580a8822a5 feat: add match-test argument to test cli 2025-09-10 16:36:08 +02:00
Tamara
93b969e41f feat(Testing SDK): Pass adapter path to decoder (#249)
* feat: Pass adapter contract to decoder

This was the most elegant solution we could come up with at the moment for having the proper adapter in the builder.

Notes:
- The default adapter bytecode in tycho-simulation is still loaded at compile time.
- If the adapter bytecode is passed to the decoder, it will be loaded dynamically at runtime and used instead the bytecodes in tycho-simulation.
- The adapter bytecode is used in the builder to get capabilities and thus spot prices before returning the state, so just overwriting the adapter in the state is way too cumbersome. We went with this solution since it was the lesser evil, even though we know it leaks VM-specific info to non-vm protocols (which was already being done anyway with the balances).

* feat: Take a struct of vm_attributes instead of just adapter path

So that we don't need to change the interface in the future

* chore: remove comment - we are no longer blocked

This is fixed with the latest change to pass adapter contract to decoder

* feat: Use DecoderContext instead of VMAttributes

- More easily extendable
- Doesn't break the existing decoder interface

---------

Co-authored-by: TAMARA LIPOWSKI <data.lipowski@extaccount.com>
2025-09-08 14:34:27 -04:00
adrian
5a9a757a06 fix: downgrade tycho deps to compatible version with tycho-simulation 2025-09-08 11:29:28 +02:00
adrian
87c9a8b60f test: check that all the existing substreams integration test files can be parsed 2025-09-03 08:55:29 -04:00
TAMARA LIPOWSKI
742948cdf5 feat: Fix tycho-common and -client dependencies
- These should match what we currently have in simulation and execution.
- Also nightly fmt
2025-09-03 08:55:29 -04:00
TAMARA LIPOWSKI
c12affb3ca docs: Add README and logging to match python package
- The readme is useful for us during development. This should be eventually removed and replaced with gitbook docs.
2025-09-03 08:55:29 -04:00
adrian
8205c2a8d5 feat: handle errors in protocol-testing 2025-09-03 08:55:29 -04:00
adrian
f3500dff44 feat: update tycho deps and upgrade code 2025-09-03 08:55:29 -04:00
Thales
def49e7ddf feat: fix test runner. Working version to get_amount_out 2025-09-03 08:55:29 -04:00
Thales Lima
052d11b759 feat: Add tokens balance check and component diff 2025-09-03 08:55:29 -04:00
Thales Lima
2c8e349280 feat: Add methods to fetch state from Tycho RPC 2025-09-03 08:55:29 -04:00
Thales Lima
e3ae70ab43 feat: add Tycho Runner to run separate tycho processes 2025-09-03 08:55:29 -04:00
Thales Lima
4425fe1680 feat: add util to build SPKG with a modified start block 2025-09-03 08:55:29 -04:00
Thales Lima
8b6beb0214 feat: create rust-testing module 2025-09-03 08:55:29 -04:00