* 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>
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.
- 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
* feat: update balancer v2 spkg to make it return old slot values
This is needed for the new DCI version that uses old values to look into exactly what part of the slot change and compare with the retrigger offset
* refactor: use crate registry instead of github
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* Add Ekubo TWAMM support
* Change order of words
* Account TWAMM order balances
* Fix tracking wrong component balance deltas
Swapped and PositionUpdated are the only events affecting pool TVL
* Fix fee addition
Fees are a .64 instead of a .128 since v2 & the result is rounded
* Consistent naming
* cargo fmt
* Add method for selecting store method from change type
* Only store the affected sale rate delta on OrderUpdated events
* Remove unnecessary parameterization
* Index Ekubo MEV-resist pools
* cargo clippy
* feat: add balancer swapAdapter and Substreams
* fix: undo tycho-substreams logs, ignore abi on rustmft
* ci: prevent warnings from failing CI
* ci: skip size check on CI
* chore: forge fmt
* feat: vault balance from storage
Vault contract tokenBalance message are set according to the vault
storage changes in the `_reserveOf` storage variable VaultStorage.sol
contract
This was the culprit that caused the failure in simulation since
balancer enforces the invariant that `token.balanceOf(vault_addr) == _reservesOf[token]`
* ci: warnings
* fix: avoid duplicated balance changes
* fix: order by ordinal
* chore: format
* feat: extract new contracts before extracting balance changes
* feat: skip unnecessary steps if no balance change is found
* refactor: filter out account balances for tokens that aren't part of any protocol components.
On the indexer side, when we receive an account balance, we need to know about the token. This commit ensure that the token was introduced before we emit any account balance with it.
* refactor: don't index liquidity buffers.
Liquidity buffers rely on rate providers. Therefore we need DCI (feature to be able to index previously created contract) to deal with them.
* refactor: cleanup tests and add docstrings
* chore: lock tycho-substreams version
* ci: set Foundry workflow to use stable foundry
* feat(DCI): Add DCI Entrypoints to BalancerV3 components (#218)
* refactor: fix typo in weighted_pool_factory_contract name
* feat: add rate_providers static attributes
* feat: add DCI entrypoints to BalancerV3 components
* fix: set default trade price to Fraction(0, 1)
* feat: remove buffers as components
Buffers are to be used internally by Boosted pools (stable/weighted pools that use ERC4626 tokens). They are not to be treated as a separate swap component.
* test: update test blocks
Extend tests some tests block range to ensure liquidity was added to the pool and can be simulated on
* feat: remove buffers as components
Remove balance updates for buffer components
* feat: listen for pool pause/unpause events
* chore: formating
* fix: encoding call data
* test: update Balancer V3 tests to use DCI
* test: set indexer log level to info
* docs: add comment on support of boosted pools
* feat: update balancer v3 package version
---------
Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* fix(sdk): properly handle deletion -> creation -> deletion sequence
This commit resolves a bug that occurred when an attribute underwent a deletion, followed by creation, and then another deletion. The system would incorrectly ignore the final deletion because the attribute was mistakenly marked as newly created during the process.
* docs: fix typo
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* feat: Add DCI Entrypoints to BalancerV2 components
* fix: miscellaneous fixes before Balancer V2 resync
This commit fixes the entrypoints created by Balancer v2 packages, removes some disabled factories and remove support for BPT tokens (this is still to be investigated but so far we won't be able to support them)
* refactor: fix CI and bump version
* chore: update comments
---------
Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
* chore: add repository URL to ethereum-maverick-v2.yaml
* chore: bump maverick-v2 version.
This bump is needed because we changed the version of `tycho-substreams` in a previous commit (to fix the bug with contract creation).
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* refactor: update test config to include `coins`
* refactor: rename package to `ethereum_curve` and add repository URL in substreams.yaml
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* feat: add DCI message definitions
#time 4m
#time 2m
* fix: Make entrypoints into a HashSet instead of Vec
#time 0m
* fix: Rollback on message index change in ContractSlot
#time 5m
* feat: Add get_block_storage_changes
#time 34m
#time 0m
* Update substreams/crates/tycho-substreams/src/block_storage.rs
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* Update substreams/crates/tycho-substreams/src/block_storage.rs
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* fix: Filter out calls that are reverted and sort change by ordinal
#time 0m
* fix: Improve performance of get_block_storage_changes
We expect this util function to collect and handle a lot of information repeatedly (on every single block). So top performance optimisation (both memory and computation) is vital to minimise substream lags.
#time 6m
* fix: Use filter and flat_map instead of if and for loops
#time 1m
---------
Co-authored-by: Louise Poole <louise@datarevenue.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* feat(curve): add coins in static attributes
This will be used by tycho-execution when executing swaps on the pool. It is needed because the `exchange` function takes token indexes and not addresses as input.
* style: make clippy happy with `format!`
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* feat: add DCI message definitions
#time 4m
#time 0m
* feat: Add add_entrypoint to TransactionChangesBuilder
#time 15m
#time 0m
* fix: Make entrypoints into a HashSet instead of Vec
#time 0m
* fix: Rollback on message index change in ContractSlot
#time 5m
* fix: Ignore examples in docstrings when running cargo test
---------
Co-authored-by: Louise Poole <louise@datarevenue.com>
the `call.account_creations` field had been deprecated by Substreams because of some edge cases where a new account wasn't detected.
This commit removes the usage of this field in our sdk contract extraction logic and some others specific places. We decided to rely on the call type instead. This approach should be much more robust.
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>