From 69bd7705ef27268b35928c9139023590e828898e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Fri, 21 Feb 2025 11:33:50 +0100 Subject: [PATCH] test: refactor state root handling in test suite Replaced the reuse of "stateRoot" with "prevStateRoot" for clarity and updated state transition logic. Added assertion to ensure state roots differ between iterations, improving test robustness. --- test/suite.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/suite.go b/test/suite.go index 4506ec7..b251178 100644 --- a/test/suite.go +++ b/test/suite.go @@ -127,16 +127,19 @@ func (s *ExecutorSuite) TestMultipleBlocks() { ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() initialHeight := uint64(1) - genesisTime, stateRoot, maxBytes := s.initChain(ctx, initialHeight) + genesisTime, prevStateRoot, _ := s.initChain(ctx, initialHeight) for i := initialHeight; i <= 10; i++ { txs, err := s.Exec.GetTxs(ctx) s.Require().NoError(err) blockTime := genesisTime.Add(time.Duration(i+1) * time.Second) //nolint:gosec - stateRoot, maxBytes, err = s.Exec.ExecuteTxs(ctx, txs, i, blockTime, stateRoot) + stateRoot, maxBytes, err := s.Exec.ExecuteTxs(ctx, txs, i, blockTime, prevStateRoot) s.Require().NoError(err) s.Require().NotZero(maxBytes) + s.Require().NotEqual(prevStateRoot, stateRoot) + + prevStateRoot = stateRoot err = s.Exec.SetFinal(ctx, i) s.Require().NoError(err)