From c3060d5e040b51af163afaa88e18c7dbb3daf4c5 Mon Sep 17 00:00:00 2001 From: Luke Tchang Date: Wed, 17 Apr 2024 09:04:12 -0400 Subject: [PATCH] remove batchfiller check --- .../contracts/CommitmentTreeManager.sol | 4 ++- .../test/unit/TellerAndHandler.t.sol | 25 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/packages/contracts/contracts/CommitmentTreeManager.sol b/packages/contracts/contracts/CommitmentTreeManager.sol index ca39cb3..1cd92f8 100644 --- a/packages/contracts/contracts/CommitmentTreeManager.sol +++ b/packages/contracts/contracts/CommitmentTreeManager.sol @@ -33,6 +33,7 @@ contract CommitmentTreeManager is // Offchain merkle tree struct OffchainMerkleTree internal _merkle; + // DEPRECATED // Set of addressed allowed to fill subtree batches with zeros mapping(address => bool) public _subtreeBatchFillers; @@ -85,6 +86,7 @@ contract CommitmentTreeManager is _pastRoots[TreeUtils.EMPTY_TREE_ROOT] = true; } + // DEPRECATED /// @notice Require caller is permissioned batch filler modifier onlySubtreeBatchFiller() { require(_subtreeBatchFillers[msg.sender], "Only subtree batch filler"); @@ -105,7 +107,7 @@ contract CommitmentTreeManager is /// @notice Inserts a batch of zero refund notes into the commitment tree /// @dev This function allows the an entity to expedite process of being able to update /// the merkle tree root. The caller of this function - function fillBatchWithZeros() external onlySubtreeBatchFiller { + function fillBatchWithZeros() external { uint256 batchLen = _merkle.getBatchLen(); require(batchLen > 0, "!zero fill empty batch"); diff --git a/packages/contracts/contracts/test/unit/TellerAndHandler.t.sol b/packages/contracts/contracts/test/unit/TellerAndHandler.t.sol index 2414659..ef675d9 100644 --- a/packages/contracts/contracts/test/unit/TellerAndHandler.t.sol +++ b/packages/contracts/contracts/test/unit/TellerAndHandler.t.sol @@ -411,31 +411,6 @@ contract TellerAndHandlerTest is Test, PoseidonDeployer { teller.setDepositSourcePermission(address(0x123), true); } - function testSetSubtreeBatchFillerHandler() public { - vm.expectRevert("Only subtree batch filler"); - vm.prank(ALICE); - handler.fillBatchWithZeros(); - - vm.expectEmit(true, true, true, true); - emit SubtreeBatchFillerPermissionSet(ALICE, true); - handler.setSubtreeBatchFillerPermission(ALICE, true); - - // So batch is not empty - SimpleERC20Token token = ERC20s[0]; - deal(address(token), address(ALICE), PER_NOTE_AMOUNT); - depositFunds( - ALICE, - token, - PER_NOTE_AMOUNT, - ERC20_ID, - NocturneUtils.defaultStealthAddress() - ); - - vm.prank(ALICE); - handler.fillBatchWithZeros(); - assertEq(handler.totalCount(), 16); - } - function testDepositNotDepositSource() public { SimpleERC20Token token = ERC20s[0]; deal(address(token), address(ALICE), PER_NOTE_AMOUNT);