refactor: Misc improvements to code (#277)
* refactor: Misc improvements to code - Decouple validating logic from TychoRunner - Move all data fetching and decoding the tycho message into the same method - Split validate_state into validate_state, validate_token_balances and simulate_and_execute - Make rpc_provider and runtime attributes of TestRunner - Add references where possible to avoid clones - Remove unnecessary code - Make clippy happy #time 2h 36m #time 0m #time 3m * chore: Use tycho deps and foundry from tycho_simulation This is to try to decrease the risk of using conflicting versions in the different repositories #time 32m #time 0m * chore: Read RPC_URL in main.rs #time 10m * fix: Support eth trades (skip balance and allowance overwrites) and set balance overwrite to amount in For tokens like USDC setting the balance super high was making us getting blacklisted #time 1h 12m * fix: Fix curve tests and filter components_by_id with the expected_component_ids #time 1h 30m #time 0m * fix: Don't use all the possible executor addresses. Hardcode just one for the test Refactor overwrites logic: - renamed functions - moved logic around that fits together - don't use StateOverrides and then convert to alloy overrides. Use alloy's directly #time 1h 21m * fix: Assume that the executors mapping starts at storage value 1 Move setup_router_overwrites away from the rpc and into the execution file Delete unnecessary get_storage_at #time 33m
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
use std::{collections::HashMap, error::Error as StdError, fmt};
|
||||
|
||||
use tracing::debug;
|
||||
use tycho_client::{rpc::RPCClient, HttpRPCClient};
|
||||
use tycho_common::{
|
||||
dto::{
|
||||
Chain, PaginationParams, ProtocolComponent, ProtocolComponentsRequestBody, ResponseAccount,
|
||||
ResponseProtocolState, ResponseToken, StateRequestBody, VersionParam,
|
||||
use tycho_simulation::{
|
||||
tycho_client::{rpc::RPCClient, HttpRPCClient},
|
||||
tycho_common::{
|
||||
dto::{
|
||||
Chain, PaginationParams, ProtocolComponent, ProtocolComponentsRequestBody,
|
||||
ResponseAccount, ResponseProtocolState, ResponseToken, StateRequestBody, VersionParam,
|
||||
},
|
||||
models::token::Token,
|
||||
Bytes,
|
||||
},
|
||||
models::token::Token,
|
||||
Bytes,
|
||||
};
|
||||
|
||||
/// Custom error type for RPC operations
|
||||
@@ -33,8 +35,8 @@ impl From<Box<dyn StdError>> for RpcError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<tycho_client::RPCError> for RpcError {
|
||||
fn from(error: tycho_client::RPCError) -> Self {
|
||||
impl From<tycho_simulation::tycho_client::RPCError> for RpcError {
|
||||
fn from(error: tycho_simulation::tycho_client::RPCError) -> Self {
|
||||
RpcError::ClientError(error.to_string())
|
||||
}
|
||||
}
|
||||
@@ -79,7 +81,7 @@ impl TychoClient {
|
||||
) -> Result<Vec<ResponseProtocolState>, RpcError> {
|
||||
let chunk_size = 100;
|
||||
let concurrency = 1;
|
||||
let version: tycho_common::dto::VersionParam = VersionParam::default();
|
||||
let version: tycho_simulation::tycho_common::dto::VersionParam = VersionParam::default();
|
||||
|
||||
let protocol_states = self
|
||||
.http_client
|
||||
|
||||
Reference in New Issue
Block a user