@@ -18,11 +18,9 @@ import (
1818
1919type CfgForkChainsOffChain struct {
2020 ContractsSrc * onchain.Input `toml:"contracts_src" validate:"required"`
21- ContractsDst * onchain.Input `toml:"contracts_dst" validate:"required"`
2221 BlockchainSrc * blockchain.Input `toml:"blockchain_src" validate:"required"`
23- BlockchainDst * blockchain.Input `toml:"blockchain_dst" validate:"required"`
2422 // off-chain components
25- NodeSet * ns.Input `toml:"nodeset " validate:"required"`
23+ NodeSets [] * ns.Input `toml:"nodesets " validate:"required"`
2624}
2725
2826func TestOffChainAndFork (t * testing.T ) {
@@ -33,9 +31,6 @@ func TestOffChainAndFork(t *testing.T) {
3331 bcSrc , err := blockchain .NewBlockchainNetwork (in .BlockchainSrc )
3432 require .NoError (t , err )
3533
36- bcDst , err := blockchain .NewBlockchainNetwork (in .BlockchainDst )
37- require .NoError (t , err )
38-
3934 // create configs for 2 EVM networks
4035 srcNetworkCfg , err := clnode .NewNetworkCfg (& clnode.EVMNetworkConfig {
4136 MinIncomingConfirmations : 1 ,
@@ -48,66 +43,31 @@ func TestOffChainAndFork(t *testing.T) {
4843 },
4944 },
5045 }, bcSrc )
51- dstNetworkConfig , err := clnode .NewNetworkCfg (& clnode.EVMNetworkConfig {
52- MinIncomingConfirmations : 1 ,
53- MinContractPayment : "0.00001 link" ,
54- ChainID : bcSrc .ChainID ,
55- EVMNodes : []* clnode.EVMNode {
56- {
57- SendOnly : false ,
58- Order : 100 ,
59- },
60- },
61- }, bcDst )
62- // override the configuration
63- in .NodeSet .NodeSpecs [0 ].Node .TestConfigOverrides = srcNetworkCfg + dstNetworkConfig
46+ in .NodeSets [0 ].NodeSpecs [0 ].Node .TestConfigOverrides = srcNetworkCfg
6447
65- // create a node set
66- _ , err = ns .NewSharedDBNodeSet (in .NodeSet , bcSrc )
48+ _ , err = ns .NewSharedDBNodeSet (in .NodeSets [0 ], bcSrc )
6749 require .NoError (t , err )
6850
69- // connect 2 clients
7051 scSrc , err := seth .NewClientBuilder ().
7152 WithRpcUrl (bcSrc .Nodes [0 ].ExternalWSUrl ).
7253 WithGasPriceEstimations (true , 0 , seth .Priority_Fast ).
7354 WithTracing (seth .TracingLevel_All , []string {seth .TraceOutput_Console }).
7455 WithPrivateKeys ([]string {blockchain .DefaultAnvilPrivateKey }).
7556 Build ()
7657 require .NoError (t , err )
77- scDst , err := seth .NewClientBuilder ().
78- WithRpcUrl (bcDst .Nodes [0 ].ExternalWSUrl ).
79- WithGasPriceEstimations (true , 0 , seth .Priority_Fast ).
80- WithTracing (seth .TracingLevel_All , []string {seth .TraceOutput_Console }).
81- WithPrivateKeys ([]string {blockchain .DefaultAnvilPrivateKey }).
82- Build ()
83- require .NoError (t , err )
8458
85- // deploy 2 example product contracts
86- // you should replace it with chainlink-deployments
8759 in .ContractsSrc .URL = bcSrc .Nodes [0 ].ExternalWSUrl
8860 contractsSrc , err := onchain .NewProductOnChainDeployment (scSrc , in .ContractsSrc )
8961 require .NoError (t , err )
90- in .ContractsDst .URL = bcDst .Nodes [0 ].ExternalWSUrl
91- contractsDst , err := onchain .NewProductOnChainDeployment (scDst , in .ContractsDst )
92- require .NoError (t , err )
9362
9463 t .Run ("test some contracts with fork" , func (t * testing.T ) {
95- // interact with a source chain
9664 i , err := testToken .NewBurnMintERC677 (contractsSrc .Addresses [0 ], scSrc .Client )
9765 require .NoError (t , err )
9866 balance , err := i .BalanceOf (scSrc .NewCallOpts (), contractsSrc .Addresses [0 ])
9967 require .NoError (t , err )
10068 fmt .Println (balance )
10169
102- // interact with a destination chain
103- i , err = testToken .NewBurnMintERC677 (contractsDst .Addresses [0 ], scDst .Client )
104- require .NoError (t , err )
105- balance , err = i .BalanceOf (scDst .NewCallOpts (), contractsDst .Addresses [0 ])
106- require .NoError (t , err )
107- fmt .Println (balance )
108-
10970 // Use anvil methods, see https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/rpc/rpc.go
11071 _ = rpc .New (bcSrc .Nodes [0 ].ExternalHTTPUrl , nil )
111- _ = rpc .New (bcDst .Nodes [0 ].ExternalHTTPUrl , nil )
11272 })
11373}
0 commit comments