diff --git a/contracts/protocol/watcherPrecompile/WatcherPrecompileCore.sol b/contracts/protocol/watcherPrecompile/WatcherPrecompileCore.sol index 7950823e..44f583ab 100644 --- a/contracts/protocol/watcherPrecompile/WatcherPrecompileCore.sol +++ b/contracts/protocol/watcherPrecompile/WatcherPrecompileCore.sol @@ -32,7 +32,7 @@ abstract contract WatcherPrecompileCore is // from auction manager watcherPrecompileLimits__.consumeLimit(_getCoreAppGateway(msg.sender), SCHEDULE, 1); uint256 executeAt = block.timestamp + delayInSeconds_; - timeoutId = _encodeId(evmxSlug, address(this)); + timeoutId = _encodeTimeoutId(evmxSlug, address(this)); timeoutRequests[timeoutId] = TimeoutRequest( timeoutId, msg.sender, @@ -192,18 +192,12 @@ abstract contract WatcherPrecompileCore is if (switchboard != switchboard_) revert InvalidSwitchboard(); } - // todo: revisit when we do timeout precompile - function _encodeId( - uint32 chainSlug_, - address switchboardOrWatcher_ - ) internal returns (bytes32) { - // Encode payload ID by bit-shifting and combining: + function _encodeTimeoutId(uint32 chainSlug_, address watcher_) internal returns (bytes32) { + // Encode timeout ID by bit-shifting and combining: // chainSlug (32 bits) | switchboard or watcher precompile address (160 bits) | counter (64 bits) return bytes32( - (uint256(chainSlug_) << 224) | - (uint256(uint160(switchboardOrWatcher_)) << 64) | - payloadCounter++ + (uint256(chainSlug_) << 224) | (uint256(uint160(watcher_)) << 64) | timeoutCounter++ ); } diff --git a/test/DeliveryHelper.t.sol b/test/DeliveryHelper.t.sol index 09ecc39d..ea346775 100644 --- a/test/DeliveryHelper.t.sol +++ b/test/DeliveryHelper.t.sol @@ -279,7 +279,7 @@ contract DeliveryHelperTest is SetupTest { function endAuction(uint40 requestCount_) internal { if (auctionEndDelaySeconds == 0) return; - bytes32 timeoutId = _encodeId(evmxSlug, address(watcherPrecompile), timeoutIdCounter++); + bytes32 timeoutId = _encodeTimeoutId(evmxSlug, address(watcherPrecompile), timeoutIdCounter++); bytes memory watcherSignature = _createWatcherSignature( address(watcherPrecompile), @@ -300,7 +300,7 @@ contract DeliveryHelperTest is SetupTest { } //////////////////////////////////// Utils /////////////////////////////////// - function _encodeId( + function _encodeTimeoutId( uint32 chainSlug_, address sbOrWatcher_, uint256 counter_