Skip to content

Conversation

@tamaralipows
Copy link
Contributor

@tamaralipows tamaralipows commented Nov 12, 2025

No description provided.

We need this trait to help us find out when our delta transitioning causes our local state to diverge from on-chain.

- I had to downcast in the end, since we didn't want to add the Validator trait to the ProtocolSim trait requirement (we would need to change tycho_common). We can't just change the integration test to require the  Validator trait, since this would require this change in a few other places (such as the Update struct), and it's slightly unintuitive that it would return Validator here instead of ProtocolSim. The simplest, albeit slightly hacky solution is to try to downcast before validating, and return None if we aren't able to downcast to that specific pool state.
since it depends on EVM-specific types and the alloy crate
@tamaralipows tamaralipows force-pushed the testing-sdk/tnl/ENG-5267-add-validators branch from 22fa6f7 to 8978571 Compare November 12, 2025 17:48
Copy link
Collaborator

@dianacarvalho1 dianacarvalho1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tamaralipows ! 🙏🏼 I have some suggestions..

TAMARA LIPOWSKI added 5 commits November 12, 2025 19:00
- Validating one component at a time will be way too slow. We must batch similar to how we do in execution_simulator.rs. The actual processing of the batch results can happen one-component-at-a-time since this is not the slowest part.
- For this, we need `batch_validate_components` and `execute_batched_calls` helper methods. We also still need to downcast in main.rs (looking for another solution)
Similar to how TychoStreamDecoder::register_decoder() associates protocol names with types implementing TryFromWithBlock, get_validator() provides a centralized place to map protocol names to types implementing Validator. While the decoder uses a registry pattern with closures for more flexibility, get_validator() uses a simpler match statement since validation downcasting is more straightforward (doesn't require runtime registration).
TAMARA LIPOWSKI added 2 commits November 13, 2025 21:57
The UniswapV2 reserves are only updated when swapping, so we should be checking the reserves, not the balances
for better readability
@tamaralipows tamaralipows force-pushed the testing-sdk/tnl/ENG-5267-add-validators branch from 469928a to d95fd37 Compare November 14, 2025 02:57
Copy link
Collaborator

@dianacarvalho1 dianacarvalho1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tamaralipows 🙏🏼 This looks good to me! I have only tiny suggestions

}
}
};
components_to_process.push((id.clone(), component, state.clone_box()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put all of this component selecting in one big method? I think it fits nicely together now!

} else {
error!(
component_id = %component_id,
"State validation failed"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we log here the delta message? 🤔

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Tycho Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants