Skip to content

Commit 338ccf0

Browse files
committed
chore: formatting
1 parent d7e1bff commit 338ccf0

File tree

3 files changed

+32
-28
lines changed

3 files changed

+32
-28
lines changed

test/utils/BN256G2.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ library BN256G2 {
174174

175175
function _modInv(uint256 a, uint256 n) internal view returns (uint256 result) {
176176
bool success;
177-
assembly ("memory-safe") {
177+
assembly ("memory-safe") {
178178
let freemem := mload(0x40)
179179
mstore(freemem, 0x20)
180180
mstore(add(freemem, 0x20), 0x20)
@@ -334,4 +334,4 @@ library BN256G2 {
334334
d = d / 2;
335335
}
336336
}
337-
}
337+
}

test/utils/MockAVSDeployer.sol

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {BLSApkRegistryHarness} from "../harnesses/BLSApkRegistryHarness.sol";
5353
import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol";
5454

5555
import {StakeRegistryHarness} from "../harnesses/StakeRegistryHarness.sol";
56-
import {OperatorLib} from "../utils/OperatorLib.sol";
56+
import {OperatorWalletLib} from "../utils/OperatorWalletLib.sol";
5757

5858
import "forge-std/Test.sol";
5959

@@ -549,10 +549,16 @@ contract MockAVSDeployer is Test {
549549
});
550550
}
551551

552-
function _createOperators(uint256 numOperators, uint256 startIndex) internal returns (OperatorLib.Operator[] memory) {
553-
OperatorLib.Operator[] memory operators = new OperatorLib.Operator[](numOperators);
552+
function _createOperators(
553+
uint256 numOperators,
554+
uint256 startIndex
555+
) internal returns (OperatorWalletLib.Operator[] memory) {
556+
OperatorWalletLib.Operator[] memory operators =
557+
new OperatorWalletLib.Operator[](numOperators);
554558
for (uint256 i = 0; i < numOperators; i++) {
555-
operators[i] = OperatorLib.createOperator(string(abi.encodePacked("operator-", i + startIndex)));
559+
operators[i] = OperatorWalletLib.createOperator(
560+
string(abi.encodePacked("operator-", i + startIndex))
561+
);
556562
}
557563
return operators;
558564
}

test/utils/OperatorLib.sol renamed to test/utils/OperatorWalletLib.sol

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {BN254} from "src/libraries/BN254.sol";
66
import {BN256G2} from "./BN256G2.sol";
77
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
88

9-
library OperatorLib {
9+
library OperatorWalletLib {
1010
using BN254 for *;
1111
using Strings for uint256;
1212

@@ -21,47 +21,46 @@ library OperatorLib {
2121
BN254.G1Point publicKeyG1;
2222
}
2323

24-
Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
25-
2624
struct Operator {
2725
Wallet key;
2826
BLSWallet signingKey;
2927
}
3028

31-
function createBLSWallet(uint256 salt) internal returns (BLSWallet memory) {
29+
Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
30+
31+
function createBLSWallet(
32+
uint256 salt
33+
) internal returns (BLSWallet memory) {
3234
uint256 privateKey = uint256(keccak256(abi.encodePacked(salt)));
3335
BN254.G1Point memory publicKeyG1 = BN254.generatorG1().scalar_mul(privateKey);
3436
BN254.G2Point memory publicKeyG2 = mul(privateKey);
3537

36-
return BLSWallet({
37-
privateKey: privateKey,
38-
publicKeyG2: publicKeyG2,
39-
publicKeyG1: publicKeyG1
40-
});
38+
return
39+
BLSWallet({privateKey: privateKey, publicKeyG2: publicKeyG2, publicKeyG1: publicKeyG1});
4140
}
4241

43-
function createWallet(uint256 salt) internal pure returns (Wallet memory) {
42+
function createWallet(
43+
uint256 salt
44+
) internal pure returns (Wallet memory) {
4445
uint256 privateKey = uint256(keccak256(abi.encodePacked(salt)));
4546
address addr = vm.addr(privateKey);
4647

47-
return Wallet({
48-
privateKey: privateKey,
49-
addr: addr
50-
});
48+
return Wallet({privateKey: privateKey, addr: addr});
5149
}
5250

53-
function createOperator(string memory name) internal returns (Operator memory) {
51+
function createOperator(
52+
string memory name
53+
) internal returns (Operator memory) {
5454
uint256 salt = uint256(keccak256(abi.encodePacked(name)));
5555
Wallet memory vmWallet = createWallet(salt);
5656
BLSWallet memory blsWallet = createBLSWallet(salt);
5757

58-
return Operator({
59-
key: vmWallet,
60-
signingKey: blsWallet
61-
});
58+
return Operator({key: vmWallet, signingKey: blsWallet});
6259
}
6360

64-
function mul(uint256 x) internal returns (BN254.G2Point memory g2Point) {
61+
function mul(
62+
uint256 x
63+
) internal returns (BN254.G2Point memory g2Point) {
6564
string[] memory inputs = new string[](5);
6665
inputs[0] = "go";
6766
inputs[1] = "run";
@@ -84,5 +83,4 @@ library OperatorLib {
8483
res = vm.ffi(inputs);
8584
g2Point.Y[0] = abi.decode(res, (uint256));
8685
}
87-
88-
}
86+
}

0 commit comments

Comments
 (0)