@@ -53,18 +53,18 @@ func main() {
5353 log .Fatal ("TO_ADDRESS environment variable not set" )
5454 }
5555
56- flashblocksUrl := os .Getenv ("FLASHBLOCKS_URL " )
57- if flashblocksUrl == "" {
58- log .Fatal ("FLASHBLOCKS_URL environment variable not set" )
56+ endpoint1 := os .Getenv ("BASE_NODE_ENDPOINT_1 " )
57+ if endpoint1 == "" {
58+ log .Fatal ("BASE_NODE_ENDPOINT_1 environment variable not set" )
5959 }
6060
61- baseUrl := os .Getenv ("BASE_URL " )
62- if baseUrl == "" {
63- log .Fatal ("BASE_URL environment variable not set" )
61+ endpoint2 := os .Getenv ("BASE_NODE_ENDPOINT_2 " )
62+ if endpoint2 == "" {
63+ log .Fatal ("BASE_NODE_ENDPOINT_2 environment variable not set" )
6464 }
6565
6666 sendTxnSync := os .Getenv ("SEND_TXN_SYNC" ) == "true"
67- runStandardTransactionSending := os .Getenv ("RUN_STANDARD_TRANSACTION_SENDING " ) != "false"
67+ runEndpoint2Testing := os .Getenv ("RUN_ENDPOINT2_TESTING " ) != "false"
6868
6969 pollingIntervalMs := 100
7070 if pollingEnv := os .Getenv ("POLLING_INTERVAL_MS" ); pollingEnv != "" {
@@ -82,12 +82,12 @@ func main() {
8282 }
8383 }
8484
85- flashblocksClient , err := ethclient .Dial (flashblocksUrl )
85+ endpoint1Client , err := ethclient .Dial (endpoint1 )
8686 if err != nil {
8787 log .Fatalf ("Failed to connect to the Ethereum client: %v" , err )
8888 }
8989
90- baseClient , err := ethclient .Dial (baseUrl )
90+ endpoint2Client , err := ethclient .Dial (endpoint2 )
9191 if err != nil {
9292 log .Fatalf ("Failed to connect to the Ethereum client: %v" , err )
9393 }
@@ -104,26 +104,26 @@ func main() {
104104 }
105105 fromAddress := crypto .PubkeyToAddress (* publicKeyECDSA )
106106
107- var flashblockTimings []stats
108- var baseTimings []stats
107+ var endpoint1Timings []stats
108+ var endpoint2Timings []stats
109109
110- chainId , err := baseClient .NetworkID (context .Background ())
110+ chainId , err := endpoint2Client .NetworkID (context .Background ())
111111 if err != nil {
112112 log .Fatalf ("Failed to get network ID: %v" , err )
113113 }
114114
115- flashblockErrors := 0
116- baseErrors := 0
115+ endpoint1Errors := 0
116+ endpoint2Errors := 0
117117
118- log .Printf ("Starting flashblock transactions, syncMode=%v" , sendTxnSync )
118+ log .Printf ("Starting endpoint1 transactions, syncMode=%v" , sendTxnSync )
119119 for i := 0 ; i < numberOfTransactions ; i ++ {
120- timing , err := timeTransaction (chainId , privateKey , fromAddress , toAddress , flashblocksClient , sendTxnSync , pollingIntervalMs )
120+ timing , err := timeTransaction (chainId , privateKey , fromAddress , toAddress , endpoint1Client , sendTxnSync , pollingIntervalMs )
121121 if err != nil {
122- flashblockErrors += 1
122+ endpoint1Errors += 1
123123 log .Printf ("Failed to send transaction: %v" , err )
124124 }
125125
126- flashblockTimings = append (flashblockTimings , timing )
126+ endpoint1Timings = append (endpoint1Timings , timing )
127127
128128 if ! sendTxnSync {
129129 // wait for it to be mined -- sleep a random amount between 600ms and 1s
@@ -133,41 +133,41 @@ func main() {
133133 }
134134 }
135135
136- // wait for the final fb transaction to land
136+ // wait for the final endpoint1 transaction to land
137137 time .Sleep (5 * time .Second )
138138
139- if runStandardTransactionSending {
140- log .Printf ("Starting regular transactions" )
139+ if runEndpoint2Testing {
140+ log .Printf ("Starting endpoint2 transactions" )
141141 for i := 0 ; i < numberOfTransactions ; i ++ {
142- // Currently not supported on non-flashblock endpoints
143- timing , err := timeTransaction (chainId , privateKey , fromAddress , toAddress , baseClient , false , pollingIntervalMs )
142+ // Use async mode for endpoint2 testing
143+ timing , err := timeTransaction (chainId , privateKey , fromAddress , toAddress , endpoint2Client , false , pollingIntervalMs )
144144 if err != nil {
145- baseErrors += 1
145+ endpoint2Errors += 1
146146 log .Printf ("Failed to send transaction: %v" , err )
147147 }
148148
149- baseTimings = append (baseTimings , timing )
149+ endpoint2Timings = append (endpoint2Timings , timing )
150150
151151 // wait for it to be mined -- sleep a random amount between 4s and 3s
152152 time .Sleep (time .Duration (rand .Int63n (1000 )+ 4000 ) * time .Millisecond )
153153 }
154154 } else {
155- log .Printf ("Skipping regular transactions (RUN_STANDARD_TRANSACTION_SENDING =false)" )
155+ log .Printf ("Skipping endpoint2 transactions (RUN_ENDPOINT2_TESTING =false)" )
156156 }
157157
158- if err := writeToFile (fmt .Sprintf ("./data/flashblocks -%s.csv" , region ), flashblockTimings ); err != nil {
158+ if err := writeToFile (fmt .Sprintf ("./data/endpoint1 -%s.csv" , region ), endpoint1Timings ); err != nil {
159159 log .Fatalf ("Failed to write to file: %v" , err )
160160 }
161161
162- if runStandardTransactionSending {
163- if err := writeToFile (fmt .Sprintf ("./data/base -%s.csv" , region ), baseTimings ); err != nil {
162+ if runEndpoint2Testing {
163+ if err := writeToFile (fmt .Sprintf ("./data/endpoint2 -%s.csv" , region ), endpoint2Timings ); err != nil {
164164 log .Fatalf ("Failed to write to file: %v" , err )
165165 }
166166 }
167167
168168 log .Printf ("Completed test with %d transactions" , numberOfTransactions )
169- log .Printf ("Flashblock errors: %v" , flashblockErrors )
170- log .Printf ("BaseErrors : %v" , baseErrors )
169+ log .Printf ("Endpoint1 errors: %v" , endpoint1Errors )
170+ log .Printf ("Endpoint2 errors : %v" , endpoint2Errors )
171171}
172172
173173func writeToFile (filename string , data []stats ) error {
0 commit comments