feat: update tycho deps and upgrade code
This commit is contained in:
3565
protocol-testing/Cargo.lock
generated
3565
protocol-testing/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -7,11 +7,11 @@ edition = "2021"
|
|||||||
# Logging & Tracing
|
# Logging & Tracing
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
# Tycho dependencies
|
# Tycho dependencies
|
||||||
tycho-common = "0.66.4"
|
tycho-common = "0.83.0"
|
||||||
tycho-client = "0.66.4"
|
tycho-client = "0.83.0"
|
||||||
tycho-simulation = { path = "../../tycho-simulation", features = ["evm"] }
|
tycho-simulation = { path = "../../tycho-simulation", features = ["evm"] }
|
||||||
# EVM dependencies
|
# EVM dependencies
|
||||||
alloy = { version = "0.5.4", features = ["arbitrary", "json", "dyn-abi", "sol-types", "contract", "provider-http"] }
|
alloy = { version = "1.0.27", features = ["arbitrary", "json", "dyn-abi", "sol-types", "contract", "provider-http"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
clap = "4.5.31"
|
clap = "4.5.31"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ impl RPCProvider {
|
|||||||
wallet_address: Address,
|
wallet_address: Address,
|
||||||
block_number: u64,
|
block_number: u64,
|
||||||
) -> U256 {
|
) -> U256 {
|
||||||
let provider = ProviderBuilder::new().on_http(self.url.clone());
|
let provider = ProviderBuilder::new().connect_http(self.url.clone());
|
||||||
let block_id: BlockId = BlockId::from(block_number);
|
let block_id: BlockId = BlockId::from(block_number);
|
||||||
|
|
||||||
match NATIVE_ALIASES.contains(&token_address) {
|
match NATIVE_ALIASES.contains(&token_address) {
|
||||||
@@ -65,13 +65,13 @@ impl RPCProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_block_header(&self, block_number: u64) {
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
|
// async fn get_block_header(&self, _block_number: u64) {
|
||||||
// let provider = ProviderBuilder::new().on_http(self.url);
|
// let provider = ProviderBuilder::new().on_http(self.url);
|
||||||
// let block_id: BlockId = BlockId::from(block_number);
|
// let block_id: BlockId = BlockId::from(block_number);
|
||||||
//
|
//
|
||||||
// let block = provider.get_block(block_id)
|
// let block = provider.get_block(block_id)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::{collections::HashMap, env, path::PathBuf, str::FromStr};
|
use std::{collections::HashMap, env, path::PathBuf, str::FromStr};
|
||||||
|
use alloy::{primitives::U256};
|
||||||
use alloy::{primitives::U256, providers::Provider};
|
|
||||||
use figment::{
|
use figment::{
|
||||||
providers::{Format, Yaml},
|
providers::{Format, Yaml},
|
||||||
Figment,
|
Figment,
|
||||||
@@ -8,9 +7,11 @@ use figment::{
|
|||||||
use postgres::{Client, Error, NoTls};
|
use postgres::{Client, Error, NoTls};
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
use tycho_client::feed::BlockHeader;
|
||||||
use tycho_common::{
|
use tycho_common::{
|
||||||
dto::{Chain, ProtocolComponent, ResponseAccount, ResponseProtocolState},
|
dto::{Chain, ProtocolComponent, ResponseAccount, ResponseProtocolState},
|
||||||
Bytes,
|
Bytes,
|
||||||
|
models::token::Token
|
||||||
};
|
};
|
||||||
use tycho_simulation::{
|
use tycho_simulation::{
|
||||||
evm::{
|
evm::{
|
||||||
@@ -18,12 +19,10 @@ use tycho_simulation::{
|
|||||||
engine_db::tycho_db::PreCachedDB,
|
engine_db::tycho_db::PreCachedDB,
|
||||||
protocol::{u256_num::bytes_to_u256, vm::state::EVMPoolState},
|
protocol::{u256_num::bytes_to_u256, vm::state::EVMPoolState},
|
||||||
},
|
},
|
||||||
models::Token,
|
|
||||||
tycho_client::feed::{
|
tycho_client::feed::{
|
||||||
synchronizer::{ComponentWithState, Snapshot, StateSyncMessage},
|
synchronizer::{ComponentWithState, Snapshot, StateSyncMessage},
|
||||||
FeedMessage, Header,
|
FeedMessage,
|
||||||
},
|
},
|
||||||
utils::load_all_tokens,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -39,7 +38,6 @@ pub struct TestRunner {
|
|||||||
tycho_logs: bool,
|
tycho_logs: bool,
|
||||||
db_url: String,
|
db_url: String,
|
||||||
vm_traces: bool,
|
vm_traces: bool,
|
||||||
|
|
||||||
substreams_path: PathBuf,
|
substreams_path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +282,7 @@ fn validate_state(
|
|||||||
.get(component_id)
|
.get(component_id)
|
||||||
.expect("Failed to get state for component")
|
.expect("Failed to get state for component")
|
||||||
.clone();
|
.clone();
|
||||||
let component_with_state = ComponentWithState { state, component };
|
let component_with_state = ComponentWithState { state, component, component_tvl: None, entrypoints: vec![] }; // TODO
|
||||||
states.insert(component_id.clone(), component_with_state);
|
states.insert(component_id.clone(), component_with_state);
|
||||||
}
|
}
|
||||||
let vm_storage: HashMap<Bytes, ResponseAccount> = vm_storages
|
let vm_storage: HashMap<Bytes, ResponseAccount> = vm_storages
|
||||||
@@ -295,14 +293,15 @@ fn validate_state(
|
|||||||
|
|
||||||
let bytes = [0u8; 32];
|
let bytes = [0u8; 32];
|
||||||
|
|
||||||
let state_msgs: HashMap<String, StateSyncMessage> = HashMap::from([(
|
let state_msgs: HashMap<String, StateSyncMessage<BlockHeader>> = HashMap::from([(
|
||||||
String::from("test_protocol"),
|
String::from("test_protocol"),
|
||||||
StateSyncMessage {
|
StateSyncMessage {
|
||||||
header: Header {
|
header: BlockHeader {
|
||||||
hash: Bytes::from(bytes),
|
hash: Bytes::from(bytes),
|
||||||
number: stop_block,
|
number: stop_block,
|
||||||
parent_hash: Bytes::from(bytes),
|
parent_hash: Bytes::from(bytes),
|
||||||
revert: false,
|
revert: false,
|
||||||
|
timestamp: 0, // TODO
|
||||||
},
|
},
|
||||||
snapshots: snapshot,
|
snapshots: snapshot,
|
||||||
deltas: None,
|
deltas: None,
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
|
use tycho_client::rpc::RPCClient;
|
||||||
use std::{collections::HashMap, error::Error as StdError, fmt};
|
use std::{collections::HashMap, error::Error as StdError, fmt};
|
||||||
|
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
use tycho_client::{rpc::RPCClient, HttpRPCClient};
|
use tycho_client::{HttpRPCClient};
|
||||||
use tycho_common::{
|
use tycho_common::{
|
||||||
dto::{
|
dto::{
|
||||||
Chain, PaginationParams, ProtocolComponent, ProtocolComponentsRequestBody, ResponseAccount,
|
Chain, PaginationParams, ProtocolComponent, ProtocolComponentsRequestBody, ResponseAccount,
|
||||||
ResponseProtocolState, StateRequestBody, VersionParam,
|
ResponseProtocolState, StateRequestBody, VersionParam,
|
||||||
},
|
},
|
||||||
models::Address,
|
|
||||||
Bytes,
|
Bytes,
|
||||||
};
|
};
|
||||||
use tycho_common::dto::ResponseToken;
|
use tycho_common::dto::ResponseToken;
|
||||||
use tycho_simulation::models::Token;
|
use tycho_common::models::token::Token;
|
||||||
|
|
||||||
/// Custom error type for RPC operations
|
/// Custom error type for RPC operations
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl TychoRunner {
|
|||||||
spkg_path: &str,
|
spkg_path: &str,
|
||||||
start_block: u64,
|
start_block: u64,
|
||||||
end_block: u64,
|
end_block: u64,
|
||||||
protocol_type_names: &Vec<String>,
|
protocol_type_names: &[String],
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// Expects a .env present in the same folder as package root (where Cargo.toml is)
|
// Expects a .env present in the same folder as package root (where Cargo.toml is)
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
@@ -160,7 +160,7 @@ impl TychoRunner {
|
|||||||
if let Some(stdout) = child.stdout.take() {
|
if let Some(stdout) = child.stdout.take() {
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let reader = BufReader::new(stdout);
|
let reader = BufReader::new(stdout);
|
||||||
for line in reader.lines().flatten() {
|
for line in reader.lines().map_while(Result::ok) {
|
||||||
println!("{}", line);
|
println!("{}", line);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -169,7 +169,7 @@ impl TychoRunner {
|
|||||||
if let Some(stderr) = child.stderr.take() {
|
if let Some(stderr) = child.stderr.take() {
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let reader = BufReader::new(stderr);
|
let reader = BufReader::new(stderr);
|
||||||
for line in reader.lines().flatten() {
|
for line in reader.lines().map_while(Result::ok) {
|
||||||
eprintln!("{}", line);
|
eprintln!("{}", line);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user