* 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
* 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>
* 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
* 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>