Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,13 @@ func (m *Manager) publishBlock(ctx context.Context) error {

// Apply the block but DONT commit
newState, responses, err := m.executor.ApplyBlock(ctx, m.lastState, block)

if err != nil {
return err
}

// SaveBlock commits the DB tx
err = m.store.SaveBlock(block, commit)
if err != nil {
return err
}
Expand Down
9 changes: 3 additions & 6 deletions node/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package node
import (
"context"
"crypto/rand"
"fmt"
mrand "math/rand"
"strconv"
"strings"
Expand Down Expand Up @@ -127,9 +128,7 @@ func TestTxGossipingAndAggregation(t *testing.T) {
require.NoError(err)
nodeBlock, err := nodes[i].Store.LoadBlock(h)
require.NoError(err)
// Only Intermediate state roots set by block aggregator are relevant, removed for sake of comparison
nodeBlock.Data.IntermediateStateRoots.RawRootsList = nil
assert.Equal(aggBlock, nodeBlock)
assert.Equal(aggBlock, nodeBlock, fmt.Sprintf("height: %d", h))
}
}
}
Expand Down Expand Up @@ -186,8 +185,6 @@ func TestFraudProofTrigger(t *testing.T) {
require.NoError(err)
aggBlock, err := nodes[0].Store.LoadBlock(h)
require.NoError(err)
// Only Intermediate state roots set by block aggregator are relevant, removed for sake of comparison
nodeBlock.Data.IntermediateStateRoots.RawRootsList = nil
assert.Equal(aggBlock, nodeBlock)
}
}
Expand All @@ -198,7 +195,7 @@ func createAndStartNodes(clientNodes int, isMalicious bool, t *testing.T) ([]*No
var wg sync.WaitGroup
aggCtx, aggCancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(context.Background())
nodes, apps := createNodes(aggCtx, ctx, clientNodes+1, true, &wg, t)
nodes, apps := createNodes(aggCtx, ctx, clientNodes+1, isMalicious, &wg, t)
startNodes(nodes, &wg, t)
aggCancel()
time.Sleep(100 * time.Millisecond)
Expand Down