Skip to content

Commit

Permalink
remove batchfiller check
Browse files Browse the repository at this point in the history
  • Loading branch information
luketchang committed Apr 17, 2024
1 parent b750bc4 commit c3060d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
4 changes: 3 additions & 1 deletion packages/contracts/contracts/CommitmentTreeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand All @@ -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");

Expand Down
25 changes: 0 additions & 25 deletions packages/contracts/contracts/test/unit/TellerAndHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c3060d5

Please sign in to comment.