diff --git a/FunctionSignatures.md b/FunctionSignatures.md index 126336f5..d2412f5f 100644 --- a/FunctionSignatures.md +++ b/FunctionSignatures.md @@ -537,7 +537,7 @@ | `expiryTime` | `0x99bc0aea` | | `getDigest` | `0xdd4bf97b` | | `getPrecompileFees` | `0xb7a3d04c` | -| `getPrevBatchDigestHash` | `0x82b35b69` | +| `getPrevBatchDigestHash` | `0x372863a1` | | `handlePayload` | `0x1d5e1d98` | | `initialize` | `0xeb990c59` | | `owner` | `0x8da5cb5b` | diff --git a/contracts/evmx/watcher/RequestHandler.sol b/contracts/evmx/watcher/RequestHandler.sol index 8b0e2686..bd3889b0 100644 --- a/contracts/evmx/watcher/RequestHandler.sol +++ b/contracts/evmx/watcher/RequestHandler.sol @@ -103,8 +103,8 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres return precompiles[callType_].getPrecompileFees(precompileData_); } - function getRequestBatchIds(uint40 batchCount_) external view returns (uint40[] memory) { - return _requestBatchIds[batchCount_]; + function getRequestBatchIds(uint40 requestCount_) external view returns (uint40[] memory) { + return _requestBatchIds[requestCount_]; } function getBatchPayloadIds(uint40 batchCount_) external view returns (bytes32[] memory) { diff --git a/contracts/evmx/watcher/precompiles/WritePrecompile.sol b/contracts/evmx/watcher/precompiles/WritePrecompile.sol index a5ad893b..a36eaf4e 100644 --- a/contracts/evmx/watcher/precompiles/WritePrecompile.sol +++ b/contracts/evmx/watcher/precompiles/WritePrecompile.sol @@ -170,7 +170,10 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc deadline = block.timestamp + expiryTime; fees = getPrecompileFees(payloadParams.precompileData); - bytes32 prevBatchDigestHash = getPrevBatchDigestHash(payloadParams.batchCount); + bytes32 prevBatchDigestHash = getPrevBatchDigestHash( + payloadParams.requestCount, + payloadParams.batchCount + ); // create digest DigestParams memory digestParams_ = DigestParams( @@ -201,11 +204,14 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc ); } - function getPrevBatchDigestHash(uint40 batchCount_) public view returns (bytes32) { + function getPrevBatchDigestHash( + uint40 requestCount_, + uint40 batchCount_ + ) public view returns (bytes32) { if (batchCount_ == 0) return bytes32(0); // if first batch, return bytes32(0) - uint40[] memory requestBatchIds = requestHandler__().getRequestBatchIds(batchCount_); + uint40[] memory requestBatchIds = requestHandler__().getRequestBatchIds(requestCount_); if (requestBatchIds[0] == batchCount_) return bytes32(0); uint40 prevBatchCount = batchCount_ - 1; diff --git a/deployments/dev_addresses.json b/deployments/dev_addresses.json index 22993cb6..80c0774b 100644 --- a/deployments/dev_addresses.json +++ b/deployments/dev_addresses.json @@ -32,7 +32,7 @@ "Watcher": "0x60005b459Dc46D9a63bcb61D01Ad002130644a4F", "WatcherImpl": "0x812EcdF5366036B045e41Fe2dD95B72ecc26d8f3", "WritePrecompile": "0xF221bAA9AEA24c366258309ab09C2C7ce80610Fc", - "WritePrecompileImpl": "0xb64D07B0dDb23cc54eE5EDe294E0cD15f08CC971" + "WritePrecompileImpl": "0x09A1A0A7BB8266171855871c4c0Af200a30922BE" }, "11155420": { "ContractFactoryPlug": "0xf134E3a725DdbBebf9e0f66D6767B44468cdBB48", diff --git a/deployments/dev_verification.json b/deployments/dev_verification.json index 2e26ac90..b1a2b712 100644 --- a/deployments/dev_verification.json +++ b/deployments/dev_verification.json @@ -1,6 +1,12 @@ { "421614": [], "7625382": [ + [ + "0x09A1A0A7BB8266171855871c4c0Af200a30922BE", + "WritePrecompile", + "contracts/evmx/watcher/precompiles/WritePrecompile.sol", + [] + ], [ "0xDa60303321dc6aA8AeF32557bDe914008a3196eC", "SchedulePrecompile", @@ -105,64 +111,5 @@ [] ] ], - "11155420": [ - [ - "0xf134E3a725DdbBebf9e0f66D6767B44468cdBB48", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x64b7157Fe0878880b180d9BD2a0bd0D1794Cf44A", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x15dbE4B96306Cc9Eba15D834d6c1a895cF4e1697", - "TestUSDC", - "contracts/evmx/mocks/TestUSDC.sol", - [ - "testUSDC", - "testUSDC", - 6, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - { - "type": "BigNumber", - "hex": "0x0b7abc627050305adf14a3d9e40000000000" - } - ] - ], - [ - "0xa2E9eC2B0e035650744B6F489e8dDd471B502b2b", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 11155420, - "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xc6Fe653dAfeDd76d50e3F971dDA650917824f948", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267" - ] - ], - [ - "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267", - "Socket", - "contracts/protocol/Socket.sol", - [11155420, "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", "EVMX"] - ] - ] + "11155420": [] } diff --git a/hardhat-scripts/deploy/1.deploy.ts b/hardhat-scripts/deploy/1.deploy.ts index effbbcad..1ba63595 100644 --- a/hardhat-scripts/deploy/1.deploy.ts +++ b/hardhat-scripts/deploy/1.deploy.ts @@ -387,19 +387,24 @@ const deployContractWithProxy = async ( ); const newImplementation = implementation.address; - console.log("Current implementation:", currentImplAddress); - console.log("New implementation:", newImplementation); + console.log( + "Current implementation for", + contractName, + ":", + currentImplAddress + ); + console.log("New implementation for", contractName, ":", newImplementation); if (currentImplAddress.toLowerCase() === newImplementation.toLowerCase()) return deployUtils; - console.log("Upgrading contract"); + console.log("Upgrading contract: ", contractName); const tx = await proxyFactory .connect(deployUtils.signer) .upgrade(deployUtils.addresses[contractName], newImplementation); - console.log("Upgraded contract", tx.hash); + console.log("Upgraded contract", contractName, tx.hash); await tx.wait(); diff --git a/test/SetupTest.t.sol b/test/SetupTest.t.sol index f511ba68..0128cd53 100644 --- a/test/SetupTest.t.sol +++ b/test/SetupTest.t.sol @@ -838,6 +838,7 @@ contract WatcherSetup is AuctionSetup { switchboard = switchboard_; bytes32 prevBatchDigestHash = writePrecompile.getPrevBatchDigestHash( + payloadParams.requestCount, payloadParams.batchCount ); digestParams = DigestParams(