Skip to content

Commit 34934f7

Browse files
authored
Fix arma block verifier BFT detection in sidecar (#597)
#### Type of change - Bug fix #### Description Enable BFT block signature verification when orderer consensus type is arma, not only when channel capabilities report BFT support. Arma blocks carry BFT signatures via IdentifierHeader, and channels may not enable V3_0 capabilities. Without this, sidecar treats arma blocks as non-BFT, ignores consenters, and rejects block 1 with signature policy failures. Signed-off-by: Senthilnathan <cendhu@gmail.com>
1 parent 0851b04 commit 34934f7

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

utils/deliverorderer/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func fetchVerifier(bundle *channelconfig.Bundle) (*protoutil.BlockSigVerifier, e
285285
}
286286

287287
var consenters []*common.Consenter
288-
bftEnabled := bundle.ChannelConfig().Capabilities().ConsensusTypeBFT()
288+
bftEnabled := oc.ConsensusType() == "BFT" || oc.ConsensusType() == "arma"
289289
if bftEnabled {
290290
consenters = oc.Consenters()
291291
}

utils/deliverorderer/verify_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,9 @@ func TestUpdateIfConfigBlock(t *testing.T) {
450450
configBlock, err := testcrypto.CreateOrExtendConfigBlockWithCrypto(cryptoDir, &testcrypto.ConfigBlock{
451451
ChannelID: "test-channel",
452452
OrdererEndpoints: []*commontypes.OrdererEndpoint{
453-
{ID: 0, Host: "127.0.0.1", Port: 1000},
453+
{ID: 1, Host: "127.0.0.1", Port: 1000},
454+
{ID: 2, Host: "127.0.0.1", Port: 1001},
455+
{ID: 3, Host: "127.0.0.1", Port: 1002},
454456
},
455457
})
456458
require.NoError(t, err)
@@ -461,7 +463,14 @@ func TestUpdateIfConfigBlock(t *testing.T) {
461463
assert.Equal(t, configBlock.Header.Number, cs.configBlockNumber)
462464
assert.NotNil(t, cs.ConfigBlock)
463465
assert.NotNil(t, cs.verifier)
464-
assert.Len(t, cs.OrdererOrganizations, 1)
466+
assert.Len(t, cs.OrdererOrganizations, 3)
467+
468+
configMaterial, err := channelconfig.LoadConfigBlockMaterial(configBlock)
469+
require.NoError(t, err)
470+
verifier, err := fetchVerifier(configMaterial.Bundle)
471+
require.NoError(t, err)
472+
assert.True(t, verifier.BFT)
473+
assert.Len(t, verifier.Consenters, 3)
465474
})
466475

467476
t.Run("Malformed config block (invalid envelope) - treated as non-config", func(t *testing.T) {

0 commit comments

Comments
 (0)