Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import "forge-std/Script.sol";
import "forge-std/StdJson.sol";

contract AlignedProofAggregationServiceUpgrader is Script {
function run(string memory alignedLayerDeploymentFilePath) external returns (address, address) {
function run(string memory alignedLayerDeploymentFilePath, string memory proofAggregatorConfigFilePath) external returns (address, address) {
string memory aligned_deployment_file = vm.readFile(alignedLayerDeploymentFilePath);
string memory config_data = vm.readFile(proofAggregatorConfigFilePath);
Comment thread
JuArce marked this conversation as resolved.
Outdated

vm.startBroadcast();

Expand Down

Large diffs are not rendered by default.

28 changes: 5 additions & 23 deletions contracts/src/core/AlignedProofAggregationService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ contract AlignedProofAggregationService is
/// https://dev.risczero.com/api/blockchain-integration/contracts/verifier#contract-addresses
address public risc0VerifierAddress;

/// @notice whether we are in dev mode or not
/// if the sp1 verifier address is set to this address, then we skip verification
address public constant VERIFIER_MOCK_ADDRESS = address(0xFF);

/// The unique identifier (image ID) of the RISC Zero aggregator program.
/// This ensures that only proofs generated by a trusted Risc0 program can be verified.
bytes32 public risc0AggregatorProgramImageId;
Expand Down Expand Up @@ -73,10 +69,7 @@ contract AlignedProofAggregationService is
{
(bytes32 merkleRoot) = abi.decode(sp1PublicValues, (bytes32));

// In dev mode, proofs are mocked, so we skip the verification part
if (_isSP1VerificationEnabled()) {
ISP1Verifier(sp1VerifierAddress).verifyProof(sp1AggregatorProgramVKHash, sp1PublicValues, sp1ProofBytes);
}
ISP1Verifier(sp1VerifierAddress).verifyProof(sp1AggregatorProgramVKHash, sp1PublicValues, sp1ProofBytes);

aggregatedProofs[merkleRoot] = true;
emit AggregatedProofVerified(merkleRoot, blobVersionedHash);
Expand All @@ -88,13 +81,10 @@ contract AlignedProofAggregationService is
{
(bytes32 merkleRoot) = abi.decode(risc0JournalBytes, (bytes32));

// In dev mode, proofs are mocked, so we skip the verification part
if (_isRisc0VerificationEnabled()) {
bytes32 risc0JournalDigest = sha256(risc0JournalBytes);
IRiscZeroVerifier(risc0VerifierAddress).verify(
risc0ReceiptSeal, risc0AggregatorProgramImageId, risc0JournalDigest
);
}
bytes32 risc0JournalDigest = sha256(risc0JournalBytes);
IRiscZeroVerifier(risc0VerifierAddress).verify(
risc0ReceiptSeal, risc0AggregatorProgramImageId, risc0JournalDigest
);

aggregatedProofs[merkleRoot] = true;
emit AggregatedProofVerified(merkleRoot, blobVersionedHash);
Expand Down Expand Up @@ -125,14 +115,6 @@ contract AlignedProofAggregationService is
return aggregatedProofs[merkleRoot];
}

function _isSP1VerificationEnabled() internal view returns (bool) {
return sp1VerifierAddress != VERIFIER_MOCK_ADDRESS;
}

function _isRisc0VerificationEnabled() internal view returns (bool) {
return risc0VerifierAddress != VERIFIER_MOCK_ADDRESS;
}

function _authorizeUpgrade(address newImplementation)
internal
override
Expand Down
Loading
Loading