Skip to content

Commit 10fdcc9

Browse files
author
Jason Yellick
committed
[FAB-9002] Define new application v1.2 capability
For all the non-backwards compatible work, including the new chaincode lifecycle and resources config changes, we must use a new capability to determine whether the behavior is enabled or not. This CR adds one for the application portion of the config. At the time of this writing there are no features which would introduce incompatibilities at the orderer or channel level, so those capabilities are being left in place. This CR also removes the assorted 'V11' profiles, as maintaining a set of profiles for each version is unmaintainable and confusing. For this and subsequent releases, configtx.yaml will contain only defaults for the current version of fabric. Users may of course override these defaults by modifying the config file. Change-Id: I08729fef76292044440ebc7e4f39145b0640afc4 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent 149d4f5 commit 10fdcc9

File tree

11 files changed

+103
-172
lines changed

11 files changed

+103
-172
lines changed

common/capabilities/application.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const (
1616
// ApplicationV1_1 is the capabilties string for standard new non-backwards compatible fabric v1.1 application capabilities.
1717
ApplicationV1_1 = "V1_1"
1818

19+
// ApplicationV1_2 is the capabilties string for standard new non-backwards compatible fabric v1.2 application capabilities.
20+
ApplicationV1_2 = "V1_2"
21+
1922
// ApplicationPvtDataExperimental is the capabilties string for private data using the experimental feature of collections/sideDB.
2023
ApplicationPvtDataExperimental = "V1_1_PVTDATA_EXPERIMENTAL"
2124

@@ -27,6 +30,7 @@ const (
2730
type ApplicationProvider struct {
2831
*registry
2932
v11 bool
33+
v12 bool
3034
v11PvtDataExperimental bool
3135
v11ResourcesTreeExperimental bool
3236
}
@@ -36,6 +40,7 @@ func NewApplicationProvider(capabilities map[string]*cb.Capability) *Application
3640
ap := &ApplicationProvider{}
3741
ap.registry = newRegistry(ap, capabilities)
3842
_, ap.v11 = capabilities[ApplicationV1_1]
43+
_, ap.v12 = capabilities[ApplicationV1_2]
3944
_, ap.v11PvtDataExperimental = capabilities[ApplicationPvtDataExperimental]
4045
_, ap.v11ResourcesTreeExperimental = capabilities[ApplicationResourcesTreeExperimental]
4146
return ap
@@ -54,7 +59,7 @@ func (ap *ApplicationProvider) ResourcesTree() bool {
5459
// ForbidDuplicateTXIdInBlock specifies whether two transactions with the same TXId are permitted
5560
// in the same block or whether we mark the second one as TxValidationCode_DUPLICATE_TXID
5661
func (ap *ApplicationProvider) ForbidDuplicateTXIdInBlock() bool {
57-
return ap.v11
62+
return ap.v11 || ap.v12
5863
}
5964

6065
// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
@@ -65,5 +70,5 @@ func (ap *ApplicationProvider) PrivateChannelData() bool {
6570
// V1_1Validation returns true is this channel is configured to perform stricter validation
6671
// of transactions (as introduced in v1.1).
6772
func (ap *ApplicationProvider) V1_1Validation() bool {
68-
return ap.v11
73+
return ap.v11 || ap.v12
6974
}

common/capabilities/application_experimental.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ func (ap *ApplicationProvider) HasCapability(capability string) bool {
1414
// Add new capability names here
1515
case ApplicationV1_1:
1616
return true
17+
case ApplicationV1_2:
18+
return true
1719
case ApplicationPvtDataExperimental:
1820
return true
1921
case ApplicationResourcesTreeExperimental:

common/capabilities/application_stable.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ func (ap *ApplicationProvider) HasCapability(capability string) bool {
1414
// Add new capability names here
1515
case ApplicationV1_1:
1616
return true
17-
case ApplicationPvtDataExperimental:
18-
return false
17+
case ApplicationV1_2:
18+
return true
1919
default:
2020
return false
2121
}

common/capabilities/application_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ func TestApplicationV11(t *testing.T) {
2828
assert.True(t, op.V1_1Validation())
2929
}
3030

31+
func TestApplicationV12(t *testing.T) {
32+
op := NewApplicationProvider(map[string]*cb.Capability{
33+
ApplicationV1_2: {},
34+
})
35+
assert.NoError(t, op.Supported())
36+
assert.True(t, op.ForbidDuplicateTXIdInBlock())
37+
assert.True(t, op.V1_1Validation())
38+
}
39+
3140
func TestApplicationPvtDataExperimental(t *testing.T) {
3241
op := NewApplicationProvider(map[string]*cb.Capability{
3342
ApplicationPvtDataExperimental: {},

common/tools/configtxgen/encoder/encoder_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ func TestConfigParsing(t *testing.T) {
4848
for _, profile := range []string{
4949
genesisconfig.SampleInsecureSoloProfile,
5050
genesisconfig.SampleSingleMSPSoloProfile,
51-
genesisconfig.SampleSingleMSPSoloV11Profile,
5251
genesisconfig.SampleDevModeSoloProfile,
5352
genesisconfig.SampleInsecureKafkaProfile,
5453
genesisconfig.SampleSingleMSPKafkaProfile,
55-
genesisconfig.SampleSingleMSPKafkaV11Profile,
5654
genesisconfig.SampleDevModeKafkaProfile,
5755
} {
5856
t.Run(profile, func(t *testing.T) {
@@ -93,6 +91,7 @@ func TestGoodChannelCreateConfigUpdate(t *testing.T) {
9391
func TestChannelCreateWithResources(t *testing.T) {
9492
t.Run("AtV1.0", func(t *testing.T) {
9593
createConfig := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile)
94+
createConfig.Application.Capabilities = nil
9695

9796
configUpdate, err := NewChannelCreateConfigUpdate("channel.id", nil, createConfig)
9897
assert.NoError(t, err)
@@ -101,7 +100,7 @@ func TestChannelCreateWithResources(t *testing.T) {
101100
})
102101

103102
t.Run("AtV1.1", func(t *testing.T) {
104-
createConfig := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelV11Profile)
103+
createConfig := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile)
105104
createConfig.Application.Capabilities[capabilities.ApplicationResourcesTreeExperimental] = true
106105

107106
configUpdate, err := NewChannelCreateConfigUpdate("channel.id", nil, createConfig)
@@ -151,7 +150,7 @@ func TestMakeChannelCreationTransactionWithSigner(t *testing.T) {
151150
mspmgmt.LoadDevMsp()
152151
signer := localmsp.NewSigner()
153152

154-
cct, err := MakeChannelCreationTransaction(channelID, signer, nil, genesisconfig.Load(genesisconfig.SampleSingleMSPChannelV11Profile))
153+
cct, err := MakeChannelCreationTransaction(channelID, signer, nil, genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile))
155154
assert.NoError(t, err, "Making chain creation tx")
156155

157156
assert.NotEmpty(t, cct.Signature, "Should have signature")
@@ -191,14 +190,14 @@ func TestMakeChannelCreationTransactionNoSigner(t *testing.T) {
191190

192191
func TestNewApplicationGroup(t *testing.T) {
193192
t.Run("Application with capabilities", func(t *testing.T) {
194-
config := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelV11Profile)
193+
config := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile)
195194
group, err := NewApplicationGroup(config.Application)
196195
assert.NoError(t, err)
197196
assert.NotNil(t, group)
198197
})
199198

200199
t.Run("Application unknown MSP", func(t *testing.T) {
201-
config := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelV11Profile)
200+
config := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile)
202201
config.Application.Organizations[0] = &genesisconfig.Organization{Name: "FakeOrg", ID: "FakeOrg"}
203202
group, err := NewApplicationGroup(config.Application)
204203
assert.Error(t, err)

common/tools/configtxgen/localconfig/config.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,18 @@ const (
5353
SampleInsecureSoloProfile = "SampleInsecureSolo"
5454
// SampleDevModeSoloProfile references the sample profile which requires only basic membership for admin privileges and uses solo for ordering.
5555
SampleDevModeSoloProfile = "SampleDevModeSolo"
56-
// SampleDevModeSoloProfileV11 references the sample profile which requires only basic membership for admin privileges and uses solo for ordering, but has v1.1 capabilities enabled
57-
SampleDevModeSoloV11Profile = "SampleDevModeSoloV1_1"
5856
// SampleSingleMSPSoloProfile references the sample profile which includes only the sample MSP and uses solo for ordering.
5957
SampleSingleMSPSoloProfile = "SampleSingleMSPSolo"
60-
// SampleSingleMSPSoloV11Profile references the sample profile which includes only the sample MSP with v1.1 capabilities defined and uses solo for ordering.
61-
SampleSingleMSPSoloV11Profile = "SampleSingleMSPSoloV1_1"
6258

6359
// SampleInsecureKafkaProfile references the sample profile which does not include any MSPs and uses Kafka for ordering.
6460
SampleInsecureKafkaProfile = "SampleInsecureKafka"
6561
// SampleDevModeKafkaProfile references the sample profile which requires only basic membership for admin privileges and uses Kafka for ordering.
6662
SampleDevModeKafkaProfile = "SampleDevModeKafka"
67-
// SampleDevModeKafkaProfileV11 references the sample profile which requires only basic membership for admin privileges and uses Kafka for ordering, but has v1.1 capabilities enabled.
68-
SampleDevModeKafkaV11Profile = "SampleDevModeKafkaV1_1"
6963
// SampleSingleMSPKafkaProfile references the sample profile which includes only the sample MSP and uses Kafka for ordering.
7064
SampleSingleMSPKafkaProfile = "SampleSingleMSPKafka"
71-
// SampleSingleMSPKafkaV11Profile references the sample profile which includes only the sample MSP with v1.1 capabilities defined and uses Kafka for ordering.
72-
SampleSingleMSPKafkaV11Profile = "SampleSingleMSPKafkaV1_1"
7365

7466
// SampleSingleMSPChannelProfile references the sample profile which includes only the sample MSP and is used to create a channel
7567
SampleSingleMSPChannelProfile = "SampleSingleMSPChannel"
76-
// SampleSingleMSPChannelV11Profile references the sample profile which includes only the sample MSP with v1.1 capabilities and is used to create a channel
77-
SampleSingleMSPChannelV11Profile = "SampleSingleMSPChannelV1_1"
7868

7969
// SampleConsortiumName is the sample consortium from the sample configtx.yaml
8070
SampleConsortiumName = "SampleConsortium"
@@ -91,6 +81,7 @@ const (
9181
type TopLevel struct {
9282
Profiles map[string]*Profile `yaml:"Profiles"`
9383
Organizations []*Organization `yaml:"Organizations"`
84+
Channel *Profile `yaml:"Channel"`
9485
Application *Application `yaml:"Application"`
9586
Orderer *Orderer `yaml:"Orderer"`
9687
Capabilities map[string]map[string]bool `yaml:"Capabilities"`

common/tools/configtxgen/localconfig/config_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ func TestLoadProfile(t *testing.T) {
2121
pNames := []string{
2222
SampleDevModeKafkaProfile,
2323
SampleDevModeSoloProfile,
24-
SampleInsecureKafkaProfile,
25-
SampleInsecureSoloProfile,
2624
SampleSingleMSPChannelProfile,
27-
SampleSingleMSPChannelV11Profile,
2825
SampleSingleMSPKafkaProfile,
29-
SampleSingleMSPKafkaV11Profile,
3026
SampleSingleMSPSoloProfile,
31-
SampleSingleMSPSoloV11Profile,
3227
}
3328
for _, pName := range pNames {
3429
t.Run(pName, func(t *testing.T) {

examples/e2e_cli/configtx.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,4 @@ Capabilities:
204204
# determined to be desired for all peers running v1.0.x, but the
205205
# modification of which would cause incompatibilities. Users should
206206
# leave this flag set to true.
207-
V1_1: true
207+
V1_2: true

orderer/common/server/benchmark_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ const (
110110
// be less than 13 KB.
111111
AbsoluteMaxBytes = 15 // KB
112112
PreferredMaxBytes = 10 // KB
113-
ChannelProfile = localconfig.SampleSingleMSPChannelV11Profile
113+
ChannelProfile = localconfig.SampleSingleMSPChannelProfile
114114
)
115115

116116
var envvars = map[string]string{
117-
"ORDERER_GENERAL_GENESISPROFILE": localconfig.SampleDevModeSoloV11Profile,
117+
"ORDERER_GENERAL_GENESISPROFILE": localconfig.SampleDevModeSoloProfile,
118118
"ORDERER_GENERAL_LEDGERTYPE": "file",
119119
"ORDERER_GENERAL_LOGLEVEL": "error",
120120
"ORDERER_KAFKA_VERBOSE": "false",

orderer/sample_clients/broadcast_config/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type argsImpl struct {
7070
}
7171

7272
func init() {
73+
var err error
7374
conf, err = config.Load()
7475
if err != nil {
7576
fmt.Println("failed to load config:", err)

0 commit comments

Comments
 (0)