Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ build-fast:
.PHONY: test
test:
forge test -vv
PDP_TEST_LEGACY_STORAGE=true forge test -vv

# Fast local test target (non-IR, optimizer disabled)
.PHONY: test-fast
test-fast:
FOUNDRY_PROFILE=fast forge test -vv
PDP_TEST_LEGACY_STORAGE=true FOUNDRY_PROFILE=fast forge test -vv

# Deployment targets
.PHONY: deploy-calibnet
Expand Down
12 changes: 11 additions & 1 deletion test/PDPVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contract PDPVerifierDataSetCreateDeleteTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();
}

Expand Down Expand Up @@ -255,6 +256,7 @@ contract PDPVerifierStorageProviderTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();

storageProvider = address(this);
Expand Down Expand Up @@ -355,6 +357,7 @@ contract PDPVerifierDataSetMutateTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();
}

Expand Down Expand Up @@ -1246,6 +1249,7 @@ contract PDPVerifierPaginationTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();
}

Expand Down Expand Up @@ -2190,6 +2194,7 @@ contract PDPListenerIntegrationTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
badListener = new BadListener();
}

Expand Down Expand Up @@ -2296,6 +2301,7 @@ contract PDPVerifierExtraDataTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
extraDataListener = new ExtraDataListener();
}

Expand Down Expand Up @@ -2354,6 +2360,7 @@ contract PDPVerifierE2ETest is MockFVMTest, ProofBuilderHelper, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();
vm.fee(1 gwei);
vm.deal(address(pdpVerifierImpl), 100 ether);
Expand Down Expand Up @@ -2675,6 +2682,7 @@ contract PDPVerifierFeeTest is MockFVMTest, PieceHelper, ProofBuilderHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
vm.fee(1 gwei);
listener = new TestingRecordKeeperService();
}
Expand Down Expand Up @@ -2799,7 +2807,7 @@ contract MockStorageProviderChangedListener is PDPListener {
function nextProvingPeriod(uint256, uint256, uint256, bytes calldata) external override {}
}

contract PDPVerifierStorageProviderListenerTest is MockFVMTest {
contract PDPVerifierStorageProviderListenerTest is MockFVMTest, PieceHelper {
PDPVerifier pdpVerifier;
MockStorageProviderChangedListener listener;
address public storageProvider;
Expand All @@ -2813,6 +2821,7 @@ contract PDPVerifierStorageProviderListenerTest is MockFVMTest {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new MockStorageProviderChangedListener();
storageProvider = address(this);
nextStorageProvider = address(0x1234);
Expand Down Expand Up @@ -2855,6 +2864,7 @@ contract PDPVerifierCIDSearchTest is MockFVMTest, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();

setId = pdpVerifier.createDataSet{value: PDPFees.cleanupDeposit()}(address(listener), empty);
Expand Down
1 change: 1 addition & 0 deletions test/PDPVerifierProofTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ contract PDPVerifierProofTest is MockFVMTest, ProofBuilderHelper, PieceHelper {
bytes memory initializeData = abi.encodeWithSelector(PDPVerifier.initialize.selector);
MyERC1967Proxy proxy = new MyERC1967Proxy(address(pdpVerifierImpl), initializeData);
pdpVerifier = PDPVerifier(address(proxy));
_configurePieceStorage(pdpVerifier);
listener = new TestingRecordKeeperService();
vm.fee(1 wei);
vm.deal(address(pdpVerifierImpl), 100 ether);
Expand Down
13 changes: 9 additions & 4 deletions test/PieceHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
import {Cids} from "../src/Cids.sol";
import {BitOps} from "../src/BitOps.sol";
import {PDPVerifier} from "../src/PDPVerifier.sol";
import {LEGACY_PIECE_STORAGE_ID_LIMIT_SLOT} from "../src/PDPVerifierLayout.sol";

contract PieceHelper is Test {
function _configurePieceStorage(PDPVerifier verifier) internal {
if (vm.envOr("PDP_TEST_LEGACY_STORAGE", false)) {
vm.store(address(verifier), LEGACY_PIECE_STORAGE_ID_LIMIT_SLOT, bytes32(0));
assertEq(verifier.legacyPieceStorageIdLimit(), 0, "legacy piece storage not enabled");
}
}

function validateCommPv2(Cids.Cid calldata cid)
external
pure
Expand Down Expand Up @@ -54,10 +63,6 @@ contract PieceHelper is Test {
uint256 paddingLeaves = (1 << height) - leafCount;
uint256 padding = (paddingLeaves * 32 * 127 + 127) / 128;

console.log("leafCount", leafCount);
console.log("height", height);
console.log("paddingLeaves", paddingLeaves);
console.log("padding", padding);
assertEq(Cids.leafCount(padding, height), leafCount, "makePiece: leaf count mismatch");
return Cids.CommPv2FromDigest(padding, height, tree[0][0]);
}
Expand Down
1 change: 1 addition & 0 deletions test/SimplePDPService.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ contract PDPVerifierSimplePDPServiceIntegrationTest is MockFVMTest, PieceHelper
)
)
);
_configurePieceStorage(pdpVerifier);

SimplePDPService serviceImplementation = new SimplePDPService(1);
pdpService = SimplePDPService(
Expand Down
Loading