Skip to content

Commit

Permalink
added current window = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed Apr 8, 2024
1 parent 43df01e commit 322c79f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion contracts/BlockTracker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions test/BidderRegistryTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/OracleTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions test/PreConfirmationConfTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 322c79f

Please sign in to comment.