@@ -26,34 +26,33 @@ contract MerkleRootTest is Test, SetupDistributor {
2626 distributor.setMerkleRoot (newRoot, newCid);
2727 }
2828
29- function test_SetMerkleRoot_RevertsOnSameRoot () public {
30- bytes32 newRoot = keccak256 ("testRoot " );
31- string memory cid1 = "QmTestCID1 " ;
32-
33- vm.prank (manager);
34- distributor.setMerkleRoot (newRoot, cid1);
29+ function test_SetMerkleRoot_RevertsWhenNoChanges () public {
30+ bytes32 initialRoot = keccak256 ("root " );
31+ string memory initialCid = "QmCID " ;
3532
36- // Try to set the same root with different CID
37- string memory cid2 = " QmTestCID2 " ;
33+ vm. startPrank (manager);
34+ distributor. setMerkleRoot (initialRoot, initialCid) ;
3835
39- vm.prank (manager);
4036 vm.expectRevert (Distributor.AlreadyProcessed.selector );
41- distributor.setMerkleRoot (newRoot, cid2);
37+ distributor.setMerkleRoot (initialRoot, initialCid);
38+ vm.stopPrank ();
4239 }
4340
44- function test_SetMerkleRoot_RevertsOnSameCid () public {
41+ function test_SetMerkleRoot_AllowsPartialUpdates () public {
4542 bytes32 root1 = keccak256 ("root1 " );
46- string memory sameCid = "QmTestCID " ;
43+ bytes32 root2 = keccak256 ("root2 " );
44+ string memory cid1 = "QmCid1 " ;
45+ string memory cid2 = "QmCid2 " ;
4746
48- vm.prank (manager);
49- distributor.setMerkleRoot (root1, sameCid );
47+ vm.startPrank (manager);
48+ distributor.setMerkleRoot (root1, cid1 );
5049
51- // Try to set different root with same CID
52- bytes32 root2 = keccak256 ( " root2 " );
50+ // Same root, new cid
51+ distributor. setMerkleRoot (root1, cid2 );
5352
54- vm. prank (manager);
55- vm. expectRevert (Distributor.AlreadyProcessed. selector );
56- distributor. setMerkleRoot (root2, sameCid );
53+ // Same cid, new root
54+ distributor. setMerkleRoot (root2, cid2 );
55+ vm. stopPrank ( );
5756 }
5857
5958 // ==================== Successful Merkle Root Setting ====================
0 commit comments