Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more debug info
Browse files Browse the repository at this point in the history
fasmat committed Nov 25, 2024
1 parent 971bf3e commit 54b7e5b
Showing 2 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions systest/tests/checkpoint_test.go
Original file line number Diff line number Diff line change
@@ -68,6 +68,10 @@ func TestCheckpoint(t *testing.T) {
stop := first + 2
receiver := types.GenerateAddress([]byte{11, 1, 1})
tctx.Log.Infow("sending transactions", "from", first, "to", stop-1)
tctx.Log.Debugw("info",
"time", cl.Genesis(),
"current layer", (time.Since(cl.Genesis()) / layerDuration),
)
require.NoError(t, sendTransactions(ctx, eg, tctx.Log.Desugar(), cl, first, stop, layerDuration, receiver, 1, 100))
require.NoError(t, eg.Wait())

22 changes: 14 additions & 8 deletions systest/tests/common.go
Original file line number Diff line number Diff line change
@@ -40,21 +40,27 @@ func sendTransactions(
receiver types.Address,
batch, amount int,
) error {
deadline := cl.Genesis().Add(time.Duration(stop+1) * layerDuration)
minimum := time.Now().Add(2 * layerDuration)
if deadline.Before(minimum) { // make sure we have at least two layers to submit transactions
deadline = minimum
}
ctx, cancel := context.WithDeadline(ctx, deadline)
defer cancel()

for i := range cl.Accounts() {
client := cl.Client(i % cl.Total())
nonce, err := getNonce(ctx, client, cl.Address(i))
if err != nil {
return fmt.Errorf("get nonce failed (%s: %s): %w", client.Name, cl.Address(i), err)
}
deadline := cl.Genesis().Add(time.Duration(stop+1) * layerDuration)
minimum := time.Now().Add(2 * layerDuration)
if deadline.Before(minimum) { // make sure we have at least two layers to submit transactions
deadline = minimum
}
ctx, cancel := context.WithDeadline(ctx, deadline)
defer cancel()
watchLayers(ctx, eg, client, logger, func(layer *pb.LayerStreamResponse) (bool, error) {
if layer.Layer.Number.Number == stop {
if layer.Layer.Number.Number >= stop {
logger.Debug("stopping transactions",
zap.Uint32("layer", layer.Layer.Number.Number),
zap.String("client", client.Name),
zap.Stringer("address", cl.Address(i)),
)
return false, nil
}
if layer.Layer.Status != pb.Layer_LAYER_STATUS_APPLIED || layer.Layer.Number.Number < first {

0 comments on commit 54b7e5b

Please sign in to comment.