fix(RLN): ensure init params are valid

This commit is contained in:
r4bbit
2025-07-15 15:16:49 +02:00
parent edd63e75f9
commit fdc45eac07

View File

@@ -10,12 +10,22 @@ import { Groth16Verifier } from "../src/rln/Verifier.sol";
import { RLN } from "../src/rln/RLN.sol";
contract DeployRLNScript is BaseScript {
error InvalidDepth();
error InvalidAddress();
function run() public returns (RLN, DeploymentConfig) {
DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster);
(address deployer,) = deploymentConfig.activeNetworkConfig();
uint256 depth = vm.envUint("DEPTH");
if (depth == 0) {
revert InvalidDepth();
}
address karmaAddress = vm.envAddress("KARMA_ADDRESS");
if (karmaAddress == address(0)) {
revert InvalidAddress();
}
vm.startBroadcast(deployer);
address verifier = (address)(new Groth16Verifier());