mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-10 09:58:00 -05:00
fix: use placeholder cid
This commit is contained in:
@@ -27,7 +27,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob withdraws the total amount of Alice's commitment
|
||||
_selfWithdraw(
|
||||
@@ -53,7 +53,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob receives the total amount of Alice's commitment
|
||||
_withdrawThroughRelayer(
|
||||
@@ -79,7 +79,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob withdraws 2000 DAI of Alice's commitment
|
||||
_selfWithdraw(
|
||||
@@ -105,7 +105,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 2000 DAI to Bob
|
||||
_commitment = _selfWithdraw(
|
||||
@@ -167,7 +167,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob receives half of Alice's commitment
|
||||
_withdrawThroughRelayer(
|
||||
@@ -193,7 +193,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 2000 DAI to Bob
|
||||
_commitment = _withdrawThroughRelayer(
|
||||
@@ -256,8 +256,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
// Push ASP root without label
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD,
|
||||
'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa'
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid'
|
||||
);
|
||||
|
||||
// Fail to withdraw
|
||||
@@ -287,7 +286,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 4000 DAI through relayer
|
||||
_commitment = _withdrawThroughRelayer(
|
||||
@@ -304,8 +303,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
// Remove label from ASP
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD,
|
||||
'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa'
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid'
|
||||
);
|
||||
|
||||
// Fail to withdraw
|
||||
@@ -335,7 +333,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Fully spend child commitment
|
||||
_selfWithdraw(
|
||||
@@ -376,7 +374,7 @@ contract IntegrationERC20 is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Fail to withdraw commitment that was already ragequitted
|
||||
_selfWithdraw(
|
||||
|
||||
@@ -23,7 +23,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob withdraws the total amount of Alice's commitment
|
||||
_selfWithdraw(
|
||||
@@ -49,7 +49,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob receives withdraws total amount of Alice's commitment through a relayer
|
||||
_withdrawThroughRelayer(
|
||||
@@ -75,7 +75,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob withdraws the total amount of Alice's commitment
|
||||
_selfWithdraw(
|
||||
@@ -101,7 +101,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 20 ETH to Bob
|
||||
_commitment = _selfWithdraw(
|
||||
@@ -175,7 +175,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Bob receives the total amount of Alice's commitment through a relayer
|
||||
_withdrawThroughRelayer(
|
||||
@@ -201,7 +201,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 20 ETH to Bob
|
||||
_commitment = _withdrawThroughRelayer(
|
||||
@@ -276,8 +276,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
// Push ASP root without label
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD,
|
||||
'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa'
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid'
|
||||
);
|
||||
|
||||
// Fail to withdraw because the label is not included in the latest ASP root
|
||||
@@ -307,7 +306,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Withdraw 40 ETH through relayer
|
||||
_commitment = _withdrawThroughRelayer(
|
||||
@@ -324,8 +323,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
// Remove label from ASP
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD,
|
||||
'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa'
|
||||
uint256(keccak256('some_root')) % SNARK_SCALAR_FIELD, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid'
|
||||
);
|
||||
|
||||
// Fail to withdraw because label is not included in the latest ASP root
|
||||
@@ -355,7 +353,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Fully spend commitment
|
||||
_selfWithdraw(
|
||||
@@ -396,7 +394,7 @@ contract IntegrationNative is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Fail to withdraw commitment that was already ragequitted
|
||||
_selfWithdraw(
|
||||
|
||||
@@ -25,7 +25,7 @@ contract IntegrationProofs is IntegrationBase {
|
||||
|
||||
// Push ASP root with label included
|
||||
vm.prank(_POSTMAN);
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.updateRoot(_shadowASPMerkleTree._root(), 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
_withdrawal = IPrivacyPool.Withdrawal({processooor: _BOB, data: abi.encode(_BOB, address(0), 0)});
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ contract Setup is HandlerActors, GhostStorage, FuzzUtils {
|
||||
entrypoint.registerPool(token, IPrivacyPool(tokenPool), MIN_DEPOSIT, FEE_VETTING, MAX_RELAY_FEE);
|
||||
|
||||
vm.prank(POSTMAN);
|
||||
entrypoint.updateRoot(1, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
entrypoint.updateRoot(1, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
createNewActors(5);
|
||||
|
||||
|
||||
@@ -241,9 +241,9 @@ contract UnitRootUpdate is UnitEntrypoint {
|
||||
assertEq(_index, 0, 'First root update should have index 0');
|
||||
|
||||
vm.expectEmit(address(_entrypoint));
|
||||
emit IEntrypoint.RootUpdated(_root, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa', _timestamp);
|
||||
emit IEntrypoint.RootUpdated(_root, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid', _timestamp);
|
||||
|
||||
_index = _entrypoint.updateRoot(_root, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_index = _entrypoint.updateRoot(_root, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
assertEq(_index, 1, 'Second root update should have index 1');
|
||||
}
|
||||
|
||||
@@ -1458,7 +1458,7 @@ contract UnitViewMethods is UnitEntrypoint {
|
||||
*/
|
||||
function test_LatestRootGivenAssociationSetsExist() external {
|
||||
// Mock association set with root value 1
|
||||
_entrypoint.mockAssociationSets(1, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.mockAssociationSets(1, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Verify latest root is returned correctly
|
||||
assertEq(_entrypoint.latestRoot(), 1, 'Latest root should be 1');
|
||||
@@ -1469,8 +1469,8 @@ contract UnitViewMethods is UnitEntrypoint {
|
||||
*/
|
||||
function test_RootByIndexGivenValidIndex() external {
|
||||
// Mock multiple association sets with different roots
|
||||
_entrypoint.mockAssociationSets(1, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.mockAssociationSets(2, 'bafkreidigpgsqmyq7f3c56a6yojlxjfpqs7l44uke6q3i63qznatnoiywa');
|
||||
_entrypoint.mockAssociationSets(1, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
_entrypoint.mockAssociationSets(2, 'ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid_ipfs_cid');
|
||||
|
||||
// Verify roots are returned correctly by index
|
||||
assertEq(_entrypoint.rootByIndex(0), 1, 'First root should be 1');
|
||||
|
||||
Reference in New Issue
Block a user