@@ -39,9 +39,20 @@ import (
39
39
const fundedKeyStr = "56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027"
40
40
41
41
var (
42
- config = runner .NewDefaultANRConfig ()
43
- manager = runner .NewNetworkManager (config )
44
- warpChainConfigPath string
42
+ config = runner .NewDefaultANRConfig ()
43
+ manager = runner .NewNetworkManager (config )
44
+ warpChainConfigPath string
45
+ unsignedWarpMsg * avalancheWarp.UnsignedMessage
46
+ unsignedWarpMessageID ids.ID
47
+ signedWarpMsg * avalancheWarp.Message
48
+ blockchainIDA , blockchainIDB ids.ID
49
+ chainAURIs , chainBURIs []string
50
+ chainAWSClient , chainBWSClient ethclient.Client
51
+ chainID = big .NewInt (99999 )
52
+ fundedKey * ecdsa.PrivateKey
53
+ fundedAddress common.Address
54
+ payload = []byte {1 , 2 , 3 }
55
+ txSigner = types .LatestSignerForChainID (chainID )
45
56
)
46
57
47
58
func TestE2E (t * testing.T ) {
@@ -108,7 +119,8 @@ var _ = ginkgo.BeforeSuite(func() {
108
119
109
120
// Issue transactions to activate the proposerVM fork on the receiving chain
110
121
chainID := big .NewInt (99999 )
111
- fundedKey , err := crypto .HexToECDSA (fundedKeyStr )
122
+ fundedKey , err = crypto .HexToECDSA (fundedKeyStr )
123
+ fundedAddress = crypto .PubkeyToAddress (fundedKey .PublicKey )
112
124
gomega .Expect (err ).Should (gomega .BeNil ())
113
125
subnetB := manager .GetSubnets ()[1 ]
114
126
subnetBDetails , ok := manager .GetSubnet (subnetB )
@@ -121,6 +133,35 @@ var _ = ginkgo.BeforeSuite(func() {
121
133
122
134
err = utils .IssueTxsToActivateProposerVMFork (ctx , chainID , fundedKey , client )
123
135
gomega .Expect (err ).Should (gomega .BeNil ())
136
+
137
+ subnetIDs := manager .GetSubnets ()
138
+ gomega .Expect (len (subnetIDs )).Should (gomega .Equal (2 ))
139
+
140
+ subnetA := subnetIDs [0 ]
141
+ subnetADetails , ok := manager .GetSubnet (subnetA )
142
+ gomega .Expect (ok ).Should (gomega .BeTrue ())
143
+ blockchainIDA = subnetADetails .BlockchainID
144
+ gomega .Expect (len (subnetADetails .ValidatorURIs )).Should (gomega .Equal (5 ))
145
+ chainAURIs = append (chainAURIs , subnetADetails .ValidatorURIs ... )
146
+
147
+ subnetB = subnetIDs [1 ]
148
+ subnetBDetails , ok = manager .GetSubnet (subnetB )
149
+ gomega .Expect (ok ).Should (gomega .BeTrue ())
150
+ blockchainIDB = subnetBDetails .BlockchainID
151
+ gomega .Expect (len (subnetBDetails .ValidatorURIs )).Should (gomega .Equal (5 ))
152
+ chainBURIs = append (chainBURIs , subnetBDetails .ValidatorURIs ... )
153
+
154
+ log .Info ("Created URIs for both subnets" , "ChainAURIs" , chainAURIs , "ChainBURIs" , chainBURIs , "blockchainIDA" , blockchainIDA , "blockchainIDB" , blockchainIDB )
155
+
156
+ chainAWSURI := toWebsocketURI (chainAURIs [0 ], blockchainIDA .String ())
157
+ log .Info ("Creating ethclient for blockchainA" , "wsURI" , chainAWSURI )
158
+ chainAWSClient , err = ethclient .Dial (chainAWSURI )
159
+ gomega .Expect (err ).Should (gomega .BeNil ())
160
+
161
+ chainBWSURI := toWebsocketURI (chainBURIs [0 ], blockchainIDB .String ())
162
+ log .Info ("Creating ethclient for blockchainB" , "wsURI" , chainBWSURI )
163
+ chainBWSClient , err = ethclient .Dial (chainBWSURI )
164
+ gomega .Expect (err ).Should (gomega .BeNil ())
124
165
})
125
166
126
167
var _ = ginkgo .AfterSuite (func () {
@@ -131,64 +172,10 @@ var _ = ginkgo.AfterSuite(func() {
131
172
})
132
173
133
174
var _ = ginkgo .Describe ("[Warp]" , ginkgo .Ordered , func () {
134
- var (
135
- unsignedWarpMsg * avalancheWarp.UnsignedMessage
136
- unsignedWarpMessageID ids.ID
137
- signedWarpMsg * avalancheWarp.Message
138
- blockchainIDA , blockchainIDB ids.ID
139
- chainAURIs , chainBURIs []string
140
- chainAWSClient , chainBWSClient ethclient.Client
141
- chainID = big .NewInt (99999 )
142
- fundedKey * ecdsa.PrivateKey
143
- fundedAddress common.Address
144
- payload = []byte {1 , 2 , 3 }
145
- txSigner = types .LatestSignerForChainID (chainID )
146
- err error
147
- )
148
-
149
- fundedKey , err = crypto .HexToECDSA (fundedKeyStr )
150
- if err != nil {
151
- panic (err )
152
- }
153
- fundedAddress = crypto .PubkeyToAddress (fundedKey .PublicKey )
154
-
155
- ginkgo .It ("Setup URIs" , ginkgo .Label ("Warp" , "SetupWarp" ), func () {
156
- subnetIDs := manager .GetSubnets ()
157
- gomega .Expect (len (subnetIDs )).Should (gomega .Equal (2 ))
158
-
159
- subnetA := subnetIDs [0 ]
160
- subnetADetails , ok := manager .GetSubnet (subnetA )
161
- gomega .Expect (ok ).Should (gomega .BeTrue ())
162
- blockchainIDA = subnetADetails .BlockchainID
163
- gomega .Expect (len (subnetADetails .ValidatorURIs )).Should (gomega .Equal (5 ))
164
- chainAURIs = append (chainAURIs , subnetADetails .ValidatorURIs ... )
165
-
166
- subnetB := subnetIDs [1 ]
167
- subnetBDetails , ok := manager .GetSubnet (subnetB )
168
- gomega .Expect (ok ).Should (gomega .BeTrue ())
169
- blockchainIDB = subnetBDetails .BlockchainID
170
- gomega .Expect (len (subnetBDetails .ValidatorURIs )).Should (gomega .Equal (5 ))
171
- chainBURIs = append (chainBURIs , subnetBDetails .ValidatorURIs ... )
172
-
173
- log .Info ("Created URIs for both subnets" , "ChainAURIs" , chainAURIs , "ChainBURIs" , chainBURIs , "blockchainIDA" , blockchainIDA , "blockchainIDB" , blockchainIDB )
174
-
175
- chainAWSURI := toWebsocketURI (chainAURIs [0 ], blockchainIDA .String ())
176
- log .Info ("Creating ethclient for blockchainA" , "wsURI" , chainAWSURI )
177
- chainAWSClient , err = ethclient .Dial (chainAWSURI )
178
- gomega .Expect (err ).Should (gomega .BeNil ())
179
-
180
- chainBWSURI := toWebsocketURI (chainBURIs [0 ], blockchainIDB .String ())
181
- log .Info ("Creating ethclient for blockchainB" , "wsURI" , chainBWSURI )
182
- chainBWSClient , err = ethclient .Dial (chainBWSURI )
183
- gomega .Expect (err ).Should (gomega .BeNil ())
184
- })
185
-
186
175
// Send a transaction to Subnet A to issue a Warp Message to Subnet B
187
176
ginkgo .It ("Send Message from A to B" , ginkgo .Label ("Warp" , "SendWarp" ), func () {
188
177
ctx := context .Background ()
189
178
190
- gomega .Expect (err ).Should (gomega .BeNil ())
191
-
192
179
log .Info ("Subscribing to new heads" )
193
180
newHeads := make (chan * types.Header , 10 )
194
181
sub , err := chainAWSClient .SubscribeNewHead (ctx , newHeads )
0 commit comments