From d6da242848daae23e3cc9834b497b84f2c51e28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wei=C3=9Fer=20Hase?= Date: Fri, 17 May 2024 16:24:49 +0200 Subject: [PATCH] fix: inverse bool bug in validation --- src/contracts/BaseBCoWPool.sol | 2 +- test/integration/PoolSwap.t.sol | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/contracts/BaseBCoWPool.sol b/src/contracts/BaseBCoWPool.sol index c2648f65..87ae505d 100644 --- a/src/contracts/BaseBCoWPool.sol +++ b/src/contracts/BaseBCoWPool.sol @@ -209,7 +209,7 @@ abstract contract BaseBCoWPool is IERC1271 { (GPv2Order.Data memory order, TradingParams memory tradingParams) = abi.decode(signature, (GPv2Order.Data, TradingParams)); - if (tradingParamsHash[hash(tradingParams)]) { + if (!tradingParamsHash[hash(tradingParams)]) { revert TradingParamsDoNotMatchHash(); } bytes32 orderHash = order.hash(solutionSettlerDomainSeparator); diff --git a/test/integration/PoolSwap.t.sol b/test/integration/PoolSwap.t.sol index 400e7ad2..d9437917 100644 --- a/test/integration/PoolSwap.t.sol +++ b/test/integration/PoolSwap.t.sol @@ -50,6 +50,11 @@ abstract contract PoolSwapIntegrationTest is Test, GasSnapshot { pool.bind(address(tokenB), 1e18, 8e18); // 80% pool.finalize(); + + BaseBCoWPool(address(pool)).enableTrading( + BaseBCoWPool.TradingParams({sellToken: tokenA, buyToken: tokenB, appData: ''}) + ); + vm.stopPrank(); }