11import { describe , it , expect } from 'vitest' ;
2- import { createPublicClient , http , parseGwei , zeroAddress } from 'viem' ;
2+ import { type Address , createPublicClient , http , parseGwei , zeroAddress } from 'viem' ;
33
44import { nitroTestnodeL2 } from './chains' ;
55import {
66 createRollupHelper ,
77 getNitroTestnodePrivateKeyAccounts ,
88 getInformationFromTestnode ,
9+ type PrivateKeyAccountWithPrivateKey ,
910} from './testHelpers' ;
1011import { createRollupFetchTransactionHash } from './createRollupFetchTransactionHash' ;
12+ import { getInitializedAnvilTestStackEnv } from './integrationTestHelpers/anvilHarness' ;
13+ import { isAnvilIntegrationTestMode } from './integrationTestHelpers/injectedMode' ;
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
17- // test inputs
18- const testnodeAccounts = getNitroTestnodePrivateKeyAccounts ( ) ;
19- const l3TokenBridgeDeployer = testnodeAccounts . l3TokenBridgeDeployer ;
20- const batchPosters = [ testnodeAccounts . deployer . address ] ;
21- const validators = [ testnodeAccounts . deployer . address ] ;
22+ let l3TokenBridgeDeployer : PrivateKeyAccountWithPrivateKey ;
23+ let batchPosters : Address [ ] ;
24+ let validators : Address [ ] ;
25+
26+ if ( env ) {
27+ l3TokenBridgeDeployer = env . l3 . accounts . tokenBridgeDeployer ;
28+ batchPosters = [ env . l2 . accounts . deployer . address ] ;
29+ validators = [ env . l2 . accounts . deployer . address ] ;
30+ } else {
31+ const testnodeAccounts = getNitroTestnodePrivateKeyAccounts ( ) ;
32+ l3TokenBridgeDeployer = testnodeAccounts . l3TokenBridgeDeployer ;
33+ batchPosters = [ testnodeAccounts . deployer . address ] ;
34+ validators = [ testnodeAccounts . deployer . address ] ;
35+ }
2236
2337describe ( `create an AnyTrust chain that uses ETH as gas token` , async ( ) => {
2438 const { createRollupConfig, createRollupInformation } = await createRollupHelper ( {
@@ -27,6 +41,8 @@ describe(`create an AnyTrust chain that uses ETH as gas token`, async () => {
2741 validators,
2842 nativeToken : zeroAddress ,
2943 client : parentChainPublicClient ,
44+ customParentTimingParams : env ?. l2 . timingParams ,
45+ maxDataSize : env ? 104_857n : undefined ,
3046 } ) ;
3147
3248 it ( `successfully deploys core contracts through rollup creator` , async ( ) => {
@@ -58,14 +74,16 @@ describe(`create an AnyTrust chain that uses ETH as gas token`, async () => {
5874} ) ;
5975
6076describe ( `create an AnyTrust chain that uses a custom gas token` , async ( ) => {
61- const nativeToken = getInformationFromTestnode ( ) . l3NativeToken ;
77+ const nativeToken = env ? env . l3 . nativeToken : getInformationFromTestnode ( ) . l3NativeToken ;
6278
6379 const { createRollupConfig, createRollupInformation } = await createRollupHelper ( {
6480 deployer : l3TokenBridgeDeployer ,
6581 batchPosters,
6682 validators,
6783 nativeToken,
6884 client : parentChainPublicClient ,
85+ customParentTimingParams : env ?. l2 . timingParams ,
86+ maxDataSize : env ? 104_857n : undefined ,
6987 } ) ;
7088
7189 it ( `successfully deploys core contracts through rollup creator` , async ( ) => {
0 commit comments