feat: Don't sign permit2 objects

We don't want to be responsible for holding private keys -> the user is the one that should do this outside of tycho-execution

Done:
- Remove signature from EncodedSolution
- Introduce UserTransferType and pass that everywhere instead of is_permit2_active and token_in_already_in_router
- Remove signing from permit2. Added it to the encoding_utils.rs only
- Mark encode_full_calldata as deprecated
- Backwards compatibility: still accept a signer for the encode_full_calldata case
- Update all tests

Took 2 hours 10 minutes


Took 13 minutes
This commit is contained in:
Diana Carvalho
2025-05-23 18:22:19 +01:00
parent cdb67f742f
commit c62af2f232
11 changed files with 512 additions and 352 deletions

View File

@@ -7,20 +7,17 @@ use tycho_common::{
};
use tycho_execution::encoding::{
evm::encoder_builders::TychoRouterEncoderBuilder,
models::{Solution, Swap},
models::{Solution, Swap, UserTransferType},
};
fn main() {
// Setup variables
let swapper_pk =
"0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234".to_string();
let user_address = Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2")
.expect("Failed to create user address");
// Initialize the encoder
let encoder = TychoRouterEncoderBuilder::new()
.chain(Chain::Ethereum)
.swapper_pk(swapper_pk)
.user_transfer_type(UserTransferType::TransferFrom)
.build()
.expect("Failed to build encoder");