Skip to content

Commit a8e6d35

Browse files
committed
Try/catch L1 contract deploy
1 parent 7595e00 commit a8e6d35

File tree

3 files changed

+51
-15
lines changed

3 files changed

+51
-15
lines changed

yarn-project/cli/src/cmds/devnet/bootstrap_network.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ async function deployERC20(l1Client: ExtendedViemWalletClient) {
140140
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
141141

142142
const erc20: ContractArtifacts = {
143+
name: 'TestERC20',
143144
contractAbi: TestERC20Abi,
144145
contractBytecode: TestERC20Bytecode,
145146
};
146147
const portal: ContractArtifacts = {
148+
name: 'TokenPortal',
147149
contractAbi: TokenPortalAbi,
148150
contractBytecode: TokenPortalBytecode,
149151
};

yarn-project/ethereum/src/deploy_l1_contracts.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {
6262
getL1TxUtilsConfigEnvVars,
6363
} from './l1_tx_utils.js';
6464
import type { ExtendedViemWalletClient } from './types.js';
65+
import { formatViemError } from './utils.js';
6566
import { ZK_PASSPORT_SCOPE, ZK_PASSPORT_SUB_SCOPE, ZK_PASSPORT_VERIFIER_ADDRESS } from './zkPassportVerifierAddress.js';
6667

6768
export const DEPLOYER_ADDRESS: Hex = '0x4e59b44847b379578588920cA78FbF26c0B4956C';
@@ -103,6 +104,10 @@ export interface Libraries {
103104
* Contract artifacts
104105
*/
105106
export interface ContractArtifacts {
107+
/**
108+
* The contract name.
109+
*/
110+
name: string;
106111
/**
107112
* The contract abi.
108113
*/
@@ -155,7 +160,7 @@ export const deploySharedContracts = async (
155160
args: DeployL1ContractsArgs,
156161
logger: Logger,
157162
) => {
158-
logger.info(`Deploying shared contracts. Network configration: ${networkName}`);
163+
logger.info(`Deploying shared contracts for network configration: ${networkName}`);
159164

160165
const txHashes: Hex[] = [];
161166

@@ -998,21 +1003,27 @@ export class L1Deployer {
9981003
}
9991004

10001005
async deploy(params: ContractArtifacts, args: readonly unknown[] = []): Promise<EthAddress> {
1001-
const { txHash, address } = await deployL1Contract(
1002-
this.client,
1003-
params.contractAbi,
1004-
params.contractBytecode,
1005-
args,
1006-
this.salt,
1007-
params.libraries,
1008-
this.logger,
1009-
this.l1TxUtils,
1010-
this.acceleratedTestDeployments,
1011-
);
1012-
if (txHash) {
1013-
this.txHashes.push(txHash);
1006+
this.logger.debug(`Deploying ${params.name} contract`, { args });
1007+
try {
1008+
const { txHash, address } = await deployL1Contract(
1009+
this.client,
1010+
params.contractAbi,
1011+
params.contractBytecode,
1012+
args,
1013+
this.salt,
1014+
params.libraries,
1015+
this.logger,
1016+
this.l1TxUtils,
1017+
this.acceleratedTestDeployments,
1018+
);
1019+
if (txHash) {
1020+
this.txHashes.push(txHash);
1021+
}
1022+
this.logger.debug(`Deployed ${params.name} at ${address}`, { args });
1023+
return address;
1024+
} catch (error) {
1025+
throw new Error(`Failed to deploy ${params.name}`, { cause: formatViemError(error) });
10141026
}
1015-
return address;
10161027
}
10171028

10181029
async waitForDeployments(): Promise<void> {

yarn-project/ethereum/src/l1_artifacts.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,42 @@ import {
4949
import type { Hex } from 'viem';
5050

5151
export const RegistryArtifact = {
52+
name: 'Registry',
5253
contractAbi: RegistryAbi,
5354
contractBytecode: RegistryBytecode as Hex,
5455
};
5556

5657
export const InboxArtifact = {
58+
name: 'Inbox',
5759
contractAbi: InboxAbi,
5860
contractBytecode: InboxBytecode as Hex,
5961
};
6062

6163
export const OutboxArtifact = {
64+
name: 'Outbox',
6265
contractAbi: OutboxAbi,
6366
contractBytecode: OutboxBytecode as Hex,
6467
};
6568

6669
export const RollupArtifact = {
70+
name: 'Rollup',
6771
contractAbi: RollupAbi,
6872
contractBytecode: RollupBytecode as Hex,
6973
libraries: {
7074
linkReferences: RollupLinkReferences,
7175
libraryCode: {
7276
ValidatorSelectionLib: {
77+
name: 'ValidatorSelectionLib',
7378
contractAbi: ValidatorSelectionLibAbi,
7479
contractBytecode: ValidatorSelectionLibBytecode as Hex,
7580
},
7681
ExtRollupLib: {
82+
name: 'ExtRollupLib',
7783
contractAbi: ExtRollupLibAbi,
7884
contractBytecode: ExtRollupLibBytecode as Hex,
7985
},
8086
ExtRollupLib2: {
87+
name: 'ExtRollupLib2',
8188
contractAbi: ExtRollupLib2Abi,
8289
contractBytecode: ExtRollupLib2Bytecode as Hex,
8390
},
@@ -86,82 +93,98 @@ export const RollupArtifact = {
8693
};
8794

8895
export const StakingAssetArtifact = {
96+
name: 'StakingAsset',
8997
contractAbi: TestERC20Abi,
9098
contractBytecode: TestERC20Bytecode as Hex,
9199
};
92100

93101
export const FeeAssetArtifact = {
102+
name: 'FeeAsset',
94103
contractAbi: TestERC20Abi,
95104
contractBytecode: TestERC20Bytecode as Hex,
96105
};
97106

98107
export const FeeJuicePortalArtifact = {
108+
name: 'FeeJuicePortal',
99109
contractAbi: FeeJuicePortalAbi,
100110
contractBytecode: FeeJuicePortalBytecode as Hex,
101111
};
102112

103113
export const RewardDistributorArtifact = {
114+
name: 'RewardDistributor',
104115
contractAbi: RewardDistributorAbi,
105116
contractBytecode: RewardDistributorBytecode as Hex,
106117
};
107118

108119
export const CoinIssuerArtifact = {
120+
name: 'CoinIssuer',
109121
contractAbi: CoinIssuerAbi,
110122
contractBytecode: CoinIssuerBytecode as Hex,
111123
};
112124

113125
export const GovernanceProposerArtifact = {
126+
name: 'GovernanceProposer',
114127
contractAbi: GovernanceProposerAbi,
115128
contractBytecode: GovernanceProposerBytecode as Hex,
116129
};
117130

118131
export const GovernanceArtifact = {
132+
name: 'Governance',
119133
contractAbi: GovernanceAbi,
120134
contractBytecode: GovernanceBytecode as Hex,
121135
};
122136

123137
export const SlashFactoryArtifact = {
138+
name: 'SlashFactory',
124139
contractAbi: SlashFactoryAbi,
125140
contractBytecode: SlashFactoryBytecode as Hex,
126141
};
127142

128143
export const RegisterNewRollupVersionPayloadArtifact = {
144+
name: 'RegisterNewRollupVersionPayload',
129145
contractAbi: RegisterNewRollupVersionPayloadAbi,
130146
contractBytecode: RegisterNewRollupVersionPayloadBytecode as Hex,
131147
};
132148

133149
export const FeeAssetHandlerArtifact = {
150+
name: 'FeeAssetHandler',
134151
contractAbi: FeeAssetHandlerAbi,
135152
contractBytecode: FeeAssetHandlerBytecode as Hex,
136153
};
137154

138155
export const StakingAssetHandlerArtifact = {
156+
name: 'StakingAssetHandler',
139157
contractAbi: StakingAssetHandlerAbi,
140158
contractBytecode: StakingAssetHandlerBytecode as Hex,
141159
};
142160

143161
export const MultiAdderArtifact = {
162+
name: 'MultiAdder',
144163
contractAbi: MultiAdderAbi,
145164
contractBytecode: MultiAdderBytecode as Hex,
146165
};
147166

148167
export const GSEArtifact = {
168+
name: 'GSE',
149169
contractAbi: GSEAbi,
150170
contractBytecode: GSEBytecode as Hex,
151171
};
152172

153173
// Verifier artifacts
154174
export const HonkVerifierArtifact = {
175+
name: 'HonkVerifier',
155176
contractAbi: HonkVerifierAbi,
156177
contractBytecode: HonkVerifierBytecode as Hex,
157178
};
158179

159180
export const MockVerifierArtifact = {
181+
name: 'MockVerifier',
160182
contractAbi: MockVerifierAbi,
161183
contractBytecode: MockVerifierBytecode as Hex,
162184
};
163185

164186
export const MockZkPassportVerifierArtifact = {
187+
name: 'MockZkPassportVerifier',
165188
contractAbi: MockZKPassportVerifierAbi,
166189
contractBytecode: MockZKPassportVerifierBytecode as Hex,
167190
};

0 commit comments

Comments
 (0)