From 0836bf7d530f18a6c0f112542bcad16050e88afa Mon Sep 17 00:00:00 2001 From: kayibal Date: Thu, 27 Mar 2025 14:56:37 +0100 Subject: [PATCH 1/8] feat: switch to tycho_commons --- Cargo.lock | 9 +++++---- Cargo.toml | 2 +- examples/encoding-example/main.rs | 2 +- src/bin/tycho-encode.rs | 2 +- src/encoding/evm/approvals/permit2.rs | 4 ++-- src/encoding/evm/encoder_builder.rs | 2 +- src/encoding/evm/strategy_encoder/group_swaps.rs | 4 ++-- src/encoding/evm/strategy_encoder/strategy_encoders.rs | 6 +++--- src/encoding/evm/strategy_encoder/strategy_validators.rs | 4 ++-- src/encoding/evm/swap_encoder/swap_encoder_registry.rs | 2 +- src/encoding/evm/swap_encoder/swap_encoders.rs | 4 ++-- src/encoding/evm/tycho_encoder.rs | 6 +++--- src/encoding/evm/utils.rs | 2 +- src/encoding/models.rs | 2 +- src/encoding/strategy_encoder.rs | 2 +- 15 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1c2b94..9e21f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4316,9 +4316,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "tycho-core" -version = "0.61.1" -source = "git+https://github.com/propeller-heads/tycho-indexer.git?tag=0.61.1#aae2c11bffe9ae5e436adc019b769438fa038272" +name = "tycho-common" +version = "0.63.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c64749b24bdb5de6050c37ea91420a67a5fe606247fdb29f2e812dac30b42e" dependencies = [ "anyhow", "async-trait", @@ -4358,7 +4359,7 @@ dependencies = [ "serde_json", "thiserror 1.0.69", "tokio", - "tycho-core", + "tycho-common", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f0a0725..f55872b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ clap = { version = "4.5.3", features = ["derive"] } alloy = { version = "0.9.2", features = ["providers", "rpc-types-eth", "eip712", "signer-local"], optional = true } alloy-sol-types = { version = "0.8.14", optional = true } alloy-primitives = { version = "0.8.9", optional = true } -tycho-core = { git = "https://github.com/propeller-heads/tycho-indexer.git", package = "tycho-core", tag = "0.61.1" } +tycho-common = "0.63.1" once_cell = "1.20.2" [dev-dependencies] diff --git a/examples/encoding-example/main.rs b/examples/encoding-example/main.rs index 48ee12b..70b46d9 100644 --- a/examples/encoding-example/main.rs +++ b/examples/encoding-example/main.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use num_bigint::BigUint; -use tycho_core::{ +use tycho_common::{ models::{protocol::ProtocolComponent, Chain}, Bytes, }; diff --git a/src/bin/tycho-encode.rs b/src/bin/tycho-encode.rs index 06cbe7b..08d157c 100644 --- a/src/bin/tycho-encode.rs +++ b/src/bin/tycho-encode.rs @@ -1,7 +1,7 @@ use std::io::{self, Read}; use clap::{Parser, Subcommand}; -use tycho_core::models::Chain; +use tycho_common::models::Chain; use tycho_execution::encoding::{ evm::encoder_builder::EVMEncoderBuilder, models::Solution, tycho_encoder::TychoEncoder, }; diff --git a/src/encoding/evm/approvals/permit2.rs b/src/encoding/evm/approvals/permit2.rs index f1a5153..549197e 100644 --- a/src/encoding/evm/approvals/permit2.rs +++ b/src/encoding/evm/approvals/permit2.rs @@ -15,7 +15,7 @@ use tokio::{ runtime::{Handle, Runtime}, task::block_in_place, }; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, @@ -175,7 +175,7 @@ mod tests { use alloy_primitives::Uint; use num_bigint::BigUint; - use tycho_core::models::Chain as TychoCoreChain; + use tycho_common::models::Chain as TychoCoreChain; use super::*; diff --git a/src/encoding/evm/encoder_builder.rs b/src/encoding/evm/encoder_builder.rs index 11a5f2e..7a13804 100644 --- a/src/encoding/evm/encoder_builder.rs +++ b/src/encoding/evm/encoder_builder.rs @@ -1,4 +1,4 @@ -use tycho_core::models::Chain; +use tycho_common::models::Chain; use crate::encoding::{ errors::EncodingError, diff --git a/src/encoding/evm/strategy_encoder/group_swaps.rs b/src/encoding/evm/strategy_encoder/group_swaps.rs index 48cb86b..0e4206c 100644 --- a/src/encoding/evm/strategy_encoder/group_swaps.rs +++ b/src/encoding/evm/strategy_encoder/group_swaps.rs @@ -1,4 +1,4 @@ -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{evm::constants::GROUPABLE_PROTOCOLS, models::Swap}; @@ -74,7 +74,7 @@ mod tests { use std::str::FromStr; use alloy_primitives::hex; - use tycho_core::{models::protocol::ProtocolComponent, Bytes}; + use tycho_common::{models::protocol::ProtocolComponent, Bytes}; use super::*; use crate::encoding::models::Swap; diff --git a/src/encoding/evm/strategy_encoder/strategy_encoders.rs b/src/encoding/evm/strategy_encoder/strategy_encoders.rs index 92d1af8..a306b27 100644 --- a/src/encoding/evm/strategy_encoder/strategy_encoders.rs +++ b/src/encoding/evm/strategy_encoder/strategy_encoders.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, str::FromStr}; use alloy_primitives::{aliases::U24, U256, U8}; use alloy_sol_types::SolValue; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, @@ -80,7 +80,7 @@ pub struct SplitSwapStrategyEncoder { impl SplitSwapStrategyEncoder { pub fn new( - blockchain: tycho_core::models::Chain, + blockchain: tycho_common::models::Chain, swap_encoder_registry: SwapEncoderRegistry, swapper_pk: Option, ) -> Result { @@ -341,7 +341,7 @@ mod tests { use alloy_primitives::hex; use num_bigint::{BigInt, BigUint}; use rstest::rstest; - use tycho_core::{ + use tycho_common::{ models::{protocol::ProtocolComponent, Chain as TychoCoreChain}, Bytes, }; diff --git a/src/encoding/evm/strategy_encoder/strategy_validators.rs b/src/encoding/evm/strategy_encoder/strategy_validators.rs index d4bf22f..e7ae722 100644 --- a/src/encoding/evm/strategy_encoder/strategy_validators.rs +++ b/src/encoding/evm/strategy_encoder/strategy_validators.rs @@ -1,6 +1,6 @@ use std::collections::{HashMap, HashSet, VecDeque}; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, @@ -203,7 +203,7 @@ mod tests { use num_bigint::BigUint; use rstest::rstest; - use tycho_core::{models::protocol::ProtocolComponent, Bytes}; + use tycho_common::{models::protocol::ProtocolComponent, Bytes}; use super::*; use crate::encoding::models::Swap; diff --git a/src/encoding/evm/swap_encoder/swap_encoder_registry.rs b/src/encoding/evm/swap_encoder/swap_encoder_registry.rs index 72ab48a..8a5b9e4 100644 --- a/src/encoding/evm/swap_encoder/swap_encoder_registry.rs +++ b/src/encoding/evm/swap_encoder/swap_encoder_registry.rs @@ -19,7 +19,7 @@ impl SwapEncoderRegistry { /// executors' addresses in the file at the given path. pub fn new( executors_file_path: Option, - blockchain: tycho_core::models::Chain, + blockchain: tycho_common::models::Chain, ) -> Result { let chain = Chain::from(blockchain); let config_str = if let Some(ref path) = executors_file_path { diff --git a/src/encoding/evm/swap_encoder/swap_encoders.rs b/src/encoding/evm/swap_encoder/swap_encoders.rs index 473b250..c732c87 100644 --- a/src/encoding/evm/swap_encoder/swap_encoders.rs +++ b/src/encoding/evm/swap_encoder/swap_encoders.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use alloy_primitives::{Address, Bytes as AlloyBytes}; use alloy_sol_types::SolValue; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, @@ -264,7 +264,7 @@ mod tests { use alloy::hex::encode; use num_bigint::BigInt; - use tycho_core::{models::protocol::ProtocolComponent, Bytes}; + use tycho_common::{models::protocol::ProtocolComponent, Bytes}; use super::*; diff --git a/src/encoding/evm/tycho_encoder.rs b/src/encoding/evm/tycho_encoder.rs index bc8ba14..5f20b2e 100644 --- a/src/encoding/evm/tycho_encoder.rs +++ b/src/encoding/evm/tycho_encoder.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use num_bigint::BigUint; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, @@ -34,7 +34,7 @@ impl Clone for EVMTychoEncoder { impl EVMTychoEncoder { pub fn new( - chain: tycho_core::models::Chain, + chain: tycho_common::models::Chain, strategy_encoder: Box, ) -> Result { let chain: Chain = Chain::from(chain); @@ -177,7 +177,7 @@ impl TychoEncoder for EVMTychoEncoder { mod tests { use std::str::FromStr; - use tycho_core::models::{protocol::ProtocolComponent, Chain as TychoCoreChain}; + use tycho_common::models::{protocol::ProtocolComponent, Chain as TychoCoreChain}; use super::*; use crate::encoding::{ diff --git a/src/encoding/evm/utils.rs b/src/encoding/evm/utils.rs index f284ee4..b8af4f5 100644 --- a/src/encoding/evm/utils.rs +++ b/src/encoding/evm/utils.rs @@ -3,7 +3,7 @@ use std::{cmp::max, sync::Arc}; use alloy_primitives::{aliases::U24, keccak256, Address, FixedBytes, Keccak256, U256, U8}; use num_bigint::BigUint; use tokio::runtime::{Handle, Runtime}; -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{ errors::EncodingError, diff --git a/src/encoding/models.rs b/src/encoding/models.rs index 0abc963..fff40ee 100644 --- a/src/encoding/models.rs +++ b/src/encoding/models.rs @@ -1,7 +1,7 @@ use hex; use num_bigint::BigUint; use serde::{Deserialize, Serialize}; -use tycho_core::{ +use tycho_common::{ models::{protocol::ProtocolComponent, Chain as TychoCoreChain}, Bytes, }; diff --git a/src/encoding/strategy_encoder.rs b/src/encoding/strategy_encoder.rs index b0e42fb..57630a0 100644 --- a/src/encoding/strategy_encoder.rs +++ b/src/encoding/strategy_encoder.rs @@ -1,4 +1,4 @@ -use tycho_core::Bytes; +use tycho_common::Bytes; use crate::encoding::{errors::EncodingError, models::Solution, swap_encoder::SwapEncoder}; From 0ff92c5da27fd0fde687dac949af04eb36136da9 Mon Sep 17 00:00:00 2001 From: kayibal Date: Thu, 27 Mar 2025 14:56:58 +0100 Subject: [PATCH 2/8] ci: Automatically publish to crates.io --- .github/workflows/release.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9e0ce55 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release + +on: + workflow_dispatch: + inputs: { } + release: + types: [ created, prereleased ] + +permissions: + id-token: write + contents: write + +jobs: + publish-crate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Push to crates.io + run: | + cargo publish --locked --verbose --token ${{ secrets.CRATESIO_REGISTRY_TOKEN }} +# we can't use the action because it errors on github dependencies in any workspace crate +# - uses: katyo/publish-crates@v2 +# with: +# path: "./tycho-common" +# registry-token: ${{ secrets.CRATESIO_REGISTRY_TOKEN }} + From 379858bfca27eb5e8180a32351337779e625e0b5 Mon Sep 17 00:00:00 2001 From: kayibal Date: Thu, 27 Mar 2025 15:10:44 +0100 Subject: [PATCH 3/8] fix: Handle unichain chain id --- src/encoding/models.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/encoding/models.rs b/src/encoding/models.rs index fff40ee..af8a780 100644 --- a/src/encoding/models.rs +++ b/src/encoding/models.rs @@ -130,6 +130,7 @@ impl From for Chain { TychoCoreChain::Arbitrum => Chain { id: 42161, name: chain.to_string() }, TychoCoreChain::Starknet => Chain { id: 0, name: chain.to_string() }, TychoCoreChain::Base => Chain { id: 8453, name: chain.to_string() }, + TychoCoreChain::Unichain => Chain { id: 130, name: chain.to_string() }, } } } From b1bc98174c1c67a493f9ab00076af647a7f714a0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 27 Mar 2025 16:02:59 +0000 Subject: [PATCH 4/8] chore(release): 0.68.0 [skip ci] ## [0.68.0](https://github.com/propeller-heads/tycho-execution/compare/0.67.2...0.68.0) (2025-03-27) ### Features * switch to tycho_commons ([0836bf7](https://github.com/propeller-heads/tycho-execution/commit/0836bf7d530f18a6c0f112542bcad16050e88afa)) ### Bug Fixes * Handle unichain chain id ([379858b](https://github.com/propeller-heads/tycho-execution/commit/379858bfca27eb5e8180a32351337779e625e0b5)) --- CHANGELOG.md | 12 ++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8e5c1..a74fa33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [0.68.0](https://github.com/propeller-heads/tycho-execution/compare/0.67.2...0.68.0) (2025-03-27) + + +### Features + +* switch to tycho_commons ([0836bf7](https://github.com/propeller-heads/tycho-execution/commit/0836bf7d530f18a6c0f112542bcad16050e88afa)) + + +### Bug Fixes + +* Handle unichain chain id ([379858b](https://github.com/propeller-heads/tycho-execution/commit/379858bfca27eb5e8180a32351337779e625e0b5)) + ## [0.67.2](https://github.com/propeller-heads/tycho-execution/compare/0.67.1...0.67.2) (2025-03-27) diff --git a/Cargo.lock b/Cargo.lock index 9e21f0f..6b860ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4341,7 +4341,7 @@ dependencies = [ [[package]] name = "tycho-execution" -version = "0.67.2" +version = "0.68.0" dependencies = [ "alloy", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index f55872b..00ae0f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tycho-execution" -version = "0.67.2" +version = "0.68.0" edition = "2021" [[bin]] From 7e7fabf51bff842ab20c2f512e4f3a609a266e79 Mon Sep 17 00:00:00 2001 From: kayibal Date: Thu, 27 Mar 2025 19:19:26 +0100 Subject: [PATCH 5/8] fix: Add crate metadata --- Cargo.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 00ae0f2..c9916bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,14 @@ name = "tycho-execution" version = "0.68.0" edition = "2021" +description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors." +repository = "https://github.com/propeller-heads/tycho-execution" +homepage = "https://www.propellerheads.xyz/tycho" +documentation = "https://docs.propellerheads.xyz/tycho" +keywords = ["propellerheads", "solver", "defi", "dex", "mev"] +license = "MIT" +categories = ["finance", "cryptography::cryptocurrencies"] +readme = "README.md" [[bin]] name = "tycho-encode" From 16ade9d8731de8471081d31bc2022d9e11f6723b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 27 Mar 2025 18:29:21 +0000 Subject: [PATCH 6/8] chore(release): 0.68.1 [skip ci] ## [0.68.1](https://github.com/propeller-heads/tycho-execution/compare/0.68.0...0.68.1) (2025-03-27) ### Bug Fixes * Add crate metadata ([7e7fabf](https://github.com/propeller-heads/tycho-execution/commit/7e7fabf51bff842ab20c2f512e4f3a609a266e79)) --- CHANGELOG.md | 7 +++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a74fa33..0e713ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.68.1](https://github.com/propeller-heads/tycho-execution/compare/0.68.0...0.68.1) (2025-03-27) + + +### Bug Fixes + +* Add crate metadata ([7e7fabf](https://github.com/propeller-heads/tycho-execution/commit/7e7fabf51bff842ab20c2f512e4f3a609a266e79)) + ## [0.68.0](https://github.com/propeller-heads/tycho-execution/compare/0.67.2...0.68.0) (2025-03-27) diff --git a/Cargo.lock b/Cargo.lock index 6b860ed..c9b5f19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4341,7 +4341,7 @@ dependencies = [ [[package]] name = "tycho-execution" -version = "0.68.0" +version = "0.68.1" dependencies = [ "alloy", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index c9916bd..011f77d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tycho-execution" -version = "0.68.0" +version = "0.68.1" edition = "2021" description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors." repository = "https://github.com/propeller-heads/tycho-execution" From a9ddb0e6e9ef546f6e851c3056df5a55ee4dfa76 Mon Sep 17 00:00:00 2001 From: Valentin Khramtsov Date: Fri, 28 Mar 2025 17:20:10 +0300 Subject: [PATCH 7/8] fix: fix for foundry tests external contributors --- .github/workflows/evm-foundry-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/evm-foundry-ci.yml b/.github/workflows/evm-foundry-ci.yml index be7c9b8..8c4a98e 100644 --- a/.github/workflows/evm-foundry-ci.yml +++ b/.github/workflows/evm-foundry-ci.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + pull_request_target: jobs: check: From b401358341e60ab6a2dd8faeb943bf864c5f1cf0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 28 Mar 2025 16:11:08 +0000 Subject: [PATCH 8/8] chore(release): 0.68.2 [skip ci] ## [0.68.2](https://github.com/propeller-heads/tycho-execution/compare/0.68.1...0.68.2) (2025-03-28) ### Bug Fixes * fix for foundry tests external contributors ([a9ddb0e](https://github.com/propeller-heads/tycho-execution/commit/a9ddb0e6e9ef546f6e851c3056df5a55ee4dfa76)) --- CHANGELOG.md | 7 +++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e713ac..0f38b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.68.2](https://github.com/propeller-heads/tycho-execution/compare/0.68.1...0.68.2) (2025-03-28) + + +### Bug Fixes + +* fix for foundry tests external contributors ([a9ddb0e](https://github.com/propeller-heads/tycho-execution/commit/a9ddb0e6e9ef546f6e851c3056df5a55ee4dfa76)) + ## [0.68.1](https://github.com/propeller-heads/tycho-execution/compare/0.68.0...0.68.1) (2025-03-27) diff --git a/Cargo.lock b/Cargo.lock index c9b5f19..54ec35b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4341,7 +4341,7 @@ dependencies = [ [[package]] name = "tycho-execution" -version = "0.68.1" +version = "0.68.2" dependencies = [ "alloy", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 011f77d..00c7abd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tycho-execution" -version = "0.68.1" +version = "0.68.2" edition = "2021" description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors." repository = "https://github.com/propeller-heads/tycho-execution"