From 7e814a7dc152ed99f48cec0161cc090994b27cec Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:18:25 +0200 Subject: [PATCH] feat: parse decompressed pubkeys --- .../config/holesky/register_validators.json | 15 +++++++++++++++ bolt-contracts/config/holesky/validators.json | 17 ----------------- .../holesky/validators/RegisterValidators.s.sol | 17 ++++++----------- 3 files changed, 21 insertions(+), 28 deletions(-) create mode 100644 bolt-contracts/config/holesky/register_validators.json delete mode 100644 bolt-contracts/config/holesky/validators.json diff --git a/bolt-contracts/config/holesky/register_validators.json b/bolt-contracts/config/holesky/register_validators.json new file mode 100644 index 00000000..581a2da3 --- /dev/null +++ b/bolt-contracts/config/holesky/register_validators.json @@ -0,0 +1,15 @@ +{ + "boltValidators": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", + "maxCommittedGasLimit": 10000000, + "authorizedOperator": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", + "pubkeys": [ + { + "x": [1, 2], + "y": [3, 4] + }, + { + "x": [5, 6], + "y": [7, 8] + } + ] +} diff --git a/bolt-contracts/config/holesky/validators.json b/bolt-contracts/config/holesky/validators.json deleted file mode 100644 index 9fbdc2c1..00000000 --- a/bolt-contracts/config/holesky/validators.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "boltValidators": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", - "maxCommittedGasLimit": 10000000, - "authorizedOperator": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", - "pubkeys": [ - "0xa995029d6fc41241acc4a18621204ad11db196986f44789f564652350d50b3bb995b224e998f8338f7e17620ea80531d", - "0xa9b4faba4a513626249f17e46152f1760a4616118c49694634ea0b6fde16629a064a485ec44957e41c1cc2cc33aad98e", - "0x902c8589f286f3dfc0d74775fcd8d1a580313a0711d68ecb9212eb94208cfd797bf67742adb46aee84bc67b902041326", - "0x84cb3155459fa1bda073199e1270119ddf714cd9f435c43507a287a46f334cf5937d45154b05ba3589c251845b07235f", - "0xb9048c8e89d4586f9f63152e0cb8b1b76f7392a1fc30c30eb6f9ece4a2e7b1b3ea045fecf72ae0e0a8e42a9beca2d908", - "0x81c51f8f7ad4b11d972e1fdae4702edb0b42531c4f366451962bd6097845952d136e441ec03f7cb1f463e37c2bffd1a9", - "0xa9d93a373ed9e42625b00437481eb5451f30bc23c169eca61a7d7cb55a7d517719b2f4764d9849cc220586ce3805ee4a", - "0x8c9b8ff21f6aec6c3c80df64f6afb71cdd3e566cff3d04d6fb679b3f0e4b32c85763fd78de6425df4062cad08687cbc2", - "0x977cea163cbf5e490573f46091c0e06f1961a7e277a6d923d50217dafa5963313e3c7a803691f71a724a308ccc261f30", - "0xa922472f3382bf6e0e157daaa05958cbcfd6cd00d11c6a4702d3818627b49e146af7002778174c123555a93afe0b7e9e" - ] -} diff --git a/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol index 2fbf4d78..31b5e818 100644 --- a/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol +++ b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol @@ -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; } }