- 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.
- 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...)
- 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)
* 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
[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.
This is why we weren't getting BAL510 for `test_erc4626_linear_pool_creation` in python - simulation was being skipped, though not skipped in the rust porting. The simulation is skipped here since no liquidity has been added in more than 100k blocks.
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).