Skip to content

Commit d65d9b5

Browse files
committed
Resolve invalid block time measurement
1 parent 07e7628 commit d65d9b5

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

internal/collector/collector.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ func NewCollector(cli Client) *Collector {
3333
}
3434

3535
// GetRunResult generates the run result for the passed in transaction hashes and start range
36-
func (c *Collector) GetRunResult(txHashes [][]byte, startBlock int64) (*RunResult, error) {
36+
func (c *Collector) GetRunResult(
37+
txHashes [][]byte,
38+
startBlock int64,
39+
startTime time.Time,
40+
) (*RunResult, error) {
3741
var (
3842
blockResults = make([]*BlockResult, 0)
3943
timeout = time.After(5 * time.Minute)
@@ -113,7 +117,7 @@ func (c *Collector) GetRunResult(txHashes [][]byte, startBlock int64) (*RunResul
113117

114118
return &RunResult{
115119
AverageTPS: calculateTPS(
116-
blockResults[0].Time,
120+
startTime,
117121
blockResults[len(blockResults)-1].Time,
118122
len(txHashes),
119123
),

internal/collector/collector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestCollector_GetRunResults(t *testing.T) {
105105
c.requestTimeout = time.Second * 0
106106

107107
// Collect the results
108-
result, err := c.GetRunResult(txHashes, 1)
108+
result, err := c.GetRunResult(txHashes, 1, startTime)
109109
if err != nil {
110110
t.Fatalf("unable to get run results, %v", err)
111111
}

internal/pipeline.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package internal
22

33
import (
44
"fmt"
5+
"time"
56

67
"github.com/gnolang/gno/pkgs/crypto/keys"
78
"github.com/gnolang/supernova/internal/batcher"
@@ -83,13 +84,19 @@ func (p *Pipeline) Execute() error {
8384
}
8485

8586
// Send the signed transactions in batches
87+
batchStart := time.Now()
88+
8689
batchResult, err := txBatcher.BatchTransactions(txs, int(p.cfg.BatchSize))
8790
if err != nil {
8891
return fmt.Errorf("unable to batch transactions %w", err)
8992
}
9093

9194
// Collect the transaction results
92-
runResult, err := txCollector.GetRunResult(batchResult.TxHashes, batchResult.StartBlock)
95+
runResult, err := txCollector.GetRunResult(
96+
batchResult.TxHashes,
97+
batchResult.StartBlock,
98+
batchStart,
99+
)
93100
if err != nil {
94101
return fmt.Errorf("unable to collect transactions, %w", err)
95102
}

internal/runtime/realm_call.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (r *realmCall) Initialize(account *gnoland.GnoAccount) ([]*std.Tx, error) {
5050

5151
tx := &std.Tx{
5252
Msgs: []std.Msg{msg},
53-
Fee: std.NewFee(600000, common.DefaultGasFee),
53+
Fee: defaultDeployTxFee,
5454
}
5555

5656
// Sign it

internal/runtime/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const (
1515
)
1616

1717
var (
18-
defaultDeployTxFee = std.NewFee(600000, common.DefaultGasFee)
18+
defaultDeployTxFee = std.NewFee(165000, common.DefaultGasFee)
1919
)
2020

2121
// Runtime is the base interface for all runtime

0 commit comments

Comments
 (0)