@@ -21,7 +21,6 @@ import (
2121 "github.com/ethereum/go-ethereum/common/hexutil"
2222 "github.com/ethereum/go-ethereum/core/types"
2323 "github.com/ethereum/go-ethereum/crypto"
24- "github.com/ethereum/go-ethereum/ethclient"
2524 "github.com/stretchr/testify/require"
2625 "google.golang.org/protobuf/proto"
2726
@@ -56,6 +55,7 @@ func BenchmarkEvmContractRoundtrip(b *testing.B) {
5655 "--evnode.instrumentation.tracing_endpoint" , collector .endpoint (),
5756 "--evnode.instrumentation.tracing_sample_rate" , "1.0" ,
5857 "--evnode.instrumentation.tracing_service_name" , "ev-node-bench" ,
58+ "--evnode.node.block_time=10ms" ,
5959 )
6060 defer cleanup ()
6161
@@ -102,8 +102,11 @@ func BenchmarkEvmContractRoundtrip(b *testing.B) {
102102 err = client .SendTransaction (ctx , signedTxs [i ])
103103 require .NoError (b , err )
104104
105- // 2. Wait for inclusion.
106- waitForReceipt (b , ctx , client , signedTxs [i ].Hash ())
105+ // 2. Wait for inclusion with fast 10ms polling to reduce variance while avoiding RPC overload.
106+ require .Eventually (b , func () bool {
107+ receipt , err := client .TransactionReceipt (ctx , signedTxs [i ].Hash ())
108+ return err == nil && receipt != nil
109+ }, 2 * time .Second , 10 * time .Millisecond , "transaction %s not included" , signedTxs [i ].Hash ().Hex ())
107110
108111 // 3. Retrieve and verify.
109112 result , err := client .CallContract (ctx , callMsg , nil )
@@ -280,15 +283,3 @@ func printCollectedTraceReport(b testing.TB, collector *otlpCollector) {
280283 b .Logf ("%-40s %5.1f%% %s" , name , pct , bar )
281284 }
282285}
283-
284- // waitForReceipt polls for a transaction receipt until it is available.
285- func waitForReceipt (t testing.TB , ctx context.Context , client * ethclient.Client , txHash common.Hash ) * types.Receipt {
286- t .Helper ()
287- var receipt * types.Receipt
288- var err error
289- require .Eventually (t , func () bool {
290- receipt , err = client .TransactionReceipt (ctx , txHash )
291- return err == nil && receipt != nil
292- }, 2 * time .Second , 50 * time .Millisecond , "transaction %s not included" , txHash .Hex ())
293- return receipt
294- }
0 commit comments