Commit Graph

1207 Commits

Author SHA1 Message Date
Diana Carvalho
5ddd2a9cd7 fix: Make functions in encoding_utils.rs private
They shouldn't be used outside the crate by the users. They should reimplement this functions themselves.
Move encode_input to utils.rs

Took 8 minutes
2025-05-26 17:16:35 +01:00
Diana Carvalho
4f85e3e88e chore: Move tests from strategy_encoders to tycho_encoders
Most of these tests were actually integration tests, so they should be in the outer level of the package.

Took 1 hour 5 minutes
2025-05-26 17:08:44 +01:00
Diana Carvalho
d12e3d3b5f fix: Bring back swapper_pk for backwards compatibility
Took 16 minutes
2025-05-26 12:50:11 +01:00
Diana Carvalho
f5d9ab03da chore: Improve docstrings
Took 23 minutes
2025-05-26 12:50:11 +01:00
Diana Carvalho
c62af2f232 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
2025-05-26 12:50:11 +01:00
semantic-release-bot
cdb67f742f chore(release): 0.94.0 [skip ci]
## [0.94.0](https://github.com/propeller-heads/tycho-execution/compare/0.93.0...0.94.0) (2025-05-23)

### Features

* Create non alloy specific Permit and PermitDetails structs ([75f2c3a](75f2c3a1c5))
2025-05-23 17:08:45 +00:00
dianacarvalho1
081c705c79 Merge pull request #206 from propeller-heads/audit/dc/encoded-solution-no-alloy-types
feat: Create non alloy specific Permit and PermitDetails structs
2025-05-23 18:07:03 +01:00
Diana Carvalho
75f2c3a1c5 feat: Create non alloy specific Permit and PermitDetails structs
- Add try_from methods to convert them to the corresponding Solidity representations
- Update tests

Took 56 seconds
2025-05-23 11:31:05 +01:00
Diana Carvalho
88ad67e5ff Merge branch 'refs/heads/main' into router/tnl/fix-deployment 2025-05-22 15:35:49 +01:00
semantic-release-bot
52d3641436 chore(release): 0.93.0 [skip ci]
## [0.93.0](https://github.com/propeller-heads/tycho-execution/compare/0.92.1...0.93.0) (2025-05-22)

### Features

* Add encode_full_calldata to TychoEncoder trait ([5aff28e](5aff28e345))
* Add interacting_with to EncodedSolution ([facdf71](facdf716bd))
* Remove slippage and expected_amount from Solution ([08056c4](08056c4a6c))
* Separate encoding swaps from encoding txs ([4e8c6dd](4e8c6ddc8c))
2025-05-22 13:55:23 +00:00
dianacarvalho1
8eef9e1f79 Merge pull request #203 from propeller-heads/audit/dc/ENG-4536-separate-encoding-swaps-and-encoding-function
feat: Separate encoding swaps from encoding txs
2025-05-22 14:53:27 +01:00
Diana Carvalho
5aff28e345 feat: Add encode_full_calldata to TychoEncoder trait
This is so that people can easily use it without downcasting the encoder

Took 32 minutes
2025-05-22 14:43:12 +01:00
Diana Carvalho
facdf716bd feat: Add interacting_with to EncodedSolution
- Remove encode_full_calldata from the TychoEncoder trait
- Make the TychoExecutorEncoder use encode_solutions instead of encode_full_calldata
- Update tycho-encode.rs accordingly

Took 1 hour 3 minutes


Took 12 seconds
2025-05-22 14:43:12 +01:00
Diana Carvalho
08056c4a6c feat: Remove slippage and expected_amount from Solution
The user is responsible for coming up with a sensible value for this themselves

Took 37 minutes
2025-05-22 14:43:12 +01:00
Diana Carvalho
4e8c6ddc8c feat: Separate encoding swaps from encoding txs
This way the user is responsible for encoding the Tycho Router method inputs that are used as guardrails in execution.

Interface changes:
- Create EncodedSolution
- StrategyEncoder
  - don't need to know have permit2 or token_in_already_in_router as attributes anymore
  - encode_strategy returns EncodedSolution now (no method encoding done here now)
- TychoEncoder
  - add encode_solution() method. This is the recommended method for users
  - needs to have permit2, token_in_already_in_router and router_address as attributes
  - permit creation is made in the router now

Also:
- create encoding_utils.rs
- update all tests

Took 2 hours 42 minutes


Took 3 minutes

Took 13 minutes
2025-05-22 14:43:12 +01:00
semantic-release-bot
6a6955d31d chore(release): 0.92.1 [skip ci]
## [0.92.1](https://github.com/propeller-heads/tycho-execution/compare/0.92.0...0.92.1) (2025-05-22)

### Bug Fixes

* Small misc improvements from audit ([1f26fbc](1f26fbce14))
2025-05-22 13:21:45 +00:00
dianacarvalho1
58b7dd7e22 Merge pull request #205 from propeller-heads/audit/dc/misc-improvements
fix: Small misc improvements from audit
2025-05-22 14:19:48 +01:00
Diana Carvalho
1f26fbce14 fix: Small misc improvements from audit
- In RestrictTransferFrom:
  - Compare tokenIn with tokenIn from storage
  - Correct docstrings
  - Recompute storage slots with new names
  - Rename transferFromNeeded to isTransferFromAllowed
  - Don't track amount spent but subtract from amount allowed
- In TychoRouter: Rename transferFromNeeded to isTransferFromAllowed

Took 32 minutes
2025-05-22 10:52:00 +01:00
TAMARA LIPOWSKI
5bf3b5d7ad feat: Update ethereum router + executor addresses
We deployed gas optimizations :)
2025-05-21 12:58:07 -04:00
TAMARA LIPOWSKI
ec702a0c7f chore: Uncomment executor deployment 2025-05-21 12:11:36 -04:00
semantic-release-bot
66ec935d49 chore(release): 0.92.0 [skip ci]
## [0.92.0](https://github.com/propeller-heads/tycho-execution/compare/0.91.0...0.92.0) (2025-05-21)

### Features

* Add transferFromNeeded to non permit2 methods ([cc9e88c](cc9e88cfed))
* Bring back TransferType and simplify encoding logic ([3874892](38748925b3))
* Loosen version constrain on tycho-common ([046775b](046775b7ae))
* perform all transfers in executors ([eeebd51](eeebd51114))
* Sketch for OneTransferFromOnly.sol ([9401ce2](9401ce2620))
* Support new transfer logic in all executors ([27dfde3](27dfde3118))
* Support new transfer logic in encoding ([0f9af65](0f9af65846))

### Bug Fixes

* Fix remaining tests after latest encoding changes ([e0c195f](e0c195f63d))
* Fix tests (not there yet) ([d4244a7](d4244a7089))
* Initial balance for cyclic swaps ([7fd9f61](7fd9f611e5))
* Make all tests pass! ([ee68703](ee687038c5))
2025-05-21 14:59:04 +00:00
dianacarvalho1
3d93cce1e9 Merge pull request #198 from propeller-heads/audit/dc/one-transfer-from-only
feat: Restrict transferFrom
2025-05-21 15:57:16 +01:00
Diana Carvalho
b540f83742 Merge branch 'refs/heads/main' into audit/dc/one-transfer-from-only
# Conflicts:
#	foundry/test/assets/calldata.txt

Took 33 minutes
2025-05-21 09:50:20 +01:00
semantic-release-bot
29374e4420 chore(release): 0.91.0 [skip ci]
## [0.91.0](https://github.com/propeller-heads/tycho-execution/compare/0.90.0...0.91.0) (2025-05-19)

### Features

* **curve:** Get coin indexes from static attributes ([fcaacf2](fcaacf21fb))
2025-05-19 16:00:18 +00:00
dianacarvalho1
c96149d3b9 Merge pull request #202 from propeller-heads/encoding/dc/ENG-4426-improve-curve
feat(curve): Get coin indexes from static attributes
2025-05-19 16:58:12 +01:00
Diana Carvalho
fcaacf21fb feat(curve): Get coin indexes from static attributes
This way we don't need extra RPC calls to get these values

Took 57 minutes
2025-05-19 13:29:18 +01:00
Diana Carvalho
cc9e88cfed feat: Add transferFromNeeded to non permit2 methods
This will block an attempt to transfer from the user when we expect the funds to already be in the router.

chores:
- add docs
- in EncodingContext, rename transfer to transfer_type

Took 58 minutes
2025-05-19 12:02:57 +01:00
TAMARA LIPOWSKI
e0c195f63d fix: Fix remaining tests after latest encoding changes 2025-05-16 14:14:21 -04:00
Diana Carvalho
d4244a7089 fix: Fix tests (not there yet)
Took 58 minutes
2025-05-16 17:57:29 +01:00
TAMARA LIPOWSKI
eeebd51114 feat: perform all transfers in executors
For organization (and thus safety) purposes.

Rename to RestrictTransferFrom.sol so that we can perform multiple transfer froms (upto an allowance) in the case of split swaps (where the split is the first swap).

TODO: Fix tests.
2025-05-16 11:59:54 -04:00
Diana Carvalho
38748925b3 feat: Bring back TransferType and simplify encoding logic
Took 1 hour 53 minutes
2025-05-16 16:59:35 +01:00
TAMARA LIPOWSKI
9b59b8b434 Revert "chore: Remove permit2 from executor constructor..."
This reverts commit b0b98c5e5d.
2025-05-16 11:23:43 -04:00
Diana Carvalho
fcd85c047f chore: Misc improvements:
- Don't use payable(receiver).transfer(amount) and use OpenZeppelin's Address.sendValue instead
- In Univ4Executor send funds to the poolManager and not msg.sender
- In OneTransferFromOnly:
  - rename method name
  - don't pass the sender but hardcode it to caller() (msg.sender)
  - Move marking the transfer as done up (before we actually transfer) to prevent reentrancy attacks

Took 18 minutes
2025-05-16 10:49:49 +01:00
Tamara
99d5df4f77 Merge branch 'main' into audit/dc/one-transfer-from-only 2025-05-15 13:47:42 -04:00
TAMARA LIPOWSKI
ec3d04d565 chore: remove author from docs 2025-05-15 13:44:51 -04:00
TAMARA LIPOWSKI
7c26e56a85 test: Ensure revert when attempting two transferFroms 2025-05-15 13:36:34 -04:00
Diana Carvalho
0b5233ead4 chore: Improve docstrings and decode bools always the same way
Took 26 minutes
2025-05-15 18:01:27 +01:00
TAMARA LIPOWSKI
7fd9f611e5 fix: Initial balance for cyclic swaps
This needs to be calculated before we perform a transferFrom in the router! This worked before since we were doing the transferFroms always from inside the executors.
2025-05-15 13:00:03 -04:00
TAMARA LIPOWSKI
d21ae45a49 chore: remove unnecessary sender encoding in USV3 2025-05-15 12:59:04 -04:00
dianacarvalho1
ae4602f668 Merge pull request #193 from propeller-heads/router/dc/ENG-4454-remove-executor-script
chore: Add script to remove executor addresses from Tycho Router
2025-05-15 16:22:52 +01:00
Diana Carvalho
046775b7ae feat: Loosen version constrain on tycho-common
Took 14 minutes
2025-05-15 16:19:31 +01:00
dianacarvalho1
aec512c386 Merge branch 'main' into router/dc/ENG-4454-remove-executor-script 2025-05-15 16:18:33 +01:00
Diana Carvalho
ccde611d81 Merge branch 'refs/heads/main' into audit/dc/one-transfer-from-only 2025-05-15 15:52:55 +01:00
Diana Carvalho
4b2aa36424 Merge branch 'refs/heads/main' into audit/dc/one-transfer-from-only 2025-05-15 15:52:17 +01:00
semantic-release-bot
7f7084ca7a chore(release): 0.90.0 [skip ci]
## [0.90.0](https://github.com/propeller-heads/tycho-execution/compare/0.89.0...0.90.0) (2025-05-15)

### Features

* Explicitly handle the TransferType.NONE case ([65bd0d0](65bd0d0749))
* Verify the amount out was received correctly for arbitrage swaps ([70230bf](70230bf05f))

### Bug Fixes

* Revert if the TransferType is not valid ([b0c254a](b0c254add4))
2025-05-15 14:51:47 +00:00
dianacarvalho1
584559022b Merge pull request #200 from propeller-heads/ci/dc/fix-lint-ci
ci: fix lint ci
2025-05-15 15:49:02 +01:00
Diana Carvalho
2e71a3e0ff ci: fix lint ci
Took 1 minute
2025-05-15 15:44:41 +01:00
Diana Carvalho
e726571114 ci: Update lint CI
Took 8 minutes


Took 5 seconds

Took 11 seconds

Took 11 seconds
2025-05-15 15:23:24 +01:00
TAMARA LIPOWSKI
69c8325a1d chore: OneTransferFromOnly docs + proper slots
Also revert instead of returning if multiple `transferFrom`s are attempted - as this signals that encoding is incorrect or has been messed with.
2025-05-15 10:08:40 -04:00
Diana Carvalho
6cff470999 Merge branch 'refs/heads/main' into audit/dc/one-transfer-from-only
# Conflicts:
#	foundry/src/executors/TokenTransfer.sol

Took 38 seconds
2025-05-15 14:53:18 +01:00