Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FunctionSignatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@
| `expiryTime` | `0x99bc0aea` |
| `getDigest` | `0xdd4bf97b` |
| `getPrecompileFees` | `0xb7a3d04c` |
| `getPrevBatchDigestHash` | `0x82b35b69` |
| `getPrevBatchDigestHash` | `0x372863a1` |
| `handlePayload` | `0x1d5e1d98` |
| `initialize` | `0xeb990c59` |
| `owner` | `0x8da5cb5b` |
Expand Down
4 changes: 2 additions & 2 deletions contracts/evmx/watcher/RequestHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 9 additions & 3 deletions contracts/evmx/watcher/precompiles/WritePrecompile.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion deployments/dev_addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"Watcher": "0x60005b459Dc46D9a63bcb61D01Ad002130644a4F",
"WatcherImpl": "0x812EcdF5366036B045e41Fe2dD95B72ecc26d8f3",
"WritePrecompile": "0xF221bAA9AEA24c366258309ab09C2C7ce80610Fc",
"WritePrecompileImpl": "0xb64D07B0dDb23cc54eE5EDe294E0cD15f08CC971"
"WritePrecompileImpl": "0x09A1A0A7BB8266171855871c4c0Af200a30922BE"
},
"11155420": {
"ContractFactoryPlug": "0xf134E3a725DdbBebf9e0f66D6767B44468cdBB48",
Expand Down
67 changes: 7 additions & 60 deletions deployments/dev_verification.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"421614": [],
"7625382": [
[
"0x09A1A0A7BB8266171855871c4c0Af200a30922BE",
"WritePrecompile",
"contracts/evmx/watcher/precompiles/WritePrecompile.sol",
[]
],
[
"0xDa60303321dc6aA8AeF32557bDe914008a3196eC",
"SchedulePrecompile",
Expand Down Expand Up @@ -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": []
}
13 changes: 9 additions & 4 deletions hardhat-scripts/deploy/1.deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions test/SetupTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ contract WatcherSetup is AuctionSetup {
switchboard = switchboard_;

bytes32 prevBatchDigestHash = writePrecompile.getPrevBatchDigestHash(
payloadParams.requestCount,
payloadParams.batchCount
);
digestParams = DigestParams(
Expand Down