diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 9955ac9..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Smart Contracts Actions - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -jobs: - check: - name: Foundry Checks and Reports - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - - - name: Run tests - run: forge test -vvv --via-ir - - - name: Run snapshot - run: forge snapshot --via-ir - - - name: Run coverage - run: forge coverage --ir-minimum - - build: - name: Hardhat Checks and Scripts - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: "npm" - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - - # Install Hardhat globally - - run: npm install -g hardhat - - # Install project dependencies - - run: npm install - - # Build the project, if applicable - - run: npm run build --if-present diff --git a/.github/workflows/staticdocs.yml b/.github/workflows/staticdocs.yml deleted file mode 100644 index 607ca5b..0000000 --- a/.github/workflows/staticdocs.yml +++ /dev/null @@ -1,51 +0,0 @@ -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Jekyll with GitHub Pages dependencies preinstalled - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./docs - destination: ./docs - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 2c9179b..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/openzeppelin-contracts"] - path = lib/openzeppelin-contracts - url = https://github.com/openzeppelin/openzeppelin-contracts diff --git a/contracts/PreConfirmations.sol b/contracts/PreConfirmations.sol index 2b655c4..58152f1 100644 --- a/contracts/PreConfirmations.sol +++ b/contracts/PreConfirmations.sol @@ -27,6 +27,8 @@ contract PreConfCommitmentStore is Ownable { bytes32 public constant EIP712_BID_TYPEHASH = keccak256("PreConfBid(string txnHash,uint64 bid,uint64 blockNumber,uint64 decayStartTimeStamp,uint64 decayEndTimeStamp)"); + uint64 public COMMITMENT_DISPATCH_WINDOW; + /// @dev commitment counter uint256 public commitmentCount; @@ -75,7 +77,7 @@ contract PreConfCommitmentStore is Ownable { bytes32 commitmentHash; bytes bidSignature; bytes commitmentSignature; - uint256 blockCommitedAt; + uint64 dispatchTimestamp; } /// @dev Event to log successful verifications @@ -119,7 +121,8 @@ contract PreConfCommitmentStore is Ownable { address _providerRegistry, address _bidderRegistry, address _oracle, - address _owner + address _owner, + uint64 _commitment_dispatch_window ) { oracle = _oracle; providerRegistry = IProviderRegistry(_providerRegistry); @@ -142,6 +145,15 @@ contract PreConfCommitmentStore is Ownable { keccak256("1") ) ); + COMMITMENT_DISPATCH_WINDOW = _commitment_dispatch_window; + } + + /** + * @dev Updates the commitment dispatch window to a new value. This function can only be called by the contract owner. + * @param newDispatchWindow The new dispatch window value to be set. + */ + function updateCommitmentDispatchWindow(uint64 newDispatchWindow) external onlyOwner { + COMMITMENT_DISPATCH_WINDOW = newDispatchWindow; } /** @@ -289,6 +301,8 @@ contract PreConfCommitmentStore is Ownable { ); } + + /** * @dev Store a commitment. * @param bid The bid amount. @@ -296,6 +310,7 @@ contract PreConfCommitmentStore is Ownable { * @param txnHash The transaction hash. * @param bidSignature The signature of the bid. * @param commitmentSignature The signature of the commitment. + * @param dispatchTimestamp The timestamp at which the commitment is dispatched * @return commitmentIndex The index of the stored commitment */ function storeCommitment( @@ -305,7 +320,8 @@ contract PreConfCommitmentStore is Ownable { uint64 decayStartTimeStamp, uint64 decayEndTimeStamp, bytes calldata bidSignature, - bytes memory commitmentSignature + bytes memory commitmentSignature, + uint64 dispatchTimestamp ) public returns (bytes32 commitmentIndex) { (bytes32 bHash, address bidderAddress, uint256 stake) = verifyBid( bid, @@ -315,6 +331,10 @@ contract PreConfCommitmentStore is Ownable { txnHash, bidSignature ); + + require(block.timestamp >= dispatchTimestamp, "Invalid dispatch timestamp, block.timestamp < dispatchTimestamp"); + require(block.timestamp - dispatchTimestamp < COMMITMENT_DISPATCH_WINDOW, "Invalid dispatch timestamp, block.timestamp - dispatchTimestamp < COMMITMENT_DISPATCH_WINDOW"); + // This helps in avoiding stack too deep { bytes32 commitmentDigest = getPreConfHash( @@ -345,7 +365,7 @@ contract PreConfCommitmentStore is Ownable { commitmentDigest, bidSignature, commitmentSignature, - block.number + dispatchTimestamp ); commitmentIndex = getCommitmentIndex(newCommitment); diff --git a/contracts/interfaces/IPreConfirmations.sol b/contracts/interfaces/IPreConfirmations.sol index ec5448e..1c6e188 100644 --- a/contracts/interfaces/IPreConfirmations.sol +++ b/contracts/interfaces/IPreConfirmations.sol @@ -22,7 +22,7 @@ interface IPreConfCommitmentStore { bytes32 commitmentHash; bytes bidSignature; bytes commitmentSignature; - uint256 blockCommitedAt; + uint64 dispatchTimestamp; } @@ -65,13 +65,16 @@ interface IPreConfCommitmentStore { uint64 bid, uint64 blockNumber, string memory txnHash, - string memory commitmentHash, + uint64 decayStartTimeStamp, + uint64 decayEndTimeStamp, bytes calldata bidSignature, - bytes memory commitmentSignature - ) external returns (uint256); + bytes memory commitmentSignature, + uint64 dispatchTimestamp + ) external returns (bytes32 commitmentIndex); function getCommitmentsByBlockNumber(uint256 blockNumber) external view returns (bytes32[] memory); + function updateCommitmentDispatchWindow(uint64 newDispatchWindow) external; function getCommitment(bytes32 commitmentIndex) external view returns (PreConfCommitment memory); diff --git a/scripts/DeployScripts.s.sol b/scripts/DeployScripts.s.sol index 5a0e08c..e1bb18c 100644 --- a/scripts/DeployScripts.s.sol +++ b/scripts/DeployScripts.s.sol @@ -44,6 +44,7 @@ contract DeployScript is Script, Create2Deployer { address feeRecipient = address(0x68bC10674b265f266b4b1F079Fa06eF4045c3ab9); uint16 feePercent = 2; uint256 nextRequestedBlockNumber = 4958905; + uint64 commitmentDispatchWindow = 250; // Forge deploy with salt uses create2 proxy from https://github.com/primevprotocol/deterministic-deployment-proxy bytes32 salt = 0x8989000000000000000000000000000000000000000000000000000000000000; @@ -54,7 +55,7 @@ contract DeployScript is Script, Create2Deployer { ProviderRegistry providerRegistry = new ProviderRegistry{salt: salt}(minStake, feeRecipient, feePercent, msg.sender); console.log("ProviderRegistry deployed to:", address(providerRegistry)); - PreConfCommitmentStore preConfCommitmentStore = new PreConfCommitmentStore{salt: salt}(address(providerRegistry), address(bidderRegistry), feeRecipient, msg.sender); + PreConfCommitmentStore preConfCommitmentStore = new PreConfCommitmentStore{salt: salt}(address(providerRegistry), address(bidderRegistry), feeRecipient, msg.sender, commitmentDispatchWindow); console.log("PreConfCommitmentStore deployed to:", address(preConfCommitmentStore)); providerRegistry.setPreconfirmationsContract(address(preConfCommitmentStore)); diff --git a/test/OracleTest.sol b/test/OracleTest.sol index d64b92a..1c29cbc 100644 --- a/test/OracleTest.sol +++ b/test/OracleTest.sol @@ -32,6 +32,7 @@ contract OracleTest is Test { bytes32 commitmentDigest; bytes bidSignature; bytes commitmentSignature; + uint64 dispatchTimestamp; } // Events to match against @@ -53,7 +54,8 @@ contract OracleTest is Test { 0xa0327970258c49b922969af74d60299a648c50f69a2d98d6ab43f32f64ac2100, 0x54c118e537dd7cf63b5388a5fc8322f0286a978265d0338b108a8ca9d155dccc, hex"876c1216c232828be9fabb14981c8788cebdf6ed66e563c4a2ccc82a577d052543207aeeb158a32d8977736797ae250c63ef69a82cd85b727da21e20d030fb311b", - hex"ec0f11f77a9e96bb9c2345f031a5d12dca8d01de8a2e957cf635be14802f9ad01c6183688f0c2672639e90cc2dce0662d9bea3337306ca7d4b56dd80326aaa231b" + hex"ec0f11f77a9e96bb9c2345f031a5d12dca8d01de8a2e957cf635be14802f9ad01c6183688f0c2672639e90cc2dce0662d9bea3337306ca7d4b56dd80326aaa231b", + 1000 ); feePercent = 10; @@ -71,7 +73,8 @@ contract OracleTest is Test { address(providerRegistry), // Provider Registry address(bidderRegistry), // User Registry feeRecipient, // Oracle - address(this) // Owner + address(this), + 500 ); address ownerInstance = 0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3; @@ -86,6 +89,7 @@ contract OracleTest is Test { preConfCommitmentStore.updateOracle(address(oracle)); bidderRegistry.setPreconfirmationsContract(address(preConfCommitmentStore)); providerRegistry.setPreconfirmationsContract(address(preConfCommitmentStore)); + vm.warp(1010); } @@ -142,7 +146,8 @@ contract OracleTest is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, bidderPk, - providerPk + providerPk, + _testCommitmentAliceBob.dispatchTimestamp ); string[] memory txnList = new string[](1); @@ -172,7 +177,7 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk); + bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk, 1000); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); oracle.addBuilderAddress(blockBuilderName, provider); @@ -202,7 +207,7 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk); + bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk, 1000); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); oracle.addBuilderAddress(blockBuilderName, provider); @@ -236,8 +241,8 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk); - bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk); + bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk,1000); + bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk,1000); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); oracle.addBuilderAddress(blockBuilderName, provider); @@ -276,10 +281,10 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk); - bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk); - bytes32 index3 = constructAndStoreCommitment(bid, blockNumber, txn3, 10, 20, bidderPk, providerPk); - bytes32 index4 = constructAndStoreCommitment(bid, blockNumber, txn4, 10, 20, bidderPk, providerPk); + bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk,1000); + bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk,1000); + bytes32 index3 = constructAndStoreCommitment(bid, blockNumber, txn3, 10, 20, bidderPk, providerPk,1000); + bytes32 index4 = constructAndStoreCommitment(bid, blockNumber, txn4, 10, 20, bidderPk, providerPk,1000); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); @@ -323,13 +328,13 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk); + bytes32 index1 = constructAndStoreCommitment(bid, blockNumber, txn1, 10, 20, bidderPk, providerPk ,1000); assertEq(bidderRegistry.bidderPrepaidBalances(bidder), 250 ether - bid); - bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk); + bytes32 index2 = constructAndStoreCommitment(bid, blockNumber, txn2, 10, 20, bidderPk, providerPk ,1000); assertEq(bidderRegistry.bidderPrepaidBalances(bidder), 250 ether - 2*bid); - bytes32 index3 = constructAndStoreCommitment(bid, blockNumber, txn3, 10, 20, bidderPk, providerPk); + bytes32 index3 = constructAndStoreCommitment(bid, blockNumber, txn3, 10, 20, bidderPk, providerPk, 1000); assertEq(bidderRegistry.bidderPrepaidBalances(bidder), 250 ether - 3*bid); - bytes32 index4 = constructAndStoreCommitment(bid, blockNumber, txn4, 10, 20, bidderPk, providerPk); + bytes32 index4 = constructAndStoreCommitment(bid, blockNumber, txn4, 10, 20, bidderPk, providerPk, 1000); assertEq(bidderRegistry.bidderPrepaidBalances(bidder), 250 ether - 4*bid); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); @@ -370,7 +375,7 @@ contract OracleTest is Test { providerRegistry.registerAndStake{value: 250 ether}(); vm.stopPrank(); - bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk); + bytes32 index = constructAndStoreCommitment(bid, blockNumber, txn, 10, 20, bidderPk, providerPk, 1000); PreConfCommitmentStore.PreConfCommitment memory commitment = preConfCommitmentStore.getCommitment(index); vm.startPrank(address(0x6d503Fd50142C7C469C7c6B64794B55bfa6883f3)); @@ -397,7 +402,8 @@ contract OracleTest is Test { uint64 decayStartTimestamp, uint64 decayEndTimestamp, uint256 bidderPk, - uint256 signerPk + uint256 signerPk, + uint64 dispatchTimestamp ) public returns (bytes32 commitmentIndex) { bytes32 bidHash = preConfCommitmentStore.getBidHash( txnHash, @@ -431,7 +437,8 @@ contract OracleTest is Test { decayStartTimestamp, decayEndTimestamp, bidSignature, - commitmentSignature + commitmentSignature, + dispatchTimestamp ); return commitmentIndex; diff --git a/test/PreConfirmationConfTest.sol b/test/PreConfirmationConfTest.sol index 34ffc8e..0f1fea7 100644 --- a/test/PreConfirmationConfTest.sol +++ b/test/PreConfirmationConfTest.sol @@ -20,6 +20,7 @@ contract TestPreConfCommitmentStore is Test { bytes32 commitmentDigest; bytes bidSignature; bytes commitmentSignature; + uint64 dispatchTimestamp; } TestCommitment internal _testCommitmentAliceBob; @@ -42,7 +43,8 @@ contract TestPreConfCommitmentStore is Test { 0xa0327970258c49b922969af74d60299a648c50f69a2d98d6ab43f32f64ac2100, 0x54c118e537dd7cf63b5388a5fc8322f0286a978265d0338b108a8ca9d155dccc, hex"876c1216c232828be9fabb14981c8788cebdf6ed66e563c4a2ccc82a577d052543207aeeb158a32d8977736797ae250c63ef69a82cd85b727da21e20d030fb311b", - hex"ec0f11f77a9e96bb9c2345f031a5d12dca8d01de8a2e957cf635be14802f9ad01c6183688f0c2672639e90cc2dce0662d9bea3337306ca7d4b56dd80326aaa231b" + hex"ec0f11f77a9e96bb9c2345f031a5d12dca8d01de8a2e957cf635be14802f9ad01c6183688f0c2672639e90cc2dce0662d9bea3337306ca7d4b56dd80326aaa231b", + 1000 ); feePercent = 10; @@ -61,10 +63,14 @@ contract TestPreConfCommitmentStore is Test { address(providerRegistry), // Provider Registry address(bidderRegistry), // User Registry feeRecipient, // Oracle - address(this) // Owner + address(this), + 500 ); bidderRegistry.setPreconfirmationsContract(address(preConfCommitmentStore)); + + // Sets fake block timestamp + vm.warp(1000); } function test_Initialize() public { @@ -115,7 +121,98 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, signature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp + ); + } + + + function test_StoreCommitmentFailureDueToTimestampValidation() public { + bytes32 bidHash = preConfCommitmentStore.getBidHash( + _testCommitmentAliceBob.txnHash, + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp + ); + (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); + // Wallet memory kartik = vm.createWallet('test wallet'); + (uint8 v,bytes32 r, bytes32 s) = vm.sign(bidderPk, bidHash); + bytes memory signature = abi.encodePacked(r, s, v); + + vm.deal(bidder, 200000 ether); + vm.prank(bidder); + bidderRegistry.prepay{value: 1e18 wei}(); + + (bytes32 digest, address recoveredAddress, uint256 stake) = preConfCommitmentStore.verifyBid( + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp, + _testCommitmentAliceBob.txnHash, + signature); + + assertEq(stake, 1e18 wei); + assertEq(bidder, recoveredAddress); + assertEq(digest, bidHash); + + vm.expectRevert("Invalid dispatch timestamp, block.timestamp - dispatchTimestamp < COMMITMENT_DISPATCH_WINDOW"); + preConfCommitmentStore.storeCommitment( + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.txnHash, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp, + signature, + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp - 500 + ); + + } + + + function test_StoreCommitmentFailureDueToTimestampValidationWithNewWindow() public { + bytes32 bidHash = preConfCommitmentStore.getBidHash( + _testCommitmentAliceBob.txnHash, + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp + ); + (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); + // Wallet memory kartik = vm.createWallet('test wallet'); + (uint8 v,bytes32 r, bytes32 s) = vm.sign(bidderPk, bidHash); + bytes memory signature = abi.encodePacked(r, s, v); + + vm.deal(bidder, 200000 ether); + vm.prank(bidder); + bidderRegistry.prepay{value: 1e18 wei}(); + + (bytes32 digest, address recoveredAddress, uint256 stake) = preConfCommitmentStore.verifyBid( + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp, + _testCommitmentAliceBob.txnHash, + signature); + + assertEq(stake, 1e18 wei); + assertEq(bidder, recoveredAddress); + assertEq(digest, bidHash); + + vm.prank(preConfCommitmentStore.owner()); + preConfCommitmentStore.updateCommitmentDispatchWindow(200); + + vm.expectRevert("Invalid dispatch timestamp, block.timestamp - dispatchTimestamp < COMMITMENT_DISPATCH_WINDOW"); + preConfCommitmentStore.storeCommitment( + _testCommitmentAliceBob.bid, + _testCommitmentAliceBob.blockNumber, + _testCommitmentAliceBob.txnHash, + _testCommitmentAliceBob.decayStartTimestamp, + _testCommitmentAliceBob.decayEndTimestamp, + signature, + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp - 200 ); } @@ -219,7 +316,8 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, _testCommitmentAliceBob.bidSignature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp ); // Step 3: Verify the stored commitment @@ -277,7 +375,8 @@ contract TestPreConfCommitmentStore is Test { uint64 decayStartTimestamp, uint64 decayEndTimestamp, bytes memory bidSignature, - bytes memory commitmentSignature + bytes memory commitmentSignature, + uint64 dispatchTimestamp ) internal returns (bytes32) { bytes32 commitmentIndex = preConfCommitmentStore.storeCommitment( bid, @@ -286,7 +385,8 @@ contract TestPreConfCommitmentStore is Test { decayStartTimestamp, decayEndTimestamp, bidSignature, - commitmentSignature + commitmentSignature, + dispatchTimestamp ); return commitmentIndex; @@ -372,7 +472,8 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, _testCommitmentAliceBob.bidSignature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp ); PreConfCommitmentStore.PreConfCommitment memory storedCommitment = preConfCommitmentStore.getCommitment( @@ -427,7 +528,8 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, _testCommitmentAliceBob.bidSignature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp ); providerRegistry.setPreconfirmationsContract( address(preConfCommitmentStore) @@ -485,7 +587,8 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, _testCommitmentAliceBob.bidSignature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp ); (address commiter, ) = makeAddrAndKey("bob"); vm.deal(commiter, 5 ether); @@ -541,7 +644,8 @@ contract TestPreConfCommitmentStore is Test { _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, _testCommitmentAliceBob.bidSignature, - _testCommitmentAliceBob.commitmentSignature + _testCommitmentAliceBob.commitmentSignature, + _testCommitmentAliceBob.dispatchTimestamp ); (address commiter, ) = makeAddrAndKey("bob"); vm.deal(commiter, 5 ether); @@ -573,3 +677,6 @@ contract TestPreConfCommitmentStore is Test { return string(_string); } } + + + diff --git a/test/ProviderRegistryTest.sol b/test/ProviderRegistryTest.sol index b3da8d3..8be9fa6 100644 --- a/test/ProviderRegistryTest.sol +++ b/test/ProviderRegistryTest.sol @@ -37,7 +37,8 @@ contract ProviderRegistryTest is Test { address(providerRegistry), // Provider Registry address(bidderRegistry), // User Registry feeRecipient, // Oracle - address(this) // Owner + address(this), + 500 ); provider = vm.addr(1);