mirror of
https://github.com/vacp2p/staking-reward-streamer.git
synced 2026-01-09 13:08:03 -05:00
fix(RLN): ensure init params are valid
This commit is contained in:
@@ -10,12 +10,22 @@ import { Groth16Verifier } from "../src/rln/Verifier.sol";
|
|||||||
import { RLN } from "../src/rln/RLN.sol";
|
import { RLN } from "../src/rln/RLN.sol";
|
||||||
|
|
||||||
contract DeployRLNScript is BaseScript {
|
contract DeployRLNScript is BaseScript {
|
||||||
|
|
||||||
|
error InvalidDepth();
|
||||||
|
error InvalidAddress();
|
||||||
|
|
||||||
function run() public returns (RLN, DeploymentConfig) {
|
function run() public returns (RLN, DeploymentConfig) {
|
||||||
DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster);
|
DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster);
|
||||||
(address deployer,) = deploymentConfig.activeNetworkConfig();
|
(address deployer,) = deploymentConfig.activeNetworkConfig();
|
||||||
|
|
||||||
uint256 depth = vm.envUint("DEPTH");
|
uint256 depth = vm.envUint("DEPTH");
|
||||||
|
if (depth == 0) {
|
||||||
|
revert InvalidDepth();
|
||||||
|
}
|
||||||
address karmaAddress = vm.envAddress("KARMA_ADDRESS");
|
address karmaAddress = vm.envAddress("KARMA_ADDRESS");
|
||||||
|
if (karmaAddress == address(0)) {
|
||||||
|
revert InvalidAddress();
|
||||||
|
}
|
||||||
|
|
||||||
vm.startBroadcast(deployer);
|
vm.startBroadcast(deployer);
|
||||||
address verifier = (address)(new Groth16Verifier());
|
address verifier = (address)(new Groth16Verifier());
|
||||||
|
|||||||
Reference in New Issue
Block a user