Skip to content

Commit 4a87732

Browse files
committed
[FAB-9654] Capabilities for key-level validation
This change set introduces a new capability for key level validation (as described in FAB-8812). Change-Id: I1a517e61b0df7d3e3017866a457b2ee657109b18 Signed-off-by: Alessandro Sorniotti <ale.linux@sopit.net> Signed-off-by: Matthias Neugschwandtner <eug@zurich.ibm.com>
1 parent 83ad1f0 commit 4a87732

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

common/capabilities/application.go

+6
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@ func (ap *ApplicationProvider) V1_2Validation() bool {
9393
func (ap *ApplicationProvider) MetadataLifecycle() bool {
9494
return ap.v12LifecycleExperimental
9595
}
96+
97+
// KeyLevelEndorsement returns true if this channel supports endorsement
98+
// policies expressible at a ledger key granularity, as described in FAB-8812
99+
func (ap *ApplicationProvider) KeyLevelEndorsement() bool {
100+
return ap.v12
101+
}

common/capabilities/application_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func TestApplicationV12(t *testing.T) {
3636
assert.True(t, op.ForbidDuplicateTXIdInBlock())
3737
assert.True(t, op.V1_1Validation())
3838
assert.True(t, op.V1_2Validation())
39+
assert.True(t, op.KeyLevelEndorsement())
3940
}
4041

4142
func TestApplicationPvtDataExperimental(t *testing.T) {

common/channelconfig/api.go

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ type ApplicationCapabilities interface {
141141
// v1.0/v1.1 lifecycle, or whether it should use the newer per channel peer local chaincode
142142
// metadata package approach planned for release with Fabric v1.2
143143
MetadataLifecycle() bool
144+
145+
// KeyLevelEndorsement returns true if this channel supports endorsement
146+
// policies expressible at a ledger key granularity, as described in FAB-8812
147+
KeyLevelEndorsement() bool
144148
}
145149

146150
// OrdererCapabilities defines the capabilities for the orderer portion of a channel

common/mocks/config/application.go

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type MockApplicationCapabilities struct {
4343
V1_1ValidationRv bool
4444
V1_2ValidationRv bool
4545
MetadataLifecycleRv bool
46+
KeyLevelEndorsementRv bool
4647
}
4748

4849
func (mac *MockApplicationCapabilities) Supported() error {
@@ -72,3 +73,7 @@ func (mac *MockApplicationCapabilities) V1_2Validation() bool {
7273
func (mac *MockApplicationCapabilities) MetadataLifecycle() bool {
7374
return mac.MetadataLifecycleRv
7475
}
76+
77+
func (mac *MockApplicationCapabilities) KeyLevelEndorsement() bool {
78+
return mac.KeyLevelEndorsementRv
79+
}

0 commit comments

Comments
 (0)