Skip to content

Commit

Permalink
chore: added test data
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Oct 18, 2024
1 parent 4133ce6 commit 8c2efe9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bolt-contracts/config/holesky/validators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"boltValidators": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"maxCommittedGasLimit": 10000000,
"authorizedOperator": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"pubkeys": [
"0xa995029d6fc41241acc4a18621204ad11db196986f44789f564652350d50b3bb995b224e998f8338f7e17620ea80531d",
"0xa9b4faba4a513626249f17e46152f1760a4616118c49694634ea0b6fde16629a064a485ec44957e41c1cc2cc33aad98e",
"0x902c8589f286f3dfc0d74775fcd8d1a580313a0711d68ecb9212eb94208cfd797bf67742adb46aee84bc67b902041326",
"0x84cb3155459fa1bda073199e1270119ddf714cd9f435c43507a287a46f334cf5937d45154b05ba3589c251845b07235f",
"0xb9048c8e89d4586f9f63152e0cb8b1b76f7392a1fc30c30eb6f9ece4a2e7b1b3ea045fecf72ae0e0a8e42a9beca2d908",
"0x81c51f8f7ad4b11d972e1fdae4702edb0b42531c4f366451962bd6097845952d136e441ec03f7cb1f463e37c2bffd1a9",
"0xa9d93a373ed9e42625b00437481eb5451f30bc23c169eca61a7d7cb55a7d517719b2f4764d9849cc220586ce3805ee4a",
"0x8c9b8ff21f6aec6c3c80df64f6afb71cdd3e566cff3d04d6fb679b3f0e4b32c85763fd78de6425df4062cad08687cbc2",
"0x977cea163cbf5e490573f46091c0e06f1961a7e277a6d923d50217dafa5963313e3c7a803691f71a724a308ccc261f30",
"0xa922472f3382bf6e0e157daaa05958cbcfd6cd00d11c6a4702d3818627b49e146af7002778174c123555a93afe0b7e9e"
]
}
55 changes: 55 additions & 0 deletions bolt-contracts/script/holesky/validators/RegisterValidators.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {IBoltValidatorsV1} from "../interfaces/IBoltValidatorsV1.sol";
import {BLS12381} from "../lib/bls/BLS12381.sol";

import {Script, console} from "forge-std/Script.sol";

/// @notice Script to register Ethereum validators to Bolt
contract RegisterValidators is Script {
struct RegisterValidatorsConfig {
address boltValidators;
uint128 maxCommittedGasLimit;
address authorizedOperator;
string[] pubkeys;
}

function run(
string configPath
) public {
address controller = msg.sender;

console.log("Registering validators to Bolt");
console.log("Controller address: ", controller);

RegisterValidatorsConfig memory config = parseConfig(configPath);

vm.startBroadcast(controller);
IBoltValidatorsV1(boltValidators).batchRegisterValidatorsUnsafe(
config.pubkeys, config.maxCommittedGasLimit, config.authorizedOperator
);
vm.stopBroadcast();

console.log("Validators registered successfully");
}

function parseConfig(
string configPath
) 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);

config.boltValidators = vm.parseJsonAddress(json, "boltValidators");
config.authorizedOperator = vm.parseJsonAddress(json, "authorizedOperator");
config.maxCommittedGasLimit = uint128(vm.parseJsonUint(json, "maxCommittedGasLimit"));

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]));
}
config.pubkeys = pubkeys;
}
}

0 comments on commit 8c2efe9

Please sign in to comment.