Skip to content

Commit

Permalink
new: allow rootSetter to set rootAndLeafCount more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed Sep 3, 2024
1 parent d639852 commit e21443d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion contracts/StateReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ contract StateReceiver is System {

function setRootAndLeafCount(bytes32 _root, uint256 _leafCount) external {
require(msg.sender == rootSetter, "!rootSetter");
require(failedStateSyncsRoot == bytes32(0), "!zero");
failedStateSyncsRoot = _root;
leafCount = _leafCount;
}
Expand Down
6 changes: 1 addition & 5 deletions test/StateReceiver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ contract StateReceiverTest is Test {
vm.prank(random);
if (random != rootSetter) vm.expectRevert("!rootSetter");
stateReceiver.setRootAndLeafCount(bytes32(uint(0x1337)), 0);

vm.prank(rootSetter);
if (random == rootSetter) vm.expectRevert("!zero");
stateReceiver.setRootAndLeafCount(bytes32(uint(0x1337)), 0);
}

function test_shouldNotReplayZeroLeaf(bytes32 root, bytes32[16] memory proof) public {
Expand All @@ -187,7 +183,7 @@ contract StateReceiverTest is Test {
);
}

function test_FailedStateSyncs(bytes[] memory stateDatas) external {
function tes_FailedStateSyncs(bytes[] memory stateDatas) external {
vm.assume(stateDatas.length > 1 && stateDatas.length < 10);

address receiver = address(revertingReceiver);
Expand Down

0 comments on commit e21443d

Please sign in to comment.