Skip to content

Commit

Permalink
Change EVM emulation activation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Dec 18, 2024
1 parent 93e8e2a commit d8ed659
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
7 changes: 5 additions & 2 deletions infrastructure/zk/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,12 @@ export async function erc20BridgeFinish(args: any[] = []): Promise<void> {

export async function registerHyperchain({
baseTokenName,
deploymentMode
deploymentMode,
allowEvmEmulator
}: {
baseTokenName?: string;
deploymentMode?: DeploymentMode;
allowEvmEmulator?: boolean;
}): Promise<void> {
await utils.confirmAction();

Expand All @@ -241,7 +243,8 @@ export async function registerHyperchain({
privateKey ? `--private-key ${privateKey}` : '',
baseTokenName ? `--base-token-name ${baseTokenName}` : '',
deploymentMode == DeploymentMode.Validium ? '--validium-mode' : '',
tokenMultiplierSetterAddress ? `--token-multiplier-setter-address ${tokenMultiplierSetterAddress}` : ''
tokenMultiplierSetterAddress ? `--token-multiplier-setter-address ${tokenMultiplierSetterAddress}` : '',
allowEvmEmulator ? '--allow-evm-emulation' : ''
];
await utils.spawn(`yarn l1-contracts register-hyperchain ${args.join(' ')} | tee registerHyperchain.log`);
const deployLog = fs.readFileSync('registerHyperchain.log').toString();
Expand Down
22 changes: 16 additions & 6 deletions infrastructure/zk/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ type InitHyperchainOptions = {
baseTokenName?: string;
localLegacyBridgeTesting?: boolean;
deploymentMode: DeploymentMode;
allowEvmEmulator?: boolean
};
const initHyperchain = async ({
includePaymaster,
baseTokenName,
localLegacyBridgeTesting,
deploymentMode
deploymentMode,
allowEvmEmulator
}: InitHyperchainOptions): Promise<void> => {
await announced('Registering Hyperchain', contract.registerHyperchain({ baseTokenName, deploymentMode }));
await announced('Registering Hyperchain', contract.registerHyperchain({ baseTokenName, deploymentMode, allowEvmEmulator}));
await announced('Reloading env', env.reload());
await announced('Running server genesis setup', server.genesisFromSources());
await announced(
Expand Down Expand Up @@ -146,6 +148,7 @@ type InitDevCmdActionOptions = InitSetupOptions & {
validiumMode?: boolean;
localLegacyBridgeTesting?: boolean;
shouldCheckPostgres: boolean; // Whether to perform `cargo sqlx prepare --check`
allowEvmEmulator?: boolean;
};
export const initDevCmdAction = async ({
skipEnvSetup,
Expand All @@ -157,7 +160,8 @@ export const initDevCmdAction = async ({
runObservability,
validiumMode,
localLegacyBridgeTesting,
shouldCheckPostgres
shouldCheckPostgres,
allowEvmEmulator
}: InitDevCmdActionOptions): Promise<void> => {
if (localLegacyBridgeTesting) {
await makeEraChainIdSameAsCurrent();
Expand All @@ -181,7 +185,8 @@ export const initDevCmdAction = async ({
includePaymaster: true,
baseTokenName,
localLegacyBridgeTesting,
deploymentMode
deploymentMode,
allowEvmEmulator
});
if (localLegacyBridgeTesting) {
await makeEraAddressSameAsCurrent();
Expand Down Expand Up @@ -214,13 +219,15 @@ type InitHyperCmdActionOptions = {
baseTokenName?: string;
runObservability: boolean;
deploymentMode: DeploymentMode;
allowEvmEmulator?: boolean;
};
export const initHyperCmdAction = async ({
skipSetupCompletely,
bumpChainId,
baseTokenName,
runObservability,
deploymentMode
deploymentMode,
allowEvmEmulator
}: InitHyperCmdActionOptions): Promise<void> => {
if (bumpChainId) {
config.bumpChainId();
Expand All @@ -237,7 +244,8 @@ export const initHyperCmdAction = async ({
await initHyperchain({
includePaymaster: true,
baseTokenName,
deploymentMode
deploymentMode,
allowEvmEmulator
});
};

Expand All @@ -254,6 +262,7 @@ export const initCommand = new Command('init')
'used to test LegacyBridge compatibily. The chain will have the same id as the era chain id, while eraChainId in L2SharedBridge will be 0'
)
.option('--should-check-postgres', 'Whether to perform cargo sqlx prepare --check during database setup', true)
.option('--allow-evm-emulator', 'allow deployment of EVM contracts')
.description('Deploys the shared bridge and registers a hyperchain locally, as quickly as possible.')
.action(initDevCmdAction);

Expand All @@ -278,4 +287,5 @@ initCommand
.option('--base-token-name <base-token-name>', 'base token name')
.option('--validium-mode', 'deploy contracts in Validium mode')
.option('--run-observability', 'run observability suite')
.option('--allow-evm-emulator', 'allow deployment of EVM contracts')
.action(initHyperCmdAction);

0 comments on commit d8ed659

Please sign in to comment.