Skip to content

Commit

Permalink
[FAB-8625] update to v1.1.0-rc1
Browse files Browse the repository at this point in the history
Change-Id: I0b21598872e6e391135a3a951cbf03a0ca349afe
Signed-off-by: Troy Ronda <[email protected]>
  • Loading branch information
troyronda committed Mar 1, 2018
1 parent 4845e91 commit 3e334a0
Show file tree
Hide file tree
Showing 30 changed files with 204 additions and 236 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ DOCKER_CMD ?= docker
DOCKER_COMPOSE_CMD ?= docker-compose

# Fabric versions used in the Makefile
FABRIC_STABLE_VERSION := 1.0.5
FABRIC_STABLE_VERSION := 1.0.6
FABRIC_STABLE_VERSION_MINOR := 1.0
FABRIC_STABLE_VERSION_MAJOR := 1
FABRIC_BASEIMAGE_STABLE_VERSION := 0.4.6

FABRIC_PRERELEASE_VERSION := 1.1.0-alpha
FABRIC_PRERELEASE_VERSION := 1.1.0-rc1
FABRIC_PREV_VERSION := 1.0.0
FABRIC_DEVSTABLE_VERSION_MINOR := 1.1
FABRIC_DEVSTABLE_VERSION_MAJOR := 1
Expand Down Expand Up @@ -63,9 +63,9 @@ FABRIC_DEV_REGISTRY_PRE_CMD ?= docker login -u docker -p docker nexus3.hyperledg

# Upstream fabric patching (overridable)
THIRDPARTY_FABRIC_CA_BRANCH ?= master
THIRDPARTY_FABRIC_CA_COMMIT ?= v1.1.0-alpha
THIRDPARTY_FABRIC_CA_COMMIT ?= v1.1.0-rc1
THIRDPARTY_FABRIC_BRANCH ?= master
THIRDPARTY_FABRIC_COMMIT ?= v1.1.0-alpha
THIRDPARTY_FABRIC_COMMIT ?= v1.1.0-rc1

# Force removal of images in cleanup (overridable)
FIXTURE_DOCKER_REMOVE_FORCE ?= false
Expand Down
8 changes: 4 additions & 4 deletions internal/github.com/hyperledger/fabric-ca/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type RegistrationRequest struct {
Secret string `json:"secret,omitempty" mask:"password" help:"The enrollment secret for the identity being registered"`
// MaxEnrollments is the maximum number of times the secret can
// be reused to enroll.
MaxEnrollments int `json:"max_enrollments,omitempty" def:"-1" help:"The maximum number of times the secret can be reused to enroll."`
MaxEnrollments int `json:"max_enrollments,omitempty" help:"The maximum number of times the secret can be reused to enroll (default CA's Max Enrollment)"`
// is returned in the response.
// The identity's affiliation.
// For example, an affiliation of "org1.department1" associates the identity with "department1" in "org1".
Expand Down Expand Up @@ -204,7 +204,7 @@ type AddIdentityRequest struct {
Type string `json:"type" def:"user" help:"Type of identity being registered (e.g. 'peer, app, user')"`
Affiliation string `json:"affiliation" help:"The identity's affiliation"`
Attributes []Attribute `json:"attrs" mapstructure:"attrs" `
MaxEnrollments int `json:"max_enrollments" mapstructure:"max_enrollments" def:"-1" help:"The maximum number of times the secret can be reused to enroll."`
MaxEnrollments int `json:"max_enrollments" mapstructure:"max_enrollments" help:"The maximum number of times the secret can be reused to enroll (default CA's Max Enrollment)"`
// Secret is an optional password. If not specified,
// a random secret is generated. In both cases, the secret
// is returned in the RegistrationResponse.
Expand All @@ -216,10 +216,10 @@ type AddIdentityRequest struct {
// fabric-ca-server
type ModifyIdentityRequest struct {
ID string `skip:"true"`
Type string `json:"type" def:"user" help:"Type of identity being registered (e.g. 'peer, app, user')"`
Type string `json:"type" help:"Type of identity being registered (e.g. 'peer, app, user')"`
Affiliation string `json:"affiliation" help:"The identity's affiliation"`
Attributes []Attribute `mapstructure:"attrs" json:"attrs"`
MaxEnrollments int `mapstructure:"max_enrollments" json:"max_enrollments" def:"-1" help:"The maximum number of times the secret can be reused to enroll."`
MaxEnrollments int `mapstructure:"max_enrollments" json:"max_enrollments" help:"The maximum number of times the secret can be reused to enroll"`
Secret string `json:"secret,omitempty" mask:"password" help:"The enrollment secret for the identity"`
CAName string `json:"caname,omitempty" skip:"true"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

// ClientConfig is the fabric-ca client's config
type ClientConfig struct {
Debug bool `def:"false" opt:"d" help:"Enable debug level logging"`
URL string `def:"http://localhost:7054" opt:"u" help:"URL of fabric-ca-server"`
MSPDir string `def:"msp" opt:"M" help:"Membership Service Provider directory"`
TLS tls.ClientTLSConfig
Expand Down
7 changes: 6 additions & 1 deletion internal/github.com/hyperledger/fabric/bccsp/sw/fileks.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ func (ks *fileBasedKeyStore) searchKeystoreForSKI(ski []byte) (k bccsp.Key, err
if f.IsDir() {
continue
}

if f.Size() > (1 << 16) { //64k, somewhat arbitrary limit, considering even large RSA keys
continue
}

raw, err := ioutil.ReadFile(filepath.Join(ks.path, f.Name()))
if err != nil {
continue
Expand All @@ -258,7 +263,7 @@ func (ks *fileBasedKeyStore) searchKeystoreForSKI(ski []byte) (k bccsp.Key, err

return k, nil
}
return nil, errors.New("Key type not recognized")
return nil, fmt.Errorf("Key with SKI %s not found in %s", hex.EncodeToString(ski), ks.path)
}

func (ks *fileBasedKeyStore) getSuffix(alias string) string {
Expand Down
2 changes: 0 additions & 2 deletions internal/github.com/hyperledger/fabric/msp/configbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ type NodeOUs struct {
ClientOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"ClientOUIdentifier,omitempty"`
// PeerOUIdentifier specifies how to recognize peers by OU
PeerOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"PeerOUIdentifier,omitempty"`
// OrdererOUIdentifier specifies how to recognize orderers by OU
OrdererOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"OrdererOUIdentifier,omitempty"`
}

// Configuration represents the accessory configuration an MSP can be equipped with.
Expand Down
9 changes: 9 additions & 0 deletions internal/github.com/hyperledger/fabric/msp/mgmt/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ var localMsp msp.MSP
var mspMap map[string]msp.MSPManager = make(map[string]msp.MSPManager)
var mspLogger = flogging.MustGetLogger("msp")

// TODO - this is a temporary solution to allow the peer to track whether the
// MSPManager has been setup for a channel, which indicates whether the channel
// exists or not
type mspMgmtMgr struct {
msp.MSPManager
// track whether this MSPManager has been setup successfully
up bool
}

// GetLocalMSP returns the local msp (and creates it if it doesn't exist)
func GetLocalMSP() msp.MSP {
var lclMsp msp.MSP
Expand Down
6 changes: 1 addition & 5 deletions internal/github.com/hyperledger/fabric/msp/mspimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type bccspmsp struct {
ouEnforcement bool
// These are the OUIdentifiers of the clients, peers and orderers.
// They are used to tell apart these entities
clientOU, peerOU, ordererOU *OUIdentifier
clientOU, peerOU *OUIdentifier
}

// NewBccspMsp returns an MSP instance backed up by a BCCSP
Expand Down Expand Up @@ -308,8 +308,6 @@ func (msp *bccspmsp) hasOURoleInternal(id *identity, mspRole m.MSPRole_MSPRoleTy
nodeOUValue = msp.clientOU.OrganizationalUnitIdentifier
case m.MSPRole_PEER:
nodeOUValue = msp.peerOU.OrganizationalUnitIdentifier
case m.MSPRole_ORDERER:
nodeOUValue = msp.ordererOU.OrganizationalUnitIdentifier
default:
return fmt.Errorf("Invalid MSPRoleType. It must be CLIENT, PEER or ORDERER")
}
Expand Down Expand Up @@ -411,8 +409,6 @@ func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *m.MSPPrincipal)
case m.MSPRole_CLIENT:
fallthrough
case m.MSPRole_PEER:
fallthrough
case m.MSPRole_ORDERER:
mspLogger.Debugf("Checking if identity satisfies role [%s] for %s", m.MSPRole_MSPRoleType_name[int32(mspRole.Role)], msp.name)
if err := msp.Validate(id); err != nil {
return errors.Wrapf(err, "The identity is not valid under this MSP [%s]", msp.name)
Expand Down
9 changes: 0 additions & 9 deletions internal/github.com/hyperledger/fabric/msp/mspimplsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,6 @@ func (msp *bccspmsp) setupNodeOUs(config *m.FabricMSPConfig) error {
msp.peerOU.CertifiersIdentifier = certifiersIdentifier
}

// OrdererOU
msp.ordererOU = &OUIdentifier{OrganizationalUnitIdentifier: config.FabricNodeOUs.OrdererOUIdentifier.OrganizationalUnitIdentifier}
if len(config.FabricNodeOUs.OrdererOUIdentifier.Certificate) != 0 {
certifiersIdentifier, err := msp.getCertifiersIdentifier(config.FabricNodeOUs.OrdererOUIdentifier.Certificate)
if err != nil {
return err
}
msp.ordererOU.CertifiersIdentifier = certifiersIdentifier
}
} else {
msp.ouEnforcement = false
}
Expand Down
2 changes: 0 additions & 2 deletions internal/github.com/hyperledger/fabric/msp/mspimplvalidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ func (msp *bccspmsp) validateIdentityOUsV11(id *identity) error {
nodeOU = msp.clientOU
case msp.peerOU.OrganizationalUnitIdentifier:
nodeOU = msp.peerOU
case msp.ordererOU.OrganizationalUnitIdentifier:
nodeOU = msp.ordererOU
default:
continue
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/fab/events/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1214,13 +1214,13 @@ func checkFilteredBlock(t *testing.T, fblock *pb.FilteredBlock, expectedChannelI
if fblock.ChannelId != expectedChannelID {
t.Fatalf("Expecting channel [%s] but got [%s]", expectedChannelID, fblock.ChannelId)
}
if len(fblock.FilteredTx) != len(expectedFilteredTxs) {
t.Fatalf("Expecting %d filtered transactions but got %d", len(expectedFilteredTxs), len(fblock.FilteredTx))
if len(fblock.FilteredTransactions) != len(expectedFilteredTxs) {
t.Fatalf("Expecting %d filtered transactions but got %d", len(expectedFilteredTxs), len(fblock.FilteredTransactions))
}

for _, expectedTx := range expectedFilteredTxs {
found := false
for _, tx := range fblock.FilteredTx {
for _, tx := range fblock.FilteredTransactions {
if tx.Txid == expectedTx.Txid {
found = true
if tx.TxValidationCode != expectedTx.TxValidationCode {
Expand Down
14 changes: 7 additions & 7 deletions pkg/fab/events/service/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (ed *Dispatcher) publishFilteredBlockEvents(fblock *pb.FilteredBlock) {
}
}

for _, tx := range fblock.FilteredTx {
for _, tx := range fblock.FilteredTransactions {
ed.publishTxStatusEvents(tx)

// Only send a chaincode event if the transaction has committed
Expand All @@ -414,8 +414,8 @@ func (ed *Dispatcher) publishFilteredBlockEvents(fblock *pb.FilteredBlock) {
continue
}
for _, action := range txActions.ChaincodeActions {
if action.CcEvent != nil {
ed.publishCCEvents(action.CcEvent)
if action.ChaincodeEvent != nil {
ed.publishCCEvents(action.ChaincodeEvent)
}
}
}
Expand Down Expand Up @@ -501,9 +501,9 @@ func toFilteredBlock(block *cb.Block) *pb.FilteredBlock {
}

return &pb.FilteredBlock{
ChannelId: channelID,
Number: block.Header.Number,
FilteredTx: filteredTxs,
ChannelId: channelID,
Number: block.Header.Number,
FilteredTransactions: filteredTxs,
}
}

Expand Down Expand Up @@ -568,7 +568,7 @@ func getFilteredTransactionActions(data []byte) (*pb.FilteredTransaction_Transac
return nil, errors.Wrap(err, "error getting chaincode events")
}
if ccEvent != nil {
actions.TransactionActions.ChaincodeActions = append(actions.TransactionActions.ChaincodeActions, &pb.FilteredChaincodeAction{CcEvent: ccEvent})
actions.TransactionActions.ChaincodeActions = append(actions.TransactionActions.ChaincodeActions, &pb.FilteredChaincodeAction{ChaincodeEvent: ccEvent})
}
return actions, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/fab/events/service/mocks/mockevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func NewTransactionWithCCEvent(txID string, txValidationCode pb.TxValidationCode
// and filtered transactions
func NewFilteredBlock(channelID string, filteredTx ...*pb.FilteredTransaction) *pb.FilteredBlock {
return &pb.FilteredBlock{
ChannelId: channelID,
FilteredTx: filteredTx,
ChannelId: channelID,
FilteredTransactions: filteredTx,
}
}

Expand All @@ -91,7 +91,7 @@ func NewFilteredTxWithCCEvent(txID, ccID, event string) *pb.FilteredTransaction
TransactionActions: &pb.FilteredTransactionActions{
ChaincodeActions: []*pb.FilteredChaincodeAction{
&pb.FilteredChaincodeAction{
CcEvent: &pb.ChaincodeEvent{
ChaincodeEvent: &pb.ChaincodeEvent{
ChaincodeId: ccID,
EventName: event,
TxId: txID,
Expand Down
10 changes: 5 additions & 5 deletions test/fixtures/dockerenv/.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ FABRIC_DOCKER_REGISTRY=
FABRIC_FIXTURE_VERSION=v1.0
FABRIC_CRYPTOCONFIG_VERSION=v1

FABRIC_CA_FIXTURE_TAG=1.0.5
FABRIC_ORDERER_FIXTURE_TAG=1.0.5
FABRIC_PEER_FIXTURE_TAG=1.0.5
FABRIC_COUCHDB_FIXTURE_TAG=1.0.5
FABRIC_BUILDER_FIXTURE_TAG=1.0.5
FABRIC_CA_FIXTURE_TAG=1.0.6
FABRIC_ORDERER_FIXTURE_TAG=1.0.6
FABRIC_PEER_FIXTURE_TAG=1.0.6
FABRIC_COUCHDB_FIXTURE_TAG=1.0.6
FABRIC_BUILDER_FIXTURE_TAG=1.0.6
FABRIC_BASEOS_FIXTURE_TAG=0.4.2
FABRIC_BASEIMAGE_FIXTURE_TAG=0.4.2

Expand Down
12 changes: 6 additions & 6 deletions test/fixtures/dockerenv/prerelease-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

# This file contains environment overrides to enable testing
# against the latest pre-release target.
export FABRIC_FIXTURE_VERSION="v1.1.0-alpha"
export FABRIC_FIXTURE_VERSION="v1.1.0-rc1"
export FABRIC_CRYPTOCONFIG_VERSION="v1"

export FABRIC_CA_FIXTURE_TAG="1.1.0-alpha"
export FABRIC_ORDERER_FIXTURE_TAG="1.1.0-alpha"
export FABRIC_PEER_FIXTURE_TAG="1.1.0-alpha"
export FABRIC_COUCHDB_FIXTURE_TAG="1.1.0-alpha"
export FABRIC_BUILDER_FIXTURE_TAG="1.1.0-alpha"
export FABRIC_CA_FIXTURE_TAG="1.1.0-rc1"
export FABRIC_ORDERER_FIXTURE_TAG="1.1.0-rc1"
export FABRIC_PEER_FIXTURE_TAG="1.1.0-rc1"
export FABRIC_COUCHDB_FIXTURE_TAG="1.1.0-rc1"
export FABRIC_BUILDER_FIXTURE_TAG="1.1.0-rc1"
export FABRIC_BASEOS_FIXTURE_TAG="0.4.6"
export FABRIC_BASEIMAGE_FIXTURE_TAG="0.4.6"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ func SignedByMspPeer(mspId string) *cb.SignaturePolicyEnvelope {
return signedByFabricEntity(mspId, msp.MSPRole_PEER)
}

// SignedByMspOrderer creates a SignaturePolicyEnvelope
// requiring 1 signature from any orderer of the specified MSP
func SignedByMspOrderer(mspId string) *cb.SignaturePolicyEnvelope {
return signedByFabricEntity(mspId, msp.MSPRole_ORDERER)
}

// SignedByFabricEntity creates a SignaturePolicyEnvelope
// requiring 1 signature from any fabric entity, having the passed role, of the specified MSP
func signedByFabricEntity(mspId string, role msp.MSPRole_MSPRoleType) *cb.SignaturePolicyEnvelope {
Expand Down Expand Up @@ -179,13 +173,6 @@ func SignedByAnyClient(ids []string) *cb.SignaturePolicyEnvelope {
return signedByAnyOfGivenRole(msp.MSPRole_CLIENT, ids)
}

// SignedByAnyOrderer returns a policy that requires one valid
// signature from an orderer of any of the orgs whose ids are
// listed in the supplied string array
func SignedByAnyOrderer(ids []string) *cb.SignaturePolicyEnvelope {
return signedByAnyOfGivenRole(msp.MSPRole_ORDERER, ids)
}

// SignedByAnyPeer returns a policy that requires one valid
// signature from an orderer of any of the orgs whose ids are
// listed in the supplied string array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/utils"
)

var regex *regexp.Regexp = regexp.MustCompile("^([[:alnum:]]+)([.])(member|admin|client|peer|orderer)$")
var regex *regexp.Regexp = regexp.MustCompile("^([[:alnum:].-]+)([.])(member|admin|client|peer|orderer)$")
var regexErr *regexp.Regexp = regexp.MustCompile("^No parameter '([^']+)' found[.]$")

// a stub function - it returns the same string as it's passed.
Expand Down Expand Up @@ -162,8 +162,6 @@ func secondPass(args ...interface{}) (interface{}, error) {
r = msp.MSPRole_CLIENT
case "peer":
r = msp.MSPRole_PEER
case "orderer":
r = msp.MSPRole_ORDERER
default:
return nil, fmt.Errorf("Error parsing role %s", t)
}
Expand Down
Loading

0 comments on commit 3e334a0

Please sign in to comment.