From 46934783c338acac1deaaaceae0cad231ae27d9a Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:46:39 +0200 Subject: [PATCH] chore: update script --- .../validators/RegisterValidators.s.sol | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol index 547b27054..2fbf4d783 100644 --- a/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol +++ b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol @@ -1,32 +1,31 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.25; -import {IBoltValidatorsV1} from "../interfaces/IBoltValidatorsV1.sol"; -import {BLS12381} from "../lib/bls/BLS12381.sol"; +import {IBoltValidatorsV1} from "../../../src/interfaces/IBoltValidatorsV1.sol"; +import {BLS12381} from "../../../src/lib/bls/BLS12381.sol"; import {Script, console} from "forge-std/Script.sol"; /// @notice Script to register Ethereum validators to Bolt +/// @dev this script reads from the config file in /config/holesky/register_validators.json contract RegisterValidators is Script { struct RegisterValidatorsConfig { address boltValidators; uint128 maxCommittedGasLimit; address authorizedOperator; - string[] pubkeys; + BLS12381.G1Point[] pubkeys; } - function run( - string configPath - ) public { + function run() public { address controller = msg.sender; console.log("Registering validators to Bolt"); console.log("Controller address: ", controller); - RegisterValidatorsConfig memory config = parseConfig(configPath); + RegisterValidatorsConfig memory config = parseConfig(); vm.startBroadcast(controller); - IBoltValidatorsV1(boltValidators).batchRegisterValidatorsUnsafe( + IBoltValidatorsV1(config.boltValidators).batchRegisterValidatorsUnsafe( config.pubkeys, config.maxCommittedGasLimit, config.authorizedOperator ); vm.stopBroadcast(); @@ -34,9 +33,7 @@ contract RegisterValidators is Script { console.log("Validators registered successfully"); } - function parseConfig( - string configPath - ) public view returns (RegisterValidatorsConfig memory config) { + function parseConfig() public view returns (RegisterValidatorsConfig memory config) { string memory root = vm.projectRoot(); string memory path = string.concat(root, "/config/holesky/register_validators.json"); string memory json = vm.readFile(path); @@ -48,7 +45,9 @@ contract RegisterValidators is Script { string[] memory pubkeysRaw = vm.parseJsonStringArray(json, "pubkeys"); BLS12381.G1Point[] memory pubkeys = new BLS12381.G1Point[](pubkeysRaw.length); for (uint256 i = 0; i < pubkeysRaw.length; i++) { - pubkeys[i] = BLS12381.G1Point(vm.parseJsonBytes(json, pubkeysRaw[i])); + uint256[2] memory x = [uint256(0), uint256(0)]; + uint256[2] memory y = [uint256(0), uint256(0)]; + pubkeys[i] = BLS12381.G1Point(x, y); } config.pubkeys = pubkeys; }