@aztec/ethereum 3.0.0-devnet.2 → 3.0.0-devnet.20251212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/account.d.ts +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +1 -1
- package/dest/config.d.ts +7 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +55 -17
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +6 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +5 -4
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +8 -2
- package/dest/contracts/errors.d.ts +1 -1
- package/dest/contracts/errors.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +1 -1
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +16 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.d.ts +5 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +8 -2
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +1 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/index.d.ts +1 -1
- package/dest/contracts/multicall.d.ts +2 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +55 -64
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +76 -67
- package/dest/contracts/slasher_contract.d.ts +1 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts +9 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +4 -4
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_l1_contracts.d.ts +456 -9
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +68 -37
- package/dest/eth-signer/eth-signer.d.ts +1 -1
- package/dest/eth-signer/index.d.ts +1 -1
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/l1_artifacts.d.ts +6400 -872
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +3 -3
- package/dest/l1_reader.d.ts +3 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +6 -0
- package/dest/l1_tx_utils/config.d.ts +5 -5
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +32 -9
- package/dest/l1_tx_utils/constants.d.ts +1 -1
- package/dest/l1_tx_utils/factory.d.ts +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +1 -1
- package/dest/l1_tx_utils/interfaces.d.ts +2 -2
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +1 -2
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +17 -4
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +1 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +29 -16
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +171 -34
- package/dest/l1_tx_utils/signer.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/utils.d.ts +1 -1
- package/dest/l1_types.d.ts +1 -1
- package/dest/publisher_manager.d.ts +1 -1
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +5 -3
- package/dest/test/chain_monitor.d.ts +27 -24
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +32 -34
- package/dest/test/delayed_tx_utils.d.ts +1 -1
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.d.ts +8 -12
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +9 -3
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -1
- package/dest/test/rollup_cheat_codes.d.ts +14 -13
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +43 -38
- package/dest/test/start_anvil.d.ts +2 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +2 -1
- package/dest/test/tx_delayer.d.ts +1 -1
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +3 -2
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +2 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/package.json +27 -13
- package/src/config.ts +62 -18
- package/src/contracts/empire_base.ts +6 -5
- package/src/contracts/empire_slashing_proposer.ts +11 -5
- package/src/contracts/governance_proposer.ts +11 -5
- package/src/contracts/rollup.ts +81 -80
- package/src/contracts/tally_slashing_proposer.ts +11 -8
- package/src/deploy_l1_contracts.ts +63 -32
- package/src/forwarder_proxy.ts +108 -0
- package/src/l1_reader.ts +8 -0
- package/src/l1_tx_utils/config.ts +34 -13
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_tx_utils.ts +24 -4
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +223 -38
- package/src/queries.ts +6 -3
- package/src/test/chain_monitor.ts +50 -48
- package/src/test/eth_cheat_codes.ts +8 -2
- package/src/test/rollup_cheat_codes.ts +44 -42
- package/src/test/start_anvil.ts +2 -0
- package/src/test/tx_delayer.ts +4 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +1 -1
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/src/index.ts +0 -17
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
3
|
-
import { keccak256String } from '@aztec/foundation/crypto';
|
|
4
|
+
import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
6
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
8
|
-
import
|
|
9
|
+
import fs from 'fs';
|
|
9
10
|
import chunk from 'lodash.chunk';
|
|
10
11
|
import { concatHex, encodeAbiParameters, encodeDeployData, encodeFunctionData, getAddress, getContract, getContractAddress, numberToHex, padHex } from 'viem';
|
|
11
12
|
import { foundry } from 'viem/chains';
|
|
@@ -123,6 +124,26 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
123
124
|
]);
|
|
124
125
|
feeAssetAddress = deployedFee.address;
|
|
125
126
|
logger.verbose(`Deployed Fee Asset at ${feeAssetAddress}`);
|
|
127
|
+
// Mint a tiny bit of tokens to satisfy coin-issuer constraints
|
|
128
|
+
const { txHash } = await deployer.sendTransaction({
|
|
129
|
+
to: feeAssetAddress.toString(),
|
|
130
|
+
data: encodeFunctionData({
|
|
131
|
+
abi: FeeAssetArtifact.contractAbi,
|
|
132
|
+
functionName: 'mint',
|
|
133
|
+
args: [
|
|
134
|
+
l1Client.account.address,
|
|
135
|
+
1n * 10n ** 18n
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
}, {
|
|
139
|
+
// contract may not have been deployed yet (CREATE2 returns address before mining),
|
|
140
|
+
// which causes gas estimation to fail. Hardcode to 100k which is plenty for ERC20 mint.
|
|
141
|
+
gasLimit: 100_000n
|
|
142
|
+
});
|
|
143
|
+
await l1Client.waitForTransactionReceipt({
|
|
144
|
+
hash: txHash
|
|
145
|
+
});
|
|
146
|
+
logger.verbose(`Minted tiny bit of tokens to satisfy coin-issuer constraints in ${txHash}`);
|
|
126
147
|
const deployedStaking = await deployer.deploy(StakingAssetArtifact, [
|
|
127
148
|
'Staking',
|
|
128
149
|
'STK',
|
|
@@ -193,11 +214,16 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
193
214
|
logger.verbose(`Set governance on GSE in ${txHash}`);
|
|
194
215
|
txHashes.push(txHash);
|
|
195
216
|
}
|
|
217
|
+
logger.verbose(`Waiting for deployments to complete`);
|
|
218
|
+
await deployer.waitForDeployments();
|
|
196
219
|
const coinIssuerAddress = (await deployer.deploy(CoinIssuerArtifact, [
|
|
197
220
|
feeAssetAddress.toString(),
|
|
198
221
|
2n * 10n ** 17n,
|
|
199
222
|
l1Client.account.address
|
|
200
|
-
]
|
|
223
|
+
], {
|
|
224
|
+
gasLimit: 1_000_000n,
|
|
225
|
+
noSimulation: true
|
|
226
|
+
})).address;
|
|
201
227
|
logger.verbose(`Deployed CoinIssuer at ${coinIssuerAddress}`);
|
|
202
228
|
logger.verbose(`Waiting for deployments to complete`);
|
|
203
229
|
await deployer.waitForDeployments();
|
|
@@ -207,14 +233,15 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
207
233
|
let zkPassportVerifierAddress = undefined;
|
|
208
234
|
// Only if not on mainnet will we deploy the handlers, and only when we control the token
|
|
209
235
|
if (l1Client.chain.id !== 1 && !args.existingTokenAddress) {
|
|
210
|
-
/* -------------------------------------------------------------------------- */ /* CHEAT CODES START HERE */ /* -------------------------------------------------------------------------- */
|
|
236
|
+
/* -------------------------------------------------------------------------- */ /* CHEAT CODES START HERE */ /* -------------------------------------------------------------------------- */ const deployedFeeAssetHandler = await deployer.deploy(FeeAssetHandlerArtifact, [
|
|
211
237
|
l1Client.account.address,
|
|
212
238
|
feeAssetAddress.toString(),
|
|
213
239
|
BigInt(1000n * 10n ** 18n)
|
|
214
|
-
])
|
|
240
|
+
]);
|
|
241
|
+
feeAssetHandlerAddress = deployedFeeAssetHandler.address;
|
|
215
242
|
logger.verbose(`Deployed FeeAssetHandler at ${feeAssetHandlerAddress}`);
|
|
216
|
-
// Only
|
|
217
|
-
if (
|
|
243
|
+
// Only add as minter if this is a new deployment (not reusing existing handler from failed previous run)
|
|
244
|
+
if (!deployedFeeAssetHandler.existed) {
|
|
218
245
|
const { txHash } = await deployer.sendTransaction({
|
|
219
246
|
to: feeAssetAddress.toString(),
|
|
220
247
|
data: encodeFunctionData({
|
|
@@ -284,8 +311,8 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
284
311
|
const registry = new RegistryContract(l1Client, registryAddress);
|
|
285
312
|
/* -------------------------------------------------------------------------- */ /* FUND REWARD DISTRIBUTOR START */ /* -------------------------------------------------------------------------- */ const rewardDistributorAddress = await registry.getRewardDistributor();
|
|
286
313
|
if (!args.existingTokenAddress) {
|
|
287
|
-
const
|
|
288
|
-
const funding =
|
|
314
|
+
const checkpointReward = getRewardConfig(networkName).checkpointReward;
|
|
315
|
+
const funding = checkpointReward * 200000n;
|
|
289
316
|
const { txHash: fundRewardDistributorTxHash } = await deployer.sendTransaction({
|
|
290
317
|
to: feeAssetAddress.toString(),
|
|
291
318
|
data: encodeFunctionData({
|
|
@@ -534,7 +561,7 @@ const getZkPassportVerifierAddress = async (deployer, args)=>{
|
|
|
534
561
|
const date = new Date();
|
|
535
562
|
const formattedDate = date.toISOString().slice(2, 19).replace(/[-T:]/g, '');
|
|
536
563
|
// Ensure the verification output directory exists
|
|
537
|
-
await mkdir(outputDirectory, {
|
|
564
|
+
await fs.promises.mkdir(outputDirectory, {
|
|
538
565
|
recursive: true
|
|
539
566
|
});
|
|
540
567
|
const suffix = filenameSuffix ? `-${filenameSuffix}` : '';
|
|
@@ -545,7 +572,7 @@ const getZkPassportVerifierAddress = async (deployer, args)=>{
|
|
|
545
572
|
network: networkName,
|
|
546
573
|
records: deployer.verificationRecords
|
|
547
574
|
};
|
|
548
|
-
await writeFile(verificationOutputPath, JSON.stringify(verificationData, null, 2));
|
|
575
|
+
await fs.promises.writeFile(verificationOutputPath, JSON.stringify(verificationData, null, 2));
|
|
549
576
|
logger.info(`Wrote L1 verification data to ${verificationOutputPath}`);
|
|
550
577
|
} catch (e) {
|
|
551
578
|
logger.warn(`Failed to write L1 verification data file: ${String(e)}`);
|
|
@@ -628,7 +655,8 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
628
655
|
aztecSlotDuration: BigInt(args.aztecSlotDuration),
|
|
629
656
|
aztecEpochDuration: BigInt(args.aztecEpochDuration),
|
|
630
657
|
targetCommitteeSize: BigInt(args.aztecTargetCommitteeSize),
|
|
631
|
-
|
|
658
|
+
lagInEpochsForValidatorSet: BigInt(args.lagInEpochsForValidatorSet),
|
|
659
|
+
lagInEpochsForRandao: BigInt(args.lagInEpochsForRandao),
|
|
632
660
|
aztecProofSubmissionEpochs: BigInt(args.aztecProofSubmissionEpochs),
|
|
633
661
|
slashingQuorum: BigInt(args.slashingQuorum ?? args.slashingRoundSizeInEpochs * args.aztecEpochDuration / 2 + 1),
|
|
634
662
|
slashingRoundSize: BigInt(args.slashingRoundSizeInEpochs * args.aztecEpochDuration),
|
|
@@ -1133,8 +1161,8 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
1133
1161
|
try {
|
|
1134
1162
|
// Need to get the time
|
|
1135
1163
|
const currentSlot = await rollup.getSlotNumber();
|
|
1136
|
-
if (
|
|
1137
|
-
const ts = Number(await rollup.getTimestampForSlot(
|
|
1164
|
+
if (currentSlot === 0) {
|
|
1165
|
+
const ts = Number(await rollup.getTimestampForSlot(SlotNumber(1)));
|
|
1138
1166
|
await rpcCall('evm_setNextBlockTimestamp', [
|
|
1139
1167
|
ts
|
|
1140
1168
|
]);
|
|
@@ -1142,7 +1170,7 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
1142
1170
|
1
|
|
1143
1171
|
]);
|
|
1144
1172
|
const currentSlot = await rollup.getSlotNumber();
|
|
1145
|
-
if (
|
|
1173
|
+
if (currentSlot !== 1) {
|
|
1146
1174
|
throw new Error(`Error jumping time: current slot is ${currentSlot}`);
|
|
1147
1175
|
}
|
|
1148
1176
|
logger.info(`Jumped to slot 1`);
|
|
@@ -1205,7 +1233,8 @@ export class L1Deployer {
|
|
|
1205
1233
|
logger: this.logger,
|
|
1206
1234
|
l1TxUtils: this.l1TxUtils,
|
|
1207
1235
|
acceleratedTestDeployments: this.acceleratedTestDeployments,
|
|
1208
|
-
gasLimit: opts.gasLimit
|
|
1236
|
+
gasLimit: opts.gasLimit,
|
|
1237
|
+
noSimulation: opts.noSimulation
|
|
1209
1238
|
});
|
|
1210
1239
|
if (txHash) {
|
|
1211
1240
|
this.txHashes.push(txHash);
|
|
@@ -1283,7 +1312,7 @@ export class L1Deployer {
|
|
|
1283
1312
|
let txHash = undefined;
|
|
1284
1313
|
let resultingAddress = undefined;
|
|
1285
1314
|
const deployedLibraries = [];
|
|
1286
|
-
const { salt: saltFromOpts, libraries, logger, gasLimit, acceleratedTestDeployments } = opts;
|
|
1315
|
+
const { salt: saltFromOpts, libraries, logger, gasLimit, acceleratedTestDeployments, noSimulation } = opts;
|
|
1287
1316
|
let { l1TxUtils } = opts;
|
|
1288
1317
|
if (!l1TxUtils) {
|
|
1289
1318
|
const config = getL1TxUtilsConfigEnvVars();
|
|
@@ -1376,26 +1405,28 @@ export class L1Deployer {
|
|
|
1376
1405
|
address: resultingAddress
|
|
1377
1406
|
});
|
|
1378
1407
|
if (existing === undefined || existing === '0x') {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1408
|
+
if (!noSimulation) {
|
|
1409
|
+
try {
|
|
1410
|
+
await l1TxUtils.simulate({
|
|
1411
|
+
to: DEPLOYER_ADDRESS,
|
|
1412
|
+
data: concatHex([
|
|
1413
|
+
salt,
|
|
1414
|
+
calldata
|
|
1415
|
+
]),
|
|
1416
|
+
gas: gasLimit
|
|
1417
|
+
});
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
logger?.error(`Failed to simulate deployment tx using universal deployer`, err);
|
|
1420
|
+
await l1TxUtils.simulate({
|
|
1421
|
+
to: null,
|
|
1422
|
+
data: encodeDeployData({
|
|
1423
|
+
abi,
|
|
1424
|
+
bytecode,
|
|
1425
|
+
args
|
|
1426
|
+
}),
|
|
1427
|
+
gas: gasLimit
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1399
1430
|
}
|
|
1400
1431
|
const res = await l1TxUtils.sendTransaction({
|
|
1401
1432
|
to: DEPLOYER_ADDRESS,
|
|
@@ -18,4 +18,4 @@ export interface EthSigner {
|
|
|
18
18
|
/** Sign a transaction */
|
|
19
19
|
signTransaction(transaction: TransactionSerializable): Promise<Signature>;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXRoLXNpZ25lci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2V0aC1zaWduZXIvZXRoLXNpZ25lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLHVCQUF1QixFQUFFLG1CQUFtQixFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRXpFOztHQUVHO0FBQ0gsTUFBTSxXQUFXLFNBQVM7SUFDeEIsMkNBQTJDO0lBQzNDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsVUFBVSxDQUFDO0lBRTdCLG1FQUFtRTtJQUNuRSxXQUFXLENBQUMsT0FBTyxFQUFFLFFBQVEsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7SUFFbkQsb0NBQW9DO0lBQ3BDLGFBQWEsQ0FBQyxTQUFTLEVBQUUsbUJBQW1CLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBRWxFLHlCQUF5QjtJQUN6QixlQUFlLENBQUMsV0FBVyxFQUFFLHVCQUF1QixHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztDQUMzRSJ9
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './eth-signer.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ldGgtc2lnbmVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsaUJBQWlCLENBQUMifQ==
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
+
import type { ExtendedViemWalletClient } from './types.js';
|
|
4
|
+
export declare const FORWARDER_SOLIDITY_SOURCE = "\ncontract ForwarderProxy {\n function forward(address target, bytes calldata data) external payable returns (bytes memory) {\n (bool success, bytes memory result) = target.call{value: msg.value}(data);\n require(success, \"call failed\");\n return result;\n }\n}";
|
|
5
|
+
export declare const FORWARDER_ABI: readonly [{
|
|
6
|
+
readonly inputs: readonly [{
|
|
7
|
+
readonly internalType: "address";
|
|
8
|
+
readonly name: "target";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}, {
|
|
11
|
+
readonly internalType: "bytes";
|
|
12
|
+
readonly name: "data";
|
|
13
|
+
readonly type: "bytes";
|
|
14
|
+
}];
|
|
15
|
+
readonly name: "forward";
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly internalType: "bytes";
|
|
18
|
+
readonly name: "";
|
|
19
|
+
readonly type: "bytes";
|
|
20
|
+
}];
|
|
21
|
+
readonly stateMutability: "payable";
|
|
22
|
+
readonly type: "function";
|
|
23
|
+
}];
|
|
24
|
+
export declare const FORWARDER_BYTECODE: `0x${string}`;
|
|
25
|
+
/**
|
|
26
|
+
* Deploys the forwarder proxy contract to L1.
|
|
27
|
+
* @param client - The L1 client to use for deployment
|
|
28
|
+
* @param logger - Optional logger
|
|
29
|
+
* @returns The deployed forwarder contract address
|
|
30
|
+
*/
|
|
31
|
+
export declare function deployForwarderProxy(client: ExtendedViemWalletClient, logger?: Logger): Promise<EthAddress>;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9yd2FyZGVyX3Byb3h5LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZm9yd2FyZGVyX3Byb3h5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQVFwRCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUUzRCxlQUFPLE1BQU0seUJBQXlCLHVSQU9wQyxDQUFDO0FBRUgsZUFBTyxNQUFNLGFBQWE7Ozs7Ozs7Ozs7Ozs7Ozs7OztFQXlCaEIsQ0FBQztBQUVYLGVBQU8sTUFBTSxrQkFBa0IsZUFDbzZELENBQUM7QUFRcDhEOzs7OztHQUtHO0FBQ0gsd0JBQXNCLG9CQUFvQixDQUFDLE1BQU0sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQVVqSCJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarder_proxy.d.ts","sourceRoot":"","sources":["../src/forwarder_proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,yBAAyB,uRAOpC,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAyBhB,CAAC;AAEX,eAAO,MAAM,kBAAkB,eACo6D,CAAC;AAQp8D;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,wBAAwB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAUjH"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable no-console */ import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
+
import { extractChain } from 'viem';
|
|
4
|
+
import { anvil, mainnet, sepolia } from 'viem/chains';
|
|
5
|
+
import { L1Deployer } from './deploy_l1_contracts.js';
|
|
6
|
+
export const FORWARDER_SOLIDITY_SOURCE = `
|
|
7
|
+
contract ForwarderProxy {
|
|
8
|
+
function forward(address target, bytes calldata data) external payable returns (bytes memory) {
|
|
9
|
+
(bool success, bytes memory result) = target.call{value: msg.value}(data);
|
|
10
|
+
require(success, "call failed");
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
}`;
|
|
14
|
+
export const FORWARDER_ABI = [
|
|
15
|
+
{
|
|
16
|
+
inputs: [
|
|
17
|
+
{
|
|
18
|
+
internalType: 'address',
|
|
19
|
+
name: 'target',
|
|
20
|
+
type: 'address'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
internalType: 'bytes',
|
|
24
|
+
name: 'data',
|
|
25
|
+
type: 'bytes'
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
name: 'forward',
|
|
29
|
+
outputs: [
|
|
30
|
+
{
|
|
31
|
+
internalType: 'bytes',
|
|
32
|
+
name: '',
|
|
33
|
+
type: 'bytes'
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
stateMutability: 'payable',
|
|
37
|
+
type: 'function'
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
export const FORWARDER_BYTECODE = '0x6080604052348015600e575f5ffd5b506103bf8061001c5f395ff3fe60806040526004361061001d575f3560e01c80636fadcf7214610021575b5f5ffd5b61003b600480360381019061003691906101d0565b610051565b604051610048919061029d565b60405180910390f35b60605f5f8573ffffffffffffffffffffffffffffffffffffffff1634868660405161007d9291906102f9565b5f6040518083038185875af1925050503d805f81146100b7576040519150601f19603f3d011682016040523d82523d5f602084013e6100bc565b606091505b509150915081610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f89061036b565b60405180910390fd5b80925050509392505050565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61013e82610115565b9050919050565b61014e81610134565b8114610158575f5ffd5b50565b5f8135905061016981610145565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126101905761018f61016f565b5b8235905067ffffffffffffffff8111156101ad576101ac610173565b5b6020830191508360018202830111156101c9576101c8610177565b5b9250929050565b5f5f5f604084860312156101e7576101e661010d565b5b5f6101f48682870161015b565b935050602084013567ffffffffffffffff81111561021557610214610111565b5b6102218682870161017b565b92509250509250925092565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61026f8261022d565b6102798185610237565b9350610289818560208601610247565b61029281610255565b840191505092915050565b5f6020820190508181035f8301526102b58184610265565b905092915050565b5f81905092915050565b828183375f83830152505050565b5f6102e083856102bd565b93506102ed8385846102c7565b82840190509392505050565b5f6103058284866102d5565b91508190509392505050565b5f82825260208201905092915050565b7f63616c6c206661696c65640000000000000000000000000000000000000000005f82015250565b5f610355600b83610311565b915061036082610321565b602082019050919050565b5f6020820190508181035f83015261038281610349565b905091905056fea26469706673582212209a1c8cf638cf1569450a731ef9457b862f9e153b0a46e5555429bcf4dffd999564736f6c634300081e0033';
|
|
41
|
+
const FORWARDER_ARTIFACT = {
|
|
42
|
+
name: 'Forwarder',
|
|
43
|
+
contractAbi: FORWARDER_ABI,
|
|
44
|
+
contractBytecode: FORWARDER_BYTECODE
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Deploys the forwarder proxy contract to L1.
|
|
48
|
+
* @param client - The L1 client to use for deployment
|
|
49
|
+
* @param logger - Optional logger
|
|
50
|
+
* @returns The deployed forwarder contract address
|
|
51
|
+
*/ export async function deployForwarderProxy(client, logger) {
|
|
52
|
+
const log = logger ?? createLogger('ethereum:forwarder');
|
|
53
|
+
const nonce = await client.getTransactionCount({
|
|
54
|
+
address: client.account.address
|
|
55
|
+
});
|
|
56
|
+
const deployer = new L1Deployer(client, nonce, new DateProvider(), false, log, undefined, false);
|
|
57
|
+
log.info('Deploying forwarder proxy contract');
|
|
58
|
+
const deployment = await deployer.deploy(FORWARDER_ARTIFACT, []);
|
|
59
|
+
log.info(`Forwarder proxy deployed at ${deployment.address.toString()}`);
|
|
60
|
+
return deployment.address;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Main function for deploying the forwarder proxy from command line.
|
|
64
|
+
* Usage: node forwarder_proxy.js <private_key> <rpc_url>
|
|
65
|
+
*/ async function main() {
|
|
66
|
+
const args = process.argv.slice(2);
|
|
67
|
+
if (args.length < 3) {
|
|
68
|
+
console.error('Usage: node forwarder_proxy.js <private_key> <rpc_url> <chain_id>');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const [privateKey, rpcUrl, chainId] = args;
|
|
72
|
+
// Dynamic import to avoid pulling in dependencies at module load time
|
|
73
|
+
const { createExtendedL1Client } = await import('./client.js');
|
|
74
|
+
const client = createExtendedL1Client([
|
|
75
|
+
rpcUrl
|
|
76
|
+
], privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`, extractChain({
|
|
77
|
+
chains: [
|
|
78
|
+
mainnet,
|
|
79
|
+
sepolia,
|
|
80
|
+
anvil
|
|
81
|
+
],
|
|
82
|
+
id: parseInt(chainId)
|
|
83
|
+
}));
|
|
84
|
+
const address = await deployForwarderProxy(client);
|
|
85
|
+
console.log(`Forwarder proxy deployed at: ${address.toString()}`);
|
|
86
|
+
}
|
|
87
|
+
// Only run main if this is the entry point
|
|
88
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
89
|
+
main().catch((err)=>{
|
|
90
|
+
console.error('Failed to deploy forwarder proxy:', err);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
});
|
|
93
|
+
}
|