Skip to content

Commit

Permalink
feat(local-node): Added support for validium and custom base token (m…
Browse files Browse the repository at this point in the history
…atter-labs#1916)

## What ❔

* Added support for validium and custom base token for local node.
  • Loading branch information
mm-zk authored May 13, 2024
1 parent a215d71 commit 668b464
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
18 changes: 16 additions & 2 deletions docker/local-node/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,22 @@ else
zk contract initialize-validator
fi

## init hyperchain
zk contract register-hyperchain

if [ -z "$CUSTOM_BASE_TOKEN" ]; then
echo "Starting chain with ETH as gas token"

if [ -z "$VALIDIUM_MODE" ]; then
## init hyperchain in rollup mode
zk contract register-hyperchain
else
zk contract register-hyperchain --deployment-mode 1
fi
else
echo "Starting chain with custom gas token $CUSTOM_BASE_TOKEN"
zk contract register-hyperchain --base-token-name $CUSTOM_BASE_TOKEN
fi


zk f zksync_server --genesis

deploy_l2_args=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async function joinHyperchain() {
const varsToKeep = [
'CONTRACTS_BRIDGEHUB_PROXY_ADDR',
'CONTRACTS_STATE_TRANSITION_PROXY_ADDR',
'CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR',
'CONTRACTS_ADMIN_FACET_ADDR',
'CONTRACTS_MAILBOX_FACET_ADDR',
'CONTRACTS_EXECUTOR_FACET_ADDR',
Expand Down
9 changes: 4 additions & 5 deletions infrastructure/zk/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ export async function registerHyperchain({
const args = [
privateKey ? `--private-key ${privateKey}` : '',
baseTokenName ? `--base-token-name ${baseTokenName}` : '',
deploymentMode === DeploymentMode.Validium ? '--validium-mode' : ''
deploymentMode == DeploymentMode.Validium ? '--validium-mode' : ''
];

await utils.spawn(`yarn l1-contracts register-hyperchain ${args.join(' ')} | tee registerHyperchain.log`);
const deployLog = fs.readFileSync('registerHyperchain.log').toString();

Expand Down Expand Up @@ -312,9 +311,9 @@ command
command
.command('register-hyperchain')
.description('register hyperchain')
.action(() => {
registerHyperchain({});
});
.option('--base-token-name <base-token-name>', 'base token name')
.option('--deployment-mode <deployment-mode>', 'deploy contracts in Validium mode')
.action(registerHyperchain);
command
.command('deploy-l2-through-l1')
.description('deploy l2 through l1')
Expand Down

0 comments on commit 668b464

Please sign in to comment.