Skip to content

Commit

Permalink
fix: contract tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed Apr 30, 2024
1 parent c6e736b commit 26e60cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 10 additions & 5 deletions contracts/test/BidderRegistryTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ contract BidderRegistryTest is Test {
vm.prank(bidder);
bidderRegistry.depositForSpecificWindow{value: 64 ether}(nextWindow);
address provider = vm.addr(4);
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
blockTracker.addBuilderAddress("test", provider);
blockTracker.recordL1Block(blockNumber, "test");

Expand Down Expand Up @@ -175,7 +176,8 @@ contract BidderRegistryTest is Test {
bidderRegistry.depositForSpecificWindow{value: 64 ether}(nextWindow);

address provider = vm.addr(4);
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
blockTracker.addBuilderAddress("test", provider);
blockTracker.recordL1Block(blockNumber, "test");
bytes32 bidID = keccak256("1234");
Expand Down Expand Up @@ -231,7 +233,8 @@ contract BidderRegistryTest is Test {
address provider = vm.addr(4);
uint256 balanceBefore = feeRecipient.balance;
bytes32 bidID = keccak256("1234");
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
blockTracker.addBuilderAddress("test", provider);
blockTracker.recordL1Block(blockNumber, "test");

Expand All @@ -258,7 +261,8 @@ contract BidderRegistryTest is Test {
address provider = vm.addr(4);
uint256 balanceBefore = address(provider).balance;
bytes32 bidID = keccak256("1234");
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
blockTracker.addBuilderAddress("test", provider);
blockTracker.recordL1Block(blockNumber, "test");

Expand Down Expand Up @@ -291,7 +295,8 @@ contract BidderRegistryTest is Test {
bidderRegistry.depositForSpecificWindow{value: 128 ether}(nextWindow);
uint256 balanceBefore = address(bidder).balance;
bytes32 bidID = keccak256("1234");
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
blockTracker.addBuilderAddress("test", provider);
blockTracker.recordL1Block(blockNumber, "test");

Expand Down
9 changes: 6 additions & 3 deletions contracts/test/OracleTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ contract OracleTest is Test {

function test_process_commitment_payment_payout() public {
string memory txn = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08";
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
uint64 bid = 2;
(address bidder, uint256 bidderPk) = makeAddrAndKey("alice");
(address provider, uint256 providerPk) = makeAddrAndKey("kartik");
Expand Down Expand Up @@ -156,7 +157,8 @@ contract OracleTest is Test {
function test_process_commitment_slash_and_reward() public {
string memory txn1 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08";
string memory txn2 = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d09";
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
uint64 bid = 100;
(address bidder, uint256 bidderPk) = makeAddrAndKey("alice");
(address provider, uint256 providerPk) = makeAddrAndKey("kartik");
Expand Down Expand Up @@ -244,7 +246,8 @@ contract OracleTest is Test {
txnHashes[1] = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d09";
txnHashes[2] = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d10";
txnHashes[3] = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d11";
uint64 blockNumber = 66;
uint256 blocksPerWindow = blockTracker.blocksPerWindow();
uint64 blockNumber = uint64(blocksPerWindow + 2);
uint64 bid = 5;
(address bidder, uint256 bidderPk) = makeAddrAndKey("alice");
(address provider, uint256 providerPk) = makeAddrAndKey("kartik");
Expand Down

0 comments on commit 26e60cc

Please sign in to comment.