Skip to content

Commit

Permalink
feat: parse decompressed pubkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Oct 18, 2024
1 parent 4693478 commit 7e814a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
15 changes: 15 additions & 0 deletions bolt-contracts/config/holesky/register_validators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"boltValidators": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"maxCommittedGasLimit": 10000000,
"authorizedOperator": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"pubkeys": [
{
"x": [1, 2],
"y": [3, 4]
},
{
"x": [5, 6],
"y": [7, 8]
}
]
}
17 changes: 0 additions & 17 deletions bolt-contracts/config/holesky/validators.json

This file was deleted.

17 changes: 6 additions & 11 deletions bolt-contracts/script/holesky/validators/RegisterValidators.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,12 @@ contract RegisterValidators is Script {
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++) {
uint256[2] memory x = [uint256(0), uint256(0)];
uint256[2] memory y = [uint256(0), uint256(0)];
pubkeys[i] = BLS12381.G1Point(x, y);
}
config.boltValidators = vm.parseJsonAddress(json, ".boltValidators");
config.authorizedOperator = vm.parseJsonAddress(json, ".authorizedOperator");
config.maxCommittedGasLimit = uint128(vm.parseJsonUint(json, ".maxCommittedGasLimit"));

bytes memory pubkeysRaw = vm.parseJson(json, ".pubkeys");
BLS12381.G1Point[] memory pubkeys = abi.decode(pubkeysRaw, (BLS12381.G1Point[]));
config.pubkeys = pubkeys;
}
}

0 comments on commit 7e814a7

Please sign in to comment.