11import { describe , it , expect } from 'vitest' ;
2- import { createPublicClient , http , parseGwei , zeroAddress } from 'viem' ;
2+ import { Address , createPublicClient , http , parseGwei , zeroAddress } from 'viem' ;
33
44import { nitroTestnodeL2 } from './chains' ;
55import {
@@ -8,17 +8,32 @@ import {
88 getInformationFromTestnode ,
99} from './testHelpers' ;
1010import { createRollupFetchTransactionHash } from './createRollupFetchTransactionHash' ;
11+ import { isAnvilIntegrationTestMode } from './integrationTestHelpers/injectedMode' ;
12+ import { getInitializedAnvilTestStackEnv } from './integrationTestHelpers/anvilHarness' ;
13+ import { PrivateKeyAccountWithPrivateKey } from './testHelpers' ;
14+
15+ const env = isAnvilIntegrationTestMode ( ) ? getInitializedAnvilTestStackEnv ( ) : undefined ;
1116
1217const parentChainPublicClient = createPublicClient ( {
13- chain : nitroTestnodeL2 ,
18+ chain : env ? env . l2 . chain : nitroTestnodeL2 ,
1419 transport : http ( ) ,
1520} ) ;
1621
22+ let l3TokenBridgeDeployer : PrivateKeyAccountWithPrivateKey ;
23+ let batchPosters : Address [ ] ;
24+ let validators : Address [ ] ;
25+
1726// test inputs
18- const testnodeAccounts = getNitroTestnodePrivateKeyAccounts ( ) ;
19- const l3TokenBridgeDeployer = testnodeAccounts . l3TokenBridgeDeployer ;
20- const batchPosters = [ testnodeAccounts . deployer . address ] ;
21- const validators = [ testnodeAccounts . deployer . address ] ;
27+ if ( env ) {
28+ l3TokenBridgeDeployer = env . l3 . accounts . tokenBridgeDeployer ;
29+ batchPosters = [ env . l2 . accounts . deployer . address ] ;
30+ validators = [ env . l2 . accounts . deployer . address ] ;
31+ } else {
32+ const testnodeAccounts = getNitroTestnodePrivateKeyAccounts ( ) ;
33+ l3TokenBridgeDeployer = testnodeAccounts . l3TokenBridgeDeployer ;
34+ batchPosters = [ testnodeAccounts . deployer . address ] ;
35+ validators = [ testnodeAccounts . deployer . address ] ;
36+ }
2237
2338describe ( `create an AnyTrust chain that uses ETH as gas token` , async ( ) => {
2439 const { createRollupConfig, createRollupInformation } = await createRollupHelper ( {
@@ -27,6 +42,8 @@ describe(`create an AnyTrust chain that uses ETH as gas token`, async () => {
2742 validators,
2843 nativeToken : zeroAddress ,
2944 client : parentChainPublicClient ,
45+ customParentTimingParams : env ?. l2 . timingParams ,
46+ maxDataSize : env ? 104_857n : undefined ,
3047 } ) ;
3148
3249 it ( `successfully deploys core contracts through rollup creator` , async ( ) => {
@@ -58,14 +75,16 @@ describe(`create an AnyTrust chain that uses ETH as gas token`, async () => {
5875} ) ;
5976
6077describe ( `create an AnyTrust chain that uses a custom gas token` , async ( ) => {
61- const nativeToken = getInformationFromTestnode ( ) . l3NativeToken ;
78+ const nativeToken = env ? env . l3 . nativeToken : getInformationFromTestnode ( ) . l3NativeToken ;
6279
6380 const { createRollupConfig, createRollupInformation } = await createRollupHelper ( {
6481 deployer : l3TokenBridgeDeployer ,
6582 batchPosters,
6683 validators,
6784 nativeToken,
6885 client : parentChainPublicClient ,
86+ customParentTimingParams : env ?. l2 . timingParams ,
87+ maxDataSize : env ? 104_857n : undefined ,
6988 } ) ;
7089
7190 it ( `successfully deploys core contracts through rollup creator` , async ( ) => {
0 commit comments