Skip to content

Commit

Permalink
Provide correct state sync event logs filter in `TestE2E_Bridge_Trans…
Browse files Browse the repository at this point in the history
…fers` (#1381)

* Fix TestE2E_Bridge_Transfers

* Extract finalBlockNum variable

* Harden TestPeerConnectionUpdateEventCh

* Inline WriteTx invocation
  • Loading branch information
Stefan-Ethernal committed Apr 17, 2023
1 parent ed1ecd7 commit a5aea76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions consensus/polybft/block_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ func (b *BlockBuilder) writeTxPoolTransaction(tx *types.Transaction) (bool, erro
return true, nil
}

err := b.WriteTx(tx)
if err != nil {
if err := b.WriteTx(tx); err != nil {
if _, ok := err.(*state.GasLimitReachedTransitionApplicationError); ok { //nolint:errorlint
// stop processing
return true, err
Expand Down
10 changes: 6 additions & 4 deletions e2e-polybft/e2e/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestE2E_Bridge_Transfers(t *testing.T) {
numBlockConfirmations = 2
// make epoch size long enough, so that all exit events are processed within the same epoch
epochSize = 30
sprintSize = 5
sprintSize = uint64(5)
)

receivers := make([]string, transfersCount)
Expand Down Expand Up @@ -78,8 +78,9 @@ func TestE2E_Bridge_Transfers(t *testing.T) {
),
)

finalBlockNum := 8 * sprintSize
// wait for a couple of sprints
require.NoError(t, cluster.WaitForBlock(8*sprintSize, 2*time.Minute))
require.NoError(t, cluster.WaitForBlock(finalBlockNum, 2*time.Minute))

// the transactions are processed and there should be a success events
var stateSyncedResult contractsapi.StateSyncResultEvent
Expand All @@ -92,7 +93,7 @@ func TestE2E_Bridge_Transfers(t *testing.T) {
}

filter.SetFromUint64(0)
filter.SetToUint64(100)
filter.SetToUint64(finalBlockNum)

logs, err := childEthEndpoint.GetLogs(filter)
require.NoError(t, err)
Expand Down Expand Up @@ -229,6 +230,7 @@ func TestE2E_Bridge_Transfers(t *testing.T) {
),
)

finalBlockNum := midBlockNumber + 5*sprintSize
// wait for a few more sprints
require.NoError(t, cluster.WaitForBlock(midBlockNumber+5*sprintSize, 3*time.Minute))

Expand All @@ -253,7 +255,7 @@ func TestE2E_Bridge_Transfers(t *testing.T) {
}

filter.SetFromUint64(initialBlockNum)
filter.SetToUint64(initialBlockNum + 2*epochSize)
filter.SetToUint64(finalBlockNum)

logs, err := childEthEndpoint.GetLogs(filter)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion syncer/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestPeerConnectionUpdateEventCh(t *testing.T) {
wgForGossip.Wait()

// close to terminate goroutine
close(client.peerStatusUpdateCh)
client.Close()

// wait until collecting routine is done
wgForConnectingStatus.Wait()
Expand Down

0 comments on commit a5aea76

Please sign in to comment.