Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ function check_toolchains {
echo -e "${bold}${yellow}WARN: Rust ${rust_version} is not installed. Performance will be degraded.${reset}"
fi
# Check wasi-sdk version.
if ! cat /opt/wasi-sdk/VERSION 2> /dev/null | grep 27.0 > /dev/null; then
encourage_dev_container
echo "wasi-sdk-27 not found at /opt/wasi-sdk."
echo "Use dev container, build from source, or you can install linux x86 version with:"
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"
exit 1
fi
# if ! cat /opt/wasi-sdk/VERSION 2> /dev/null | grep 27.0 > /dev/null; then
# encourage_dev_container
# echo "wasi-sdk-27 not found at /opt/wasi-sdk."
# echo "Use dev container, build from source, or you can install linux x86 version with:"
# 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"
# exit 1
# fi
# Check foundry version.
local foundry_version="v1.3.3"
for tool in forge anvil; do
Expand Down
10 changes: 5 additions & 5 deletions l1-contracts/src/core/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ library Errors {
error Staking__CannotSlashExitedStake(address); // 0x45bf4940
error Staking__FailedToRemove(address); // 0xa7d7baab
error Staking__InvalidDeposit(address attester, address proposer); // 0xf33fe8c6
error Staking__InvalidRecipient(address); // 0x7e2f7f1c
error Staking__InvalidRecipient(address); // 0x4faf4233
error Staking__InsufficientStake(uint256, uint256); // 0x903aee24
error Staking__NoOneToSlash(address); // 0x7e2f7f1c
error Staking__NotExiting(address); // 0xef566ee0
Expand All @@ -140,14 +140,14 @@ library Errors {
error Staking__RollupAlreadyRegistered(address); // 0x108a39c8
error Staking__InvalidRollupAddress(address); // 0xd876720e
error Staking__NotCanonical(address); // 0x6244212e
error Staking__InstanceDoesNotExist(address);
error Staking__InstanceDoesNotExist(address); // 0x429f9c54
error Staking__InsufficientPower(uint256, uint256);
error Staking__AlreadyExiting(address);
error Staking__FatalError(string);
error Staking__AlreadyExiting(address); // 0x223622dc
error Staking__FatalError(string); // 0x5bdb08d8
error Staking__NotOurProposal(uint256, address, address);
error Staking__IncorrectGovProposer(uint256);
error Staking__GovernanceAlreadySet();
error Staking__InsufficientBootstrapValidators(uint256 queueSize, uint256 bootstrapFlushSize);
error Staking__InsufficientBootstrapValidators(uint256 queueSize, uint256 bootstrapFlushSize); // 0xa10528d9
error Staking__InvalidStakingQueueConfig();
error Staking__InvalidNormalFlushSizeQuotient();

Expand Down
24 changes: 22 additions & 2 deletions yarn-project/cli/src/cmds/l1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
pxeOption,
} from '../../utils/commands.js';

export { addL1Validator } from './update_l1_validators.js';
export { addL1Validator, makeRegistrationTuple } from './update_l1_validators.js';

const l1RpcUrlsOption = new Option(
'--l1-rpc-urls <string>',
Expand All @@ -25,7 +25,10 @@ const l1RpcUrlsOption = new Option(
.env('ETHEREUM_HOSTS')
.default([ETHEREUM_HOSTS])
.makeOptionMandatory(true)
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
.argParser((arg: string) => {
console.log(arg);
return arg.split(',').map(url => url.trim());
});

const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');

Expand Down Expand Up @@ -286,6 +289,23 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
log(JSON.stringify(account, null, 2));
});

program
.command('make-registration-tuple')
.description('Makes a registration tuple for a validator.')
.addOption(l1RpcUrlsOption)
.addOption(l1ChainIdOption)
.option('--rollup-address <address>', 'ethereum address of the rollup', parseEthereumAddress)
.option(
'--bls-secret-key <string>',
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
parseBigint,
)
.action(async options => {
console.log(options);
const { makeRegistrationTuple } = await import('./update_l1_validators.js');
await makeRegistrationTuple(options);
});

program
.command('add-l1-validator')
.description('Adds a validator to the L1 rollup contract via a direct deposit.')
Expand Down
30 changes: 30 additions & 0 deletions yarn-project/cli/src/cmds/l1/update_l1_validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@aztec/ethereum';
import { EthCheatCodes } from '@aztec/ethereum/test';
import type { EthAddress } from '@aztec/foundation/eth-address';
import { jsonStringify } from '@aztec/foundation/json-rpc';
import type { LogFn, Logger } from '@aztec/foundation/log';
import { DateProvider } from '@aztec/foundation/timer';
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
Expand Down Expand Up @@ -52,6 +53,35 @@ export function generateL1Account() {
};
}

export async function makeRegistrationTuple({
l1RpcUrls,
l1ChainId,
rollupAddress,
blsSecretKey,
}: {
l1RpcUrls: string[];
l1ChainId: number;
rollupAddress: EthAddress;
blsSecretKey: bigint; // scalar field element of BN254
} & LoggerArgs) {
console.log(l1ChainId, l1RpcUrls, rollupAddress, blsSecretKey);
const publicClient = getPublicClient({ l1RpcUrls, l1ChainId });

const rollup = getContract({
address: rollupAddress.toString(),
abi: RollupAbi,
client: publicClient,
});

const gseAddress = await rollup.read.getGSE();

const gse = new GSEContract(publicClient, gseAddress);

const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
console.log(`Registration tuple: ${jsonStringify(registrationTuple)}`);
return registrationTuple;
}

export async function addL1Validator({
rpcUrls,
chainId,
Expand Down
Loading