Commit 75b6b12a authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

deploy: fix relayer address config (#167)

parent 0cb732b1
...@@ -25,13 +25,14 @@ const HD_PATH = env.HD_PATH || utils.defaultPath; ...@@ -25,13 +25,14 @@ const HD_PATH = env.HD_PATH || utils.defaultPath;
const BLOCK_TIME_SECONDS = env.BLOCK_TIME_SECONDS || 15; const BLOCK_TIME_SECONDS = env.BLOCK_TIME_SECONDS || 15;
const L2_CROSS_DOMAIN_MESSENGER_ADDRESS = const L2_CROSS_DOMAIN_MESSENGER_ADDRESS =
env.L2_CROSS_DOMAIN_MESSENGER_ADDRESS || '0x4200000000000000000000000000000000000007'; env.L2_CROSS_DOMAIN_MESSENGER_ADDRESS || '0x4200000000000000000000000000000000000007';
let RELAYER_ADDRESS = env.RELAYER_ADDRESS || '0x0000000000000000000000000000000000000000';
const RELAYER_PRIVATE_KEY = env.RELAYER_PRIVATE_KEY;
(async () => { (async () => {
const provider = new JsonRpcProvider(web3Url); const provider = new JsonRpcProvider(web3Url);
let signer; let signer;
// Use the ledger for the deployer
if (USE_LEDGER) { if (USE_LEDGER) {
signer = new LedgerSigner(provider, 'default', HD_PATH); signer = new LedgerSigner(provider, 'default', HD_PATH);
} else { } else {
...@@ -42,17 +43,27 @@ const L2_CROSS_DOMAIN_MESSENGER_ADDRESS = ...@@ -42,17 +43,27 @@ const L2_CROSS_DOMAIN_MESSENGER_ADDRESS =
if (SEQUENCER_ADDRESS) { if (SEQUENCER_ADDRESS) {
if (!utils.isAddress(SEQUENCER_ADDRESS)) if (!utils.isAddress(SEQUENCER_ADDRESS))
throw new Error(`Invalid Sequencer Address: ${SEQUENCER_ADDRESS}`) throw new Error(`Invalid Sequencer Address: ${SEQUENCER_ADDRESS}`);
} else { } else {
if (!sequencerKey) if (!sequencerKey)
throw new Error('Must pass sequencer key as SEQUENCER_PRIVATE_KEY'); throw new Error('Must pass sequencer key as SEQUENCER_PRIVATE_KEY');
const sequencer = new Wallet(sequencerKey, provider); const sequencer = new Wallet(sequencerKey, provider);
SEQUENCER_ADDRESS = await sequencer.getAddress() SEQUENCER_ADDRESS = await sequencer.getAddress();
} }
if (typeof WHITELIST_OWNER === 'undefined') if (typeof WHITELIST_OWNER === 'undefined')
WHITELIST_OWNER = signer; WHITELIST_OWNER = signer;
// Use the address derived from RELAYER_PRIVATE_KEY if a private key
// is passed. Using the zero address as the relayer address will mean
// there is no relayer authentication.
if (RELAYER_PRIVATE_KEY) {
if (!utils.isAddress(RELAYER_ADDRESS))
throw new Error(`Invalid Relayer Address: ${RELAYER_ADDRESS}`);
const relayer = new Wallet(RELAYER_PRIVATE_KEY, provider);
RELAYER_ADDRESS = await relayer.getAddress();
}
const result = await contracts.deploy({ const result = await contracts.deploy({
deploymentSigner: signer, deploymentSigner: signer,
transactionChainConfig: { transactionChainConfig: {
...@@ -69,7 +80,7 @@ const L2_CROSS_DOMAIN_MESSENGER_ADDRESS = ...@@ -69,7 +80,7 @@ const L2_CROSS_DOMAIN_MESSENGER_ADDRESS =
L2CrossDomainMessengerAddress: L2_CROSS_DOMAIN_MESSENGER_ADDRESS L2CrossDomainMessengerAddress: L2_CROSS_DOMAIN_MESSENGER_ADDRESS
}, },
l1CrossDomainMessengerConfig: { l1CrossDomainMessengerConfig: {
relayerAddress: SEQUENCER_ADDRESS, relayerAddress: RELAYER_ADDRESS,
}, },
ovmGasMeteringConfig: { ovmGasMeteringConfig: {
minTransactionGasLimit: MIN_TRANSACTION_GAS_LIMIT, minTransactionGasLimit: MIN_TRANSACTION_GAS_LIMIT,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment