diff --git a/common/utils.js b/common/utils.js index 3aacb270..4d51ba8e 100644 --- a/common/utils.js +++ b/common/utils.js @@ -388,14 +388,18 @@ async function getDomainSeparator(config, chain, options) { throw new Error(`missing or invalid chain ID`); } - printInfo(`Retrieving domain separator for ${chain.name} from Axelar network`); - // const domainSeparator = hexlify((await getContractConfig(config, chain.axelarId)).domain_separator); const expectedDomainSeparator = calculateDomainSeparator(chain.axelarId, routerAddress, chainId); + if (options.domainSeparator === 'offline') { + printInfo('Computed domain separator offline') + return expectedDomainSeparator; + } - // TODO: add domain separator prediction support to display before amplifier contracts are ready - // if (domainSeparator !== expectedDomainSeparator) { - // throw new Error(`unexpected domain separator (want ${expectedDomainSeparator}, got ${domainSeparator})`); - // } + printInfo(`Retrieving domain separator for ${chain.name} from Axelar network`); + const domainSeparator = hexlify((await getContractConfig(config, chain.axelarId)).domain_separator); + + if (domainSeparator !== expectedDomainSeparator) { + throw new Error(`unexpected domain separator (want ${expectedDomainSeparator}, got ${domainSeparator})`); + } return expectedDomainSeparator; } diff --git a/sui/deploy-contract.js b/sui/deploy-contract.js index 09a91fb7..ff9cba48 100644 --- a/sui/deploy-contract.js +++ b/sui/deploy-contract.js @@ -327,7 +327,7 @@ const GATEWAY_CMD_OPTIONS = [ new Option('--minimumRotationDelay ', 'minium delay for signer rotations (in second)') .argParser((val) => parseInt(val) * 1000) .default(24 * 60 * 60), - new Option('--domainSeparator ', 'domain separator'), + new Option('--domainSeparator ', 'domain separator (pass in the keccak256 hash value OR "offline" meaning that its computed locally)'), new Option('--nonce ', 'nonce for the signer (defaults to HashZero)'), new Option('--previousSigners ', 'number of previous signers to retain').default('15'), ];