From 322c79f30e3eb900eec2aba7b8446b5b50f84c3c Mon Sep 17 00:00:00 2001 From: Mikelle Date: Mon, 8 Apr 2024 23:12:58 +0200 Subject: [PATCH] added current window = 1 --- contracts/BlockTracker.sol | 2 +- test/BidderRegistryTest.sol | 10 +++++----- test/OracleTest.sol | 8 ++++---- test/PreConfirmationConfTest.sol | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contracts/BlockTracker.sol b/contracts/BlockTracker.sol index abad6a3..76228c7 100644 --- a/contracts/BlockTracker.sol +++ b/contracts/BlockTracker.sol @@ -13,7 +13,7 @@ contract BlockTracker is Ownable { /// @dev Event emitted when a new window is created. event NewWindow(uint256 indexed window); - uint256 public currentWindow; + uint256 public currentWindow = 1; uint256 public blocksPerWindow = 64; uint256 public lastL1BlockNumber; address public lastL1BlockWinner; diff --git a/test/BidderRegistryTest.sol b/test/BidderRegistryTest.sol index c05b5a7..dc78dce 100644 --- a/test/BidderRegistryTest.sol +++ b/test/BidderRegistryTest.sol @@ -146,7 +146,7 @@ contract BidderRegistryTest is Test { vm.prank(bidder); bidderRegistry.prepay{value: 64 ether}(); address provider = vm.addr(4); - uint256 blockNumber = 2; + uint256 blockNumber = 66; blockTracker.recordL1Block(blockNumber, provider); bidderRegistry.OpenBid(bidID, 1 ether, bidder); @@ -175,7 +175,7 @@ contract BidderRegistryTest is Test { bidderRegistry.prepay{value: 64 ether}(); address provider = vm.addr(4); - uint256 blockNumber = 2; + uint256 blockNumber = 66; blockTracker.recordL1Block(blockNumber, provider); bytes32 bidID = keccak256("1234"); bidderRegistry.OpenBid(bidID, 1 ether, bidder); @@ -228,7 +228,7 @@ contract BidderRegistryTest is Test { address provider = vm.addr(4); uint256 balanceBefore = feeRecipient.balance; bytes32 bidID = keccak256("1234"); - uint256 blockNumber = 2; + uint256 blockNumber = 66; blockTracker.recordL1Block(blockNumber, provider); bidderRegistry.OpenBid(bidID, 1 ether, bidder); @@ -254,7 +254,7 @@ contract BidderRegistryTest is Test { address provider = vm.addr(4); uint256 balanceBefore = address(provider).balance; bytes32 bidID = keccak256("1234"); - uint256 blockNumber = 2; + uint256 blockNumber = 66; blockTracker.recordL1Block(blockNumber, provider); bidderRegistry.OpenBid(bidID, 2 ether, bidder); @@ -284,7 +284,7 @@ contract BidderRegistryTest is Test { uint256 nextWindow = currentWindow + 1; uint256 balanceBefore = address(bidder).balance; bytes32 bidID = keccak256("1234"); - uint256 blockNumber = 2; + uint256 blockNumber = 66; blockTracker.recordL1Block(blockNumber, provider); bidderRegistry.OpenBid(bidID, 2 ether, bidder); diff --git a/test/OracleTest.sol b/test/OracleTest.sol index e0919da..3461851 100644 --- a/test/OracleTest.sol +++ b/test/OracleTest.sol @@ -162,7 +162,7 @@ contract OracleTest is Test { function test_process_commitment_payment_payout() public { string memory txn = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08"; - uint64 blockNumber = 2; + uint64 blockNumber = 66; uint64 bid = 2; string memory blockBuilderName = "kartik builder"; (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); @@ -224,7 +224,7 @@ contract OracleTest is Test { function test_process_commitment_slash_and_reward() public { string memory txn1 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08"; string memory txn2 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d09"; - uint64 blockNumber = 2; + uint64 blockNumber = 66; uint64 bid = 100; string memory blockBuilderName = "kartik builder"; (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); @@ -313,7 +313,7 @@ contract OracleTest is Test { string memory txn2 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d09"; string memory txn3 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d10"; string memory txn4 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d11"; - uint64 blockNumber = 2; + uint64 blockNumber = 66; uint64 bid = 5; string memory blockBuilderName = "kartik builder"; (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); @@ -361,7 +361,7 @@ contract OracleTest is Test { function test_process_commitment_and_return() public { string memory txn = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08"; - uint64 blockNumber = 2; + uint64 blockNumber = 66; uint64 bid = 2; (address bidder, uint256 bidderPk) = makeAddrAndKey("alice"); (address provider, uint256 providerPk) = makeAddrAndKey("kartik"); diff --git a/test/PreConfirmationConfTest.sol b/test/PreConfirmationConfTest.sol index c544533..ea98b11 100644 --- a/test/PreConfirmationConfTest.sol +++ b/test/PreConfirmationConfTest.sol @@ -640,7 +640,7 @@ contract TestPreConfCommitmentStore is Test { assert(commitmentUsed == false); bytes32 encryptedIndex = storeCommitment( _testCommitmentAliceBob.bid, - _testCommitmentAliceBob.blockNumber, + 66, _testCommitmentAliceBob.txnHash, _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, @@ -652,12 +652,12 @@ contract TestPreConfCommitmentStore is Test { vm.deal(commiter, 5 ether); vm.prank(commiter); providerRegistry.registerAndStake{value: 4 ether}(); - blockTracker.recordL1Block(_testCommitmentAliceBob.blockNumber, commiter); + blockTracker.recordL1Block(66, commiter); bytes32 index = openCommitment( commiter, encryptedIndex, _testCommitmentAliceBob.bid, - _testCommitmentAliceBob.blockNumber, + 66, _testCommitmentAliceBob.txnHash, _testCommitmentAliceBob.decayStartTimestamp, _testCommitmentAliceBob.decayEndTimestamp, @@ -678,8 +678,8 @@ contract TestPreConfCommitmentStore is Test { assert(bidderRegistry.lockedFunds(bidder, window) == 2 ether); assert(bidderRegistry.providerAmount(commiter) == 0 ether); } - } + function _bytesToHexString( bytes memory _bytes ) public pure returns (string memory) {