Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up signature check for orders with no pre-interactions (#2953)
# Description Speed up signature check for orders with no pre-interactions by directly calling `isValidSignature` instead of our `Signatures` contract. # Changes - In the cases with no pre-interactions, directly call `isValidSignature` - Modify the eht safe e2e tests to use properly a SAFE transaction using the corresponding signature and forcing the new code to be tested/executed ## How to test 1. Acceptance tests # Performance improvement By looking at the [Signatures contract](https://github.com/cowprotocol/services/blob/main/crates/contracts/solidity/Signatures.sol), it is apparent that the speed it is apparent that the improvement won't be significant. We are mostly passing some small checks from the smart contract to Rust code, but the heavy operations are still done in the smart contract. I did some speed tests **locally** (I know the numbers will differ in real production, but I wanted to get some approximation). What I did is to do `Instant::now()` + `now.elapse()` wrapping the critical code, and after many tests, and I got in average these results: - Previous implementation: 2982196 nanoseconds - New implementation: 2388463 nanoseconds There is definitely an improvement. In production the improvement should be greater, because I was using anvil in localhost which reduces the latency significantly. --------- Co-authored-by: Martin Beckmann <martin.beckmann@protonmail.com>
- Loading branch information