Skip to content

Commit a440bf0

Browse files
committed
chore: bls cli
1 parent 9089619 commit a440bf0

File tree

4 files changed

+64
-14
lines changed

4 files changed

+64
-14
lines changed

bootstrap.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ function check_toolchains {
7373
echo -e "${bold}${yellow}WARN: Rust ${rust_version} is not installed. Performance will be degraded.${reset}"
7474
fi
7575
# Check wasi-sdk version.
76-
if ! cat /opt/wasi-sdk/VERSION 2> /dev/null | grep 27.0 > /dev/null; then
77-
encourage_dev_container
78-
echo "wasi-sdk-27 not found at /opt/wasi-sdk."
79-
echo "Use dev container, build from source, or you can install linux x86 version with:"
80-
echo " curl -s -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | tar zxf - && sudo mv wasi-sdk-27.0-x86_64-linux /opt/wasi-sdk"
81-
exit 1
82-
fi
76+
# if ! cat /opt/wasi-sdk/VERSION 2> /dev/null | grep 27.0 > /dev/null; then
77+
# encourage_dev_container
78+
# echo "wasi-sdk-27 not found at /opt/wasi-sdk."
79+
# echo "Use dev container, build from source, or you can install linux x86 version with:"
80+
# echo " curl -s -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | tar zxf - && sudo mv wasi-sdk-27.0-x86_64-linux /opt/wasi-sdk"
81+
# exit 1
82+
# fi
8383
# Check foundry version.
8484
local foundry_version="v1.3.3"
8585
for tool in forge anvil; do

l1-contracts/src/core/libraries/Errors.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ library Errors {
123123
error Staking__CannotSlashExitedStake(address); // 0x45bf4940
124124
error Staking__FailedToRemove(address); // 0xa7d7baab
125125
error Staking__InvalidDeposit(address attester, address proposer); // 0xf33fe8c6
126-
error Staking__InvalidRecipient(address); // 0x7e2f7f1c
126+
error Staking__InvalidRecipient(address); // 0x4faf4233
127127
error Staking__InsufficientStake(uint256, uint256); // 0x903aee24
128128
error Staking__NoOneToSlash(address); // 0x7e2f7f1c
129129
error Staking__NotExiting(address); // 0xef566ee0
@@ -138,14 +138,14 @@ library Errors {
138138
error Staking__RollupAlreadyRegistered(address); // 0x108a39c8
139139
error Staking__InvalidRollupAddress(address); // 0xd876720e
140140
error Staking__NotCanonical(address); // 0x6244212e
141-
error Staking__InstanceDoesNotExist(address);
141+
error Staking__InstanceDoesNotExist(address); // 0x429f9c54
142142
error Staking__InsufficientPower(uint256, uint256);
143-
error Staking__AlreadyExiting(address);
144-
error Staking__FatalError(string);
143+
error Staking__AlreadyExiting(address); // 0x223622dc
144+
error Staking__FatalError(string); // 0x5bdb08d8
145145
error Staking__NotOurProposal(uint256, address, address);
146146
error Staking__IncorrectGovProposer(uint256);
147147
error Staking__GovernanceAlreadySet();
148-
error Staking__InsufficientBootstrapValidators(uint256 queueSize, uint256 bootstrapFlushSize);
148+
error Staking__InsufficientBootstrapValidators(uint256 queueSize, uint256 bootstrapFlushSize); // 0xa10528d9
149149
error Staking__InvalidStakingQueueConfig();
150150

151151
// Fee Juice Portal

yarn-project/cli/src/cmds/l1/index.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
pxeOption,
1616
} from '../../utils/commands.js';
1717

18-
export { addL1Validator } from './update_l1_validators.js';
18+
export { addL1Validator, makeRegistrationTuple } from './update_l1_validators.js';
1919

2020
const l1RpcUrlsOption = new Option(
2121
'--l1-rpc-urls <string>',
@@ -24,7 +24,10 @@ const l1RpcUrlsOption = new Option(
2424
.env('ETHEREUM_HOSTS')
2525
.default([ETHEREUM_HOSTS])
2626
.makeOptionMandatory(true)
27-
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
27+
.argParser((arg: string) => {
28+
console.log(arg);
29+
return arg.split(',').map(url => url.trim());
30+
});
2831

2932
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
3033
program
@@ -281,6 +284,23 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
281284
log(JSON.stringify(account, null, 2));
282285
});
283286

287+
program
288+
.command('make-registration-tuple')
289+
.description('Makes a registration tuple for a validator.')
290+
.addOption(l1RpcUrlsOption)
291+
.addOption(l1ChainIdOption)
292+
.option('--rollup-address <address>', 'ethereum address of the rollup', parseEthereumAddress)
293+
.option(
294+
'--bls-secret-key <string>',
295+
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
296+
parseBigint,
297+
)
298+
.action(async options => {
299+
console.log(options);
300+
const { makeRegistrationTuple } = await import('./update_l1_validators.js');
301+
await makeRegistrationTuple(options);
302+
});
303+
284304
program
285305
.command('add-l1-validator')
286306
.description('Adds a validator to the L1 rollup contract.')

yarn-project/cli/src/cmds/l1/update_l1_validators.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '@aztec/ethereum';
1111
import { EthCheatCodes } from '@aztec/ethereum/test';
1212
import type { EthAddress } from '@aztec/foundation/eth-address';
13+
import { jsonStringify } from '@aztec/foundation/json-rpc';
1314
import type { LogFn, Logger } from '@aztec/foundation/log';
1415
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
1516
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
@@ -51,6 +52,35 @@ export function generateL1Account() {
5152
};
5253
}
5354

55+
export async function makeRegistrationTuple({
56+
l1RpcUrls,
57+
l1ChainId,
58+
rollupAddress,
59+
blsSecretKey,
60+
}: {
61+
l1RpcUrls: string[];
62+
l1ChainId: number;
63+
rollupAddress: EthAddress;
64+
blsSecretKey: bigint; // scalar field element of BN254
65+
} & LoggerArgs) {
66+
console.log(l1ChainId, l1RpcUrls, rollupAddress, blsSecretKey);
67+
const publicClient = getPublicClient({ l1RpcUrls, l1ChainId });
68+
69+
const rollup = getContract({
70+
address: rollupAddress.toString(),
71+
abi: RollupAbi,
72+
client: publicClient,
73+
});
74+
75+
const gseAddress = await rollup.read.getGSE();
76+
77+
const gse = new GSEContract(publicClient, gseAddress);
78+
79+
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
80+
console.log(`Registration tuple: ${jsonStringify(registrationTuple)}`);
81+
return registrationTuple;
82+
}
83+
5484
export async function addL1Validator({
5585
rpcUrls,
5686
chainId,

0 commit comments

Comments
 (0)