Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
zistvan-public
StreamChain Prototype
Commits
dce0e5d8
Commit
dce0e5d8
authored
Mar 25, 2019
by
Jason Yellick
Committed by
Gerrit Code Review
Mar 25, 2019
Browse files
Merge "FAB-14735 don't check consenters if wasn't changed" into release-1.4
parents
1e446131
12949a19
Changes
2
Hide whitespace changes
Inline
Side-by-side
integration/e2e/etcdraft_reconfig_test.go
View file @
dce0e5d8
...
...
@@ -17,11 +17,12 @@ import (
"syscall"
"time"
docker
"github.com/fsouza/go-dockerclient"
"github.com/fsouza/go-dockerclient"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/integration/nwo"
"github.com/hyperledger/fabric/integration/nwo/commands"
"github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/msp"
"github.com/hyperledger/fabric/protos/orderer/etcdraft"
"github.com/hyperledger/fabric/protos/utils"
.
"github.com/onsi/ginkgo"
...
...
@@ -1010,6 +1011,53 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
By
(
"Creating another channel via the orderer that is in system channel but not app channel"
)
network
.
CreateChannel
(
"three-orderer-channel"
,
network
.
Orderers
[
2
],
peer
)
})
When
(
"Adding new orderer organization"
,
func
()
{
It
(
"it will be added successfully"
,
func
()
{
network
=
nwo
.
New
(
nwo
.
MultiNodeEtcdRaft
(),
testDir
,
client
,
BasePort
(),
components
)
network
.
GenerateConfigTree
()
network
.
Bootstrap
()
networkRunner
:=
network
.
NetworkGroupRunner
()
process
:=
ifrit
.
Invoke
(
networkRunner
)
Eventually
(
process
.
Ready
(),
network
.
EventuallyTimeout
)
.
Should
(
BeClosed
())
peer
:=
network
.
Peer
(
"Org1"
,
"peer1"
)
orderer
:=
network
.
Orderer
(
"orderer1"
)
channel
:=
"systemchannel"
config
:=
nwo
.
GetConfig
(
network
,
peer
,
orderer
,
channel
)
updatedConfig
:=
proto
.
Clone
(
config
)
.
(
*
common
.
Config
)
ordererOrg
:=
updatedConfig
.
ChannelGroup
.
Groups
[
"Orderer"
]
.
Groups
[
"OrdererOrg"
]
mspConfig
:=
&
msp
.
MSPConfig
{}
proto
.
Unmarshal
(
ordererOrg
.
Values
[
"MSP"
]
.
Value
,
mspConfig
)
fabMSPConfig
:=
&
msp
.
FabricMSPConfig
{}
proto
.
Unmarshal
(
mspConfig
.
Config
,
fabMSPConfig
)
fabMSPConfig
.
Name
=
"OrdererMSP2"
mspConfig
.
Config
,
_
=
proto
.
Marshal
(
fabMSPConfig
)
updatedConfig
.
ChannelGroup
.
Groups
[
"Orderer"
]
.
Groups
[
"OrdererMSP2"
]
=
&
common
.
ConfigGroup
{
Values
:
map
[
string
]
*
common
.
ConfigValue
{
"MSP"
:
{
Value
:
utils
.
MarshalOrPanic
(
mspConfig
),
ModPolicy
:
"Admins"
,
},
},
ModPolicy
:
"Admins"
,
}
nwo
.
UpdateOrdererConfig
(
network
,
orderer
,
channel
,
config
,
updatedConfig
,
peer
,
orderer
)
if
process
!=
nil
{
process
.
Signal
(
syscall
.
SIGTERM
)
Eventually
(
process
.
Wait
(),
network
.
EventuallyTimeout
)
.
Should
(
Receive
())
}
os
.
RemoveAll
(
testDir
)
})
})
})
func
ensureEvicted
(
evictedOrderer
*
nwo
.
Orderer
,
submitter
*
nwo
.
Peer
,
network
*
nwo
.
Network
,
channel
string
)
{
...
...
orderer/consensus/etcdraft/chain.go
View file @
dce0e5d8
...
...
@@ -428,15 +428,17 @@ func (c *Chain) checkConfigUpdateValidity(ctx *common.Envelope) error {
return
nil
case
int32
(
common
.
HeaderType_CONFIG
)
:
configUpdate
,
err
:=
configtx
.
UnmarshalConfigUpdateFromPayload
(
payload
)
if
err
!=
nil
{
return
err
}
metadata
,
err
:=
MetadataFromConfigUpdate
(
configUpdate
)
if
err
!=
nil
{
return
err
}
// Validate consenter set if it is updated in the write-set
if
ordererConfigGroup
,
ok
:=
configUpdate
.
WriteSet
.
Groups
[
"Orderer"
];
ok
{
if
val
,
ok
:=
ordererConfigGroup
.
Values
[
"ConsensusType"
];
ok
{
return
c
.
checkConsentersSet
(
val
)
}
if
metadata
!=
nil
{
return
c
.
checkConsentersSet
(
metadata
)
}
return
nil
...
...
@@ -1171,13 +1173,7 @@ func (c *Chain) pemToDER(pemBytes []byte, id uint64, certType string) ([]byte, e
}
// checkConsentersSet validates correctness of the consenters set provided within configuration value
func
(
c
*
Chain
)
checkConsentersSet
(
configValue
*
common
.
ConfigValue
)
error
{
// read metadata update from configuration
updatedMetadata
,
err
:=
MetadataFromConfigValue
(
configValue
)
if
err
!=
nil
{
return
err
}
func
(
c
*
Chain
)
checkConsentersSet
(
updatedMetadata
*
etcdraft
.
ConfigMetadata
)
error
{
// sanity check of certificates
for
_
,
consenter
:=
range
updatedMetadata
.
Consenters
{
if
bl
,
_
:=
pem
.
Decode
(
consenter
.
ServerTlsCert
);
bl
==
nil
{
...
...
@@ -1189,7 +1185,8 @@ func (c *Chain) checkConsentersSet(configValue *common.ConfigValue) error {
}
}
if
err
:=
MetadataHasDuplication
(
updatedMetadata
);
err
!=
nil
{
var
err
error
if
err
=
MetadataHasDuplication
(
updatedMetadata
);
err
!=
nil
{
return
err
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment