Skip to content

Commit

Permalink
Update RouterTest.t.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jan 30, 2025
1 parent ef8e92c commit e8c97fd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/protocol/test/layer1/preconf/router/RouterTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ contract RouterTest is RouterTestBase {
router.proposePreconfedBlocks("", abi.encode(batchParams), "");
}

function test_proposePreconfedBlocks_InvalidProposerParam() external {
address[] memory operators = new address[](3);
function test_proposePreconfedBlocks_proposerNotSender() external {
address[] memory operators = new address[](1);
operators[0] = Bob;
operators[1] = Carol;
operators[2] = David;
addOperators(operators);

// Setup mock beacon for operator selection
Expand All @@ -124,7 +122,7 @@ contract RouterTest is RouterTestBase {

// Create batch params with DIFFERENT proposer than sender
ITaikoInbox.BatchParams memory params = ITaikoInbox.BatchParams({
proposer: Bob, // Set different proposer than sender (Carol)
proposer: Carol, // Set different proposer than sender (Carol)
coinbase: address(0),
parentMetaHash: bytes32(0),
anchorBlockId: 0,
Expand All @@ -141,13 +139,15 @@ contract RouterTest is RouterTestBase {

// Prank as Carol (selected operator) and propose blocks
vm.prank(Carol);
vm.expectRevert(IPreconfRouter.InvalidParams.selector);
vm.expectRevert(IPreconfRouter.NotTheOperator.selector);
router.proposePreconfedBlocks("", abi.encode(params), "");
}

function test_proposePreconfedBlocks_proposerNotSender() external {
address[] memory operators = new address[](1);
function test_proposePreconfedBlocks_InvalidProposerParam() external {
address[] memory operators = new address[](3);
operators[0] = Bob;
operators[1] = Carol;
operators[2] = David;
addOperators(operators);

// Setup mock beacon for operator selection
Expand All @@ -173,7 +173,7 @@ contract RouterTest is RouterTestBase {

// Create batch params with DIFFERENT proposer than sender
ITaikoInbox.BatchParams memory params = ITaikoInbox.BatchParams({
proposer: Carol, // Set different proposer than sender (Carol)
proposer: Bob, // Set different proposer than sender (Carol)
coinbase: address(0),
parentMetaHash: bytes32(0),
anchorBlockId: 0,
Expand All @@ -190,7 +190,7 @@ contract RouterTest is RouterTestBase {

// Prank as Carol (selected operator) and propose blocks
vm.prank(Carol);
vm.expectRevert(IPreconfRouter.NotTheOperator.selector);
vm.expectRevert(IPreconfRouter.InvalidParams.selector);
router.proposePreconfedBlocks("", abi.encode(params), "");
}
}

0 comments on commit e8c97fd

Please sign in to comment.