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).
This commit is contained in:
3
protocol-testing/Cargo.lock
generated
3
protocol-testing/Cargo.lock
generated
@@ -7821,8 +7821,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tycho-simulation"
|
||||
version = "0.156.0"
|
||||
source = "git+https://github.com/propeller-heads/tycho-simulation.git?tag=0.156.0#1983a787440e8ae757626d808a6e619baffc52f2"
|
||||
version = "0.155.2"
|
||||
dependencies = [
|
||||
"alloy",
|
||||
"async-stream",
|
||||
|
||||
@@ -336,11 +336,6 @@ fn validate_state(
|
||||
decoder_context,
|
||||
);
|
||||
|
||||
// NOTE: Once tycho-simulation is updated, you can use the new API like this:
|
||||
// use tycho_simulation::protocol::models::DecoderContext;
|
||||
// let context = DecoderContext::new().vm_adapter_path(adapter_contract_path_str);
|
||||
// decoder.register_decoder_with_context::<EVMPoolState<PreCachedDB>>("test_protocol", context);
|
||||
|
||||
// Mock a stream message, with only a Snapshot and no deltas
|
||||
let mut states: HashMap<String, ComponentWithState> = HashMap::new();
|
||||
for (id, component) in components_by_id {
|
||||
|
||||
Reference in New Issue
Block a user