Skip to content

Commit 92c7760

Browse files
authored
Network.ts - script hangs when reassigning w/ ContractFactory::deploy
Local bridging script hangs indefinitely while waiting for the `InterchainTokenFactoryContract` deployment. This is likely due to the fact that the `ethersJS::Contract::deployed()` method is invoked twice for the same variable, `implementation`. EthersJS seems to get confused when using `let implementation = await deployContract(<InterchainTokenServiceContract>)` and then reassigning like so: `implementation = await deployContract(<InterchainTokenFactoryContract>)` since `deployContract()` calls `await contract.deployed()` Using a single const variable for each contract returned by `deployContract()` resolved the issue, as made in this PR
1 parent c5e02a6 commit 92c7760

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/axelar-local-dev/src/Network.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export class Network {
238238
const tokenHandler = await deployContract(wallet, TokenHandler, []);
239239
const interchainTokenFactoryAddress = await this.create3Deployer.deployedAddress('0x', wallet.address, factorySalt);
240240

241-
let implementation = await deployContract(wallet, InterchainTokenServiceContract, [
241+
const tokenServiceImplementation = await deployContract(wallet, InterchainTokenServiceContract, [
242242
tokenManagerDeployer.address,
243243
interchainTokenDeployer.address,
244244
this.gateway.address,
@@ -250,16 +250,16 @@ export class Network {
250250
]);
251251
const factory = new ContractFactory(InterchainProxy.abi, InterchainProxy.bytecode);
252252
let bytecode = factory.getDeployTransaction(
253-
implementation.address,
253+
tokenServiceImplementation.address,
254254
wallet.address,
255255
defaultAbiCoder.encode(['address', 'string', 'string[]', 'string[]'], [wallet.address, this.name, [], []])
256256
).data;
257257
await this.create3Deployer.connect(wallet).deploy(bytecode, deploymentSalt);
258258
this.interchainTokenService = InterchainTokenServiceFactory.connect(interchainTokenServiceAddress, wallet);
259259

260-
implementation = await deployContract(wallet, InterchainTokenFactoryContract, [interchainTokenServiceAddress]);
260+
const tokenFactoryImplementation = await deployContract(wallet, InterchainTokenFactoryContract, [interchainTokenServiceAddress]);
261261

262-
bytecode = factory.getDeployTransaction(implementation.address, wallet.address, '0x').data;
262+
bytecode = factory.getDeployTransaction(tokenFactoryImplementation.address, wallet.address, '0x').data;
263263

264264
await this.create3Deployer.connect(wallet).deploy(bytecode, factorySalt);
265265
this.interchainTokenFactory = InterchainTokenFactoryFactory.connect(interchainTokenFactoryAddress, wallet);

0 commit comments

Comments
 (0)