Add skip balance check flag for testing module
This commit is contained in:
@@ -5,7 +5,7 @@ FROM --platform=linux/amd64 continuumio/miniconda3:24.4.0-0
|
||||
WORKDIR /app
|
||||
|
||||
# Add current directory code to /app in container
|
||||
ADD ./ /app/testing
|
||||
ADD . /app/testing
|
||||
|
||||
RUN chmod +x /app/testing/tycho-indexer
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Tests are defined in a `yaml` file. A template can be found at `substreams/ether
|
||||
Each test will index all blocks between `start-block` and `stop-block` and verify that the indexed state matches the expected state.
|
||||
|
||||
You will also need the EVM Runtime file for the adapter contract.
|
||||
The script to generate this file is available under `/evm/scripts/buildRuntime.sh`.
|
||||
The script to generate this file is available under `evm/scripts/buildRuntime.sh`.
|
||||
Please place this Runtime file under the respective `substream` directory inside the `evm` folder.
|
||||
|
||||
## Running Tests
|
||||
|
||||
@@ -135,12 +135,13 @@ class TestRunner:
|
||||
tycho_balance = int(balance_hex, 16)
|
||||
token_balances[comp_id][token_lower] = tycho_balance
|
||||
|
||||
node_balance = get_token_balance(token, comp_id, stop_block)
|
||||
if node_balance != tycho_balance:
|
||||
return TestResult.Failed(
|
||||
f"Balance mismatch for {comp_id}:{token} at block {stop_block}: got {node_balance} "
|
||||
f"from rpc call and {tycho_balance} from Substreams"
|
||||
)
|
||||
if self.config["skip_balance_check"] is not True:
|
||||
node_balance = get_token_balance(token, comp_id, stop_block)
|
||||
if node_balance != tycho_balance:
|
||||
return TestResult.Failed(
|
||||
f"Balance mismatch for {comp_id}:{token} at block {stop_block}: got {node_balance} "
|
||||
f"from rpc call and {tycho_balance} from Substreams"
|
||||
)
|
||||
contract_states = self.tycho_runner.get_contract_state()
|
||||
simulation_failures = self.simulate_get_amount_out(
|
||||
token_balances,
|
||||
|
||||
@@ -22,9 +22,9 @@ pip install -r requirements.txt
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from tycho_client.tycho.decoders import ThirdPartyPoolTychoDecoder
|
||||
from tycho_client.tycho.models import Blockchain
|
||||
from tycho_client.tycho.tycho_adapter import TychoPoolStateStreamAdapter
|
||||
from tycho_client.decoders import ThirdPartyPoolTychoDecoder
|
||||
from tycho_client.models import Blockchain
|
||||
from tycho_client.tycho_adapter import TychoPoolStateStreamAdapter
|
||||
|
||||
decoder = ThirdPartyPoolTychoDecoder(
|
||||
"MyProtocolSwapAdapter.evm.runtime", minimum_gas=0, hard_limit=False
|
||||
|
||||
@@ -40,7 +40,7 @@ class Trade(NamedTuple):
|
||||
|
||||
|
||||
class ProtoSimResponse:
|
||||
def __init__(self, return_value: Any, simulation_result: "SimulationResult"):
|
||||
def __init__(self, return_value: Any, simulation_result: SimulationResult):
|
||||
self.return_value = return_value
|
||||
self.simulation_result = simulation_result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user