Skip to content

Commit 0d48d3f

Browse files
Move the immutable devmode flag from the initialize to the constructor
1 parent 55619b2 commit 0d48d3f

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

contracts/script/deploy/AlignedProofAggregationServiceDeployer.s.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ contract AlignedProofAggregationServiceDeployer is Script {
2323

2424
vm.startBroadcast();
2525

26-
AlignedProofAggregationService alignedProofAggregationService = new AlignedProofAggregationService();
26+
AlignedProofAggregationService alignedProofAggregationService = new AlignedProofAggregationService(devMode);
2727

2828
ERC1967Proxy proxy = new ERC1967Proxy(
2929
address(alignedProofAggregationService),
3030
abi.encodeWithSignature(
31-
"initialize(address,address,address,address,bytes32,bytes32,bool)",
31+
"initialize(address,address,address,address,bytes32,bytes32)",
3232
ownerAddress,
3333
alignedAggregatorAddress,
3434
sp1VerifierAddress,
3535
risc0VerifierAddress,
3636
risc0AggregationProgramImageId,
37-
sp1AggregationProgramVKHash,
38-
devMode
37+
sp1AggregationProgramVKHash
3938
)
4039
);
4140

contracts/script/upgrade/ProofAggregatorServiceUpgrader.s.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ import "forge-std/Script.sol";
77
import "forge-std/StdJson.sol";
88

99
contract AlignedProofAggregationServiceUpgrader is Script {
10-
function run(string memory alignedLayerDeploymentFilePath) external returns (address, address) {
10+
function run(string memory alignedLayerDeploymentFilePath, string memory proofAggregatorConfigFilePath) external returns (address, address) {
1111
string memory aligned_deployment_file = vm.readFile(alignedLayerDeploymentFilePath);
12+
string memory config_data = vm.readFile(proofAggregatorConfigFilePath);
1213

1314
vm.startBroadcast();
1415

1516
AlignedProofAggregationService proofAggregationServiceProxy = AlignedProofAggregationService(
1617
payable(stdJson.readAddress(aligned_deployment_file, ".addresses.alignedProofAggregationService"))
1718
);
1819

19-
AlignedProofAggregationService newProofAggregatorServiceImplementation = new AlignedProofAggregationService();
20+
bool devMode = stdJson.readBool(config_data, ".devMode");
21+
22+
AlignedProofAggregationService newProofAggregatorServiceImplementation = new AlignedProofAggregationService(devMode);
2023

2124
// Not link the new implementation to the proxy
2225
// Because this must be executed in the multisig

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ contract AlignedProofAggregationService is
3636
/// @notice whether we are in dev mode or not
3737
/// if true, verification checks are skipped (only for test deployments)
3838
/// This flag is set only at initialization and cannot be changed afterwards.
39-
bool public devMode;
39+
bool public immutable devMode;
4040

4141
/// The unique identifier (image ID) of the RISC Zero aggregator program.
4242
/// This ensures that only proofs generated by a trusted Risc0 program can be verified.
@@ -46,7 +46,8 @@ contract AlignedProofAggregationService is
4646
/// This ensures that only proofs generated by a trusted SP1 program can be verified.
4747
bytes32 public sp1AggregatorProgramVKHash;
4848

49-
constructor() {
49+
constructor(bool _devMode) {
50+
devMode = _devMode;
5051
_disableInitializers();
5152
}
5253

@@ -56,8 +57,7 @@ contract AlignedProofAggregationService is
5657
address _sp1VerifierAddress,
5758
address _risc0VerifierAddress,
5859
bytes32 _risc0AggregatorProgramImageId,
59-
bytes32 _sp1AggregatorProgramVKHash,
60-
bool _devMode
60+
bytes32 _sp1AggregatorProgramVKHash
6161
) public initializer {
6262
__Ownable_init();
6363
__UUPSUpgradeable_init();
@@ -67,7 +67,6 @@ contract AlignedProofAggregationService is
6767
risc0VerifierAddress = _risc0VerifierAddress;
6868
risc0AggregatorProgramImageId = _risc0AggregatorProgramImageId;
6969
sp1AggregatorProgramVKHash = _sp1AggregatorProgramVKHash;
70-
devMode = _devMode;
7170
}
7271

7372
function verifySP1(bytes32 blobVersionedHash, bytes calldata sp1PublicValues, bytes calldata sp1ProofBytes)

0 commit comments

Comments
 (0)