Skip to content

Commit

Permalink
[FABG-893] Update to latest fabric pins
Browse files Browse the repository at this point in the history
Change-Id: I2c5d8e7acf71a757c61575c5fc2ab045c58cfc98
Signed-off-by: Troy Ronda <[email protected]>
  • Loading branch information
troyronda committed Aug 12, 2019
1 parent 267a181 commit ab2f64f
Show file tree
Hide file tree
Showing 74 changed files with 2,937 additions and 3,892 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ BASE_GO_VERSION = "1.12.5"

# Upstream fabric patching (overridable)
THIRDPARTY_FABRIC_CA_BRANCH ?= master
THIRDPARTY_FABRIC_CA_COMMIT ?= v2.0.0-alpha
THIRDPARTY_FABRIC_CA_COMMIT ?= 8532586e729a149260e826799b77bd8179d5d9fc
THIRDPARTY_FABRIC_BRANCH ?= master
THIRDPARTY_FABRIC_COMMIT ?= v2.0.0-alpha
THIRDPARTY_FABRIC_COMMIT ?= 56483b797ccf516d51f79ecca80845b83ce68415

# Force removal of images in cleanup (overridable)
FIXTURE_DOCKER_REMOVE_FORCE ?= false
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

module github.com/hyperledger/fabric-sdk-go

// TEMPORARY - so that we can create a commit for the third_party fabric module.
replace github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric => ./third_party/github.com/hyperledger/fabric

require (
github.com/Knetic/govaluate v3.0.0+incompatible
github.com/VividCortex/gohistogram v1.0.0 // indirect
Expand All @@ -15,11 +18,11 @@ require (
github.com/go-stack/stack v1.8.0 // indirect
github.com/gogo/protobuf v1.1.1
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.2.0
github.com/golang/protobuf v1.3.1
github.com/google/certificate-transparency-go v0.0.0-20180222191210-5ab67e519c93 // indirect
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
github.com/hyperledger/fabric-lib-go v1.0.0
github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric v0.0.0-20190524192706-bfae339c63bf
github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric v2.0.0-alpha+incompatible
github.com/kr/pretty v0.1.0 // indirect
github.com/magiconair/properties v1.7.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/certificate-transparency-go v0.0.0-20180222191210-5ab67e519c93 h1:qdfmdGwtm13OVx+AxguOWUTbgmXGn2TbdUHipo3chMg=
github.com/google/certificate-transparency-go v0.0.0-20180222191210-5ab67e519c93/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno=
Expand All @@ -38,8 +40,6 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1QI2emOVc324=
github.com/hyperledger/fabric-lib-go v1.0.0/go.mod h1:H362nMlunurmHwkYqR5uHL2UDWbQdbfz74n8kbCFsqc=
github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric v0.0.0-20190524192706-bfae339c63bf h1:ETZhEsVon+yTYk2N3Imw4ItPonDoiWXEb2i0kdOl4OU=
github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric v0.0.0-20190524192706-bfae339c63bf/go.mod h1:yzDA0nf/SiINYnTVcFKQvPM212O1BVriPF2XZLZybbg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ func (f *PluginFactory) Get(pluginOpts *PluginOpts) (bccsp.BCCSP, error) {
}

// check to make sure symbol New meets the required function signature
new, ok := sym.(func(config map[string]interface{}) (bccsp.BCCSP, error))
symNew, ok := sym.(func(config map[string]interface{}) (bccsp.BCCSP, error))
if !ok {
return nil, fmt.Errorf("Plugin does not implement the required function signature for 'New'")
}

return new(pluginOpts.Config)
return symNew(pluginOpts.Config)
}
2 changes: 1 addition & 1 deletion internal/github.com/hyperledger/fabric/bccsp/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (opts *RSAKeyGenOpts) Ephemeral() bool {
return opts.Temporary
}

// ECDSAGoPublicKeyImportOpts contains options for RSA key importation from rsa.PublicKey
// RSAGoPublicKeyImportOpts contains options for RSA key importation from rsa.PublicKey
type RSAGoPublicKeyImportOpts struct {
Temporary bool
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ func (csp *impl) generateECKey(curve asn1.ObjectIdentifier, ephemeral bool) (ski
return nil, nil, fmt.Errorf("P11: keypair generate failed [%s]", err)
}

ecpt, _, _ := ecPoint(csp.pkcs11Ctx, session, pub)
ecpt, _, err := ecPoint(csp.pkcs11Ctx, session, pub)
if err != nil {
return nil, nil, fmt.Errorf("Error querying EC-point: [%s]", err)
}
hash := sha256.Sum256(ecpt)
ski = hash[:]

Expand Down
2 changes: 1 addition & 1 deletion internal/github.com/hyperledger/fabric/bccsp/sw/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewWithParams(securityLevel int, hashFamily string, keyStore bccsp.KeyStore
swbccsp.AddWrapper(reflect.TypeOf(&bccsp.RSA3072KeyGenOpts{}), &rsaKeyGenerator{length: 3072})
swbccsp.AddWrapper(reflect.TypeOf(&bccsp.RSA4096KeyGenOpts{}), &rsaKeyGenerator{length: 4096})

// Set the key generators
// Set the key deriver
swbccsp.AddWrapper(reflect.TypeOf(&ecdsaPrivateKey{}), &ecdsaPrivateKeyKeyDeriver{})
swbccsp.AddWrapper(reflect.TypeOf(&ecdsaPublicKey{}), &ecdsaPublicKeyKeyDeriver{})
swbccsp.AddWrapper(reflect.TypeOf(&aesPrivateKey{}), &aesPrivateKeyKeyDeriver{conf: conf})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const (
// ApplicationV1_3 is the capabilties string for standard new non-backwards compatible fabric v1.3 application capabilities.
ApplicationV1_3 = "V1_3"

// ApplicationV1_4_2 is the capabilties string for standard new non-backwards compatible fabric v1.4.2 application capabilities.
ApplicationV1_4_2 = "V1_4_2"

// ApplicationV2_0 is the capabilties string for standard new non-backwards compatible fabric v2.0 application capabilities.
ApplicationV2_0 = "V2_0"

Expand All @@ -42,6 +45,7 @@ type ApplicationProvider struct {
v11 bool
v12 bool
v13 bool
v142 bool
v20 bool
v11PvtDataExperimental bool
}
Expand All @@ -53,6 +57,7 @@ func NewApplicationProvider(capabilities map[string]*cb.Capability) *Application
_, ap.v11 = capabilities[ApplicationV1_1]
_, ap.v12 = capabilities[ApplicationV1_2]
_, ap.v13 = capabilities[ApplicationV1_3]
_, ap.v142 = capabilities[ApplicationV1_4_2]
_, ap.v20 = capabilities[ApplicationV2_0]
_, ap.v11PvtDataExperimental = capabilities[ApplicationPvtDataExperimental]
return ap
Expand All @@ -65,44 +70,44 @@ func (ap *ApplicationProvider) Type() string {

// ACLs returns whether ACLs may be specified in the channel application config
func (ap *ApplicationProvider) ACLs() bool {
return ap.v12 || ap.v13 || ap.v20
return ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// ForbidDuplicateTXIdInBlock specifies whether two transactions with the same TXId are permitted
// in the same block or whether we mark the second one as TxValidationCode_DUPLICATE_TXID
func (ap *ApplicationProvider) ForbidDuplicateTXIdInBlock() bool {
return ap.v11 || ap.v12 || ap.v13 || ap.v20
return ap.v11 || ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
// In v1.1, the private channel data is experimental and has to be enabled explicitly.
// In v1.2, the private channel data is enabled by default.
func (ap *ApplicationProvider) PrivateChannelData() bool {
return ap.v11PvtDataExperimental || ap.v12 || ap.v13 || ap.v20
return ap.v11PvtDataExperimental || ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// CollectionUpgrade returns true if this channel is configured to allow updates to
// existing collection or add new collections through chaincode upgrade (as introduced in v1.2)
func (ap ApplicationProvider) CollectionUpgrade() bool {
return ap.v12 || ap.v13 || ap.v20
return ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// V1_1Validation returns true is this channel is configured to perform stricter validation
// of transactions (as introduced in v1.1).
func (ap *ApplicationProvider) V1_1Validation() bool {
return ap.v11 || ap.v12 || ap.v13 || ap.v20
return ap.v11 || ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// V1_2Validation returns true if this channel is configured to perform stricter validation
// of transactions (as introduced in v1.2).
func (ap *ApplicationProvider) V1_2Validation() bool {
return ap.v12 || ap.v13 || ap.v20
return ap.v12 || ap.v13 || ap.v142 || ap.v20
}

// V1_3Validation returns true if this channel is configured to perform stricter validation
// of transactions (as introduced in v1.3).
func (ap *ApplicationProvider) V1_3Validation() bool {
return ap.v13 || ap.v20
return ap.v13 || ap.v142 || ap.v20
}

// V2_0Validation returns true if this channel supports transaction validation
Expand All @@ -129,14 +134,20 @@ func (ap *ApplicationProvider) MetadataLifecycle() bool {
// KeyLevelEndorsement returns true if this channel supports endorsement
// policies expressible at a ledger key granularity, as described in FAB-8812
func (ap *ApplicationProvider) KeyLevelEndorsement() bool {
return ap.v13 || ap.v20
return ap.v13 || ap.v142 || ap.v20
}

// FabToken returns true if support for fabric token functions is enabled.
func (ap *ApplicationProvider) FabToken() bool {
return ap.v20
}

// StorePvtDataOfInvalidTx returns true if the peer needs to store
// the pvtData of invalid transactions.
func (ap *ApplicationProvider) StorePvtDataOfInvalidTx() bool {
return ap.v142 || ap.v20
}

// HasCapability returns true if the capability is supported by this binary.
func (ap *ApplicationProvider) HasCapability(capability string) bool {
switch capability {
Expand All @@ -147,6 +158,8 @@ func (ap *ApplicationProvider) HasCapability(capability string) bool {
return true
case ApplicationV1_3:
return true
case ApplicationV1_4_2:
return true
case ApplicationV2_0:
return true
case ApplicationPvtDataExperimental:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const (

// ChannelV1_4_2 is the capabilities string for standard new non-backwards compatible fabric v1.4.2 channel capabilities.
ChannelV1_4_2 = "V1_4_2"

// ChannelV2_0 is the capabilities string for standard new non-backwards compatible fabric v2.0 channel capabilities.
ChannelV2_0 = "V2_0"
)

// ChannelProvider provides capabilities information for channel level config.
Expand All @@ -34,6 +37,7 @@ type ChannelProvider struct {
v11 bool
v13 bool
v142 bool
v20 bool
}

// NewChannelProvider creates a channel capabilities provider.
Expand All @@ -43,6 +47,7 @@ func NewChannelProvider(capabilities map[string]*cb.Capability) *ChannelProvider
_, cp.v11 = capabilities[ChannelV1_1]
_, cp.v13 = capabilities[ChannelV1_3]
_, cp.v142 = capabilities[ChannelV1_4_2]
_, cp.v20 = capabilities[ChannelV2_0]
return cp
}

Expand All @@ -55,8 +60,10 @@ func (cp *ChannelProvider) Type() string {
func (cp *ChannelProvider) HasCapability(capability string) bool {
switch capability {
// Add new capability names here
case ChannelV2_0:
return true
case ChannelV1_4_2:
fallthrough
return true
case ChannelV1_3:
return true
case ChannelV1_1:
Expand All @@ -69,9 +76,7 @@ func (cp *ChannelProvider) HasCapability(capability string) bool {
// MSPVersion returns the level of MSP support required by this channel.
func (cp *ChannelProvider) MSPVersion() msp.MSPVersion {
switch {
case cp.v142:
return msp.MSPv1_3
case cp.v13:
case cp.v13 || cp.v142 || cp.v20:
return msp.MSPv1_3
case cp.v11:
return msp.MSPv1_1
Expand All @@ -82,5 +87,10 @@ func (cp *ChannelProvider) MSPVersion() msp.MSPVersion {

// ConsensusTypeMigration return true if consensus-type migration is supported and permitted in both orderer and peer.
func (cp *ChannelProvider) ConsensusTypeMigration() bool {
return cp.v142
return cp.v142 || cp.v20
}

// OrgSpecificOrdererEndpoints allows for individual orderer orgs to specify their external addresses for their OSNs.
func (cp *ChannelProvider) OrgSpecificOrdererEndpoints() bool {
return cp.v142 || cp.v20
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ const (
// OrdererV1_1 is the capabilities string for standard new non-backwards compatible Fabric v1.1 orderer capabilities.
OrdererV1_1 = "V1_1"

// OrdererV1_4_2 is the capabilities string for standard new non-backwards compatible Fabric v1.4.2 orderer capabilities.
OrdererV1_4_2 = "V1_4_2"

// OrdererV2_0 is the capabilities string that defines new Fabric v2.0 orderer capabilities.
//
// In particular, it defines whether the orderer supports a Kafka to Raft migration.
// A Kafka-based Ordering Service Node requires this in order to receive and process a config update with
// consensus-type migration commands. Migration is supported from Kafka to Raft only.
// If not present, these config updates will be rejected.
OrdererV2_0 = "V2_0"
)

// OrdererProvider provides capabilities information for orderer level config.
type OrdererProvider struct {
*registry
v11BugFixes bool
v142 bool
V20 bool
}

Expand All @@ -41,6 +40,7 @@ func NewOrdererProvider(capabilities map[string]*cb.Capability) *OrdererProvider
cp := &OrdererProvider{}
cp.registry = newRegistry(cp, capabilities)
_, cp.v11BugFixes = capabilities[OrdererV1_1]
_, cp.v142 = capabilities[OrdererV1_4_2]
_, cp.V20 = capabilities[OrdererV2_0]
return cp
}
Expand All @@ -56,6 +56,8 @@ func (cp *OrdererProvider) HasCapability(capability string) bool {
// Add new capability names here
case OrdererV1_1:
return true
case OrdererV1_4_2:
return true
case OrdererV2_0:
return true
default:
Expand All @@ -66,24 +68,28 @@ func (cp *OrdererProvider) HasCapability(capability string) bool {
// PredictableChannelTemplate specifies whether the v1.0 undesirable behavior of setting the /Channel
// group's mod_policy to "" and copying versions from the channel config should be fixed or not.
func (cp *OrdererProvider) PredictableChannelTemplate() bool {
return cp.v11BugFixes || cp.V20
return cp.v11BugFixes || cp.v142 || cp.V20
}

// Resubmission specifies whether the v1.0 non-deterministic commitment of tx should be fixed by re-submitting
// the re-validated tx.
func (cp *OrdererProvider) Resubmission() bool {
return cp.v11BugFixes || cp.V20
return cp.v11BugFixes || cp.v142 || cp.V20
}

// ExpirationCheck specifies whether the orderer checks for identity expiration checks
// when validating messages
func (cp *OrdererProvider) ExpirationCheck() bool {
return cp.v11BugFixes || cp.V20
return cp.v11BugFixes || cp.v142 || cp.V20
}

// Kafka2RaftMigration checks whether the orderer permits a Kafka to Raft migration.
func (cp *OrdererProvider) Kafka2RaftMigration() bool {
return cp.V20
// ConsensusTypeMigration checks whether the orderer permits a consensus-type migration.
//
// A Kafka-based Ordering Service Node requires these capabilities in order to receive and process a config update
// with consensus-type migration change. Migration is supported from Kafka to Raft only.
// If not present, these config updates will be rejected.
func (cp *OrdererProvider) ConsensusTypeMigration() bool {
return cp.v142 || cp.V20
}

// UseChannelCreationPolicyAsAdmins determines whether the orderer should use the name
Expand Down
18 changes: 11 additions & 7 deletions internal/github.com/hyperledger/fabric/common/channelconfig/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@ type Orderer interface {
// ConsensusMetadata returns the metadata associated with the consensus type.
ConsensusMetadata() []byte

// ConsensusMigrationState returns the consensus-type migration state.
ConsensusMigrationState() ab.ConsensusType_MigrationState

// ConsensusMigrationContext returns the consensus-type migration context.
ConsensusMigrationContext() uint64
// ConsensusState returns the consensus-type state.
ConsensusState() ab.ConsensusType_State

// BatchSize returns the maximum number of messages to include in a block
BatchSize() *ab.BatchSize
Expand Down Expand Up @@ -136,6 +133,9 @@ type ChannelCapabilities interface {

// ConsensusTypeMigration return true if consensus-type migration is permitted in both orderer and peer.
ConsensusTypeMigration() bool

// OrgSpecificOrdererEndpoints return true if the channel config processing allows orderer orgs to specify their own endpoints
OrgSpecificOrdererEndpoints() bool
}

// ApplicationCapabilities defines the capabilities for the application portion of a channel
Expand Down Expand Up @@ -173,6 +173,10 @@ type ApplicationCapabilities interface {
// - new chaincode lifecycle, as described in FAB-11237
V1_3Validation() bool

// StorePvtDataOfInvalidTx() returns true if the peer needs to store the pvtData of
// invalid transactions (as introduced in v142).
StorePvtDataOfInvalidTx() bool

// V2_0Validation returns true if this channel supports transaction validation
// as introduced in v2.0. This includes:
// - new chaincode lifecycle
Expand Down Expand Up @@ -213,8 +217,8 @@ type OrdererCapabilities interface {
// when validating messages
ExpirationCheck() bool

// Kafka2RaftMigration checks whether the orderer permits a Kafka to Raft migration.
Kafka2RaftMigration() bool
// ConsensusTypeMigration checks whether the orderer permits a consensus-type migration.
ConsensusTypeMigration() bool

// UseChannelCreationPolicyAsAdmins checks whether the orderer should use more sophisticated
// channel creation logic using channel creation policy as the Admins policy if
Expand Down
Loading

0 comments on commit ab2f64f

Please sign in to comment.