-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FAB-17515] Support configuring BlockValidation policy for orderer group #697
Conversation
@@ -109,6 +109,12 @@ func addImplicitMetaPolicyDefaults(cg *cb.ConfigGroup) { | |||
addPolicy(cg, policies.ImplicitMetaAnyPolicy(channelconfig.WritersPolicyKey), channelconfig.AdminsPolicyKey) | |||
} | |||
|
|||
// addOrdererImplicitMetaPolicyDefaults adds the orderer's Readers/Writers/Admins/BlockValidation policies, with Any/Any/Majority/Any rules respectively. | |||
func addOrdererImplicitMetaPolicyDefaults(cg *cb.ConfigGroup) { | |||
addPolicy(cg, policies.ImplicitMetaAnyPolicy(BlockValidationPolicyKey), channelconfig.AdminsPolicyKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use addPolicy here because it uses the same key name as the sub policy. We can just copy the removed Policies map addition below here
df54c54
to
cfe86cc
Compare
cfe86cc
to
0257000
Compare
Expect(cg.Policies["SamplePolicy"]).NotTo(BeNil()) | ||
Expect(cg.Policies["BlockValidation"]).NotTo(BeNil()) | ||
Expect(cg.Policies["SamplePolicy"].Policy).To(Equal(expectedAdminPolicy)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you convert this inline with protoutil.MarshalOrPanic
and remove lines 194-203?
Expect(cg.Policies["SamplePolicy"].Policy).To(Equal(&cb.Policy{
Type: int32(cb.Policy_IMPLICIT_META),
Value: protoutil.MarshalOrPanic(&cb.ImplicitMetaPolicy{
SubPolicy: "Admins",
Rule: cb.ImplicitMetaPolicy_ANY,
}),
}))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
0257000
to
af1efde
Compare
Opened https://jira.hyperledger.org/browse/FAB-17531 for the UT failure. |
Looks like the latest failure is similar to what was fixed in #704
|
Before we used to hardcode the BlockValidation policy to an ImplicitMetaAnyPolicy. Signed-off-by: Danny Cao <dcao@us.ibm.com> Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
af1efde
to
1f98861
Compare
// addOrdererImplicitMetaPolicyDefaults adds the orderer's Readers/Writers/Admins/BlockValidation policies, with Any/Any/Majority/Any rules respectively. | ||
func addOrdererImplicitMetaPolicyDefaults(cg *cb.ConfigGroup) { | ||
cg.Policies[BlockValidationPolicyKey] = &cb.ConfigPolicy{ | ||
Policy: policies.ImplicitMetaAnyPolicy(channelconfig.WritersPolicyKey).Value(), | ||
ModPolicy: channelconfig.AdminsPolicyKey, | ||
} | ||
addImplicitMetaPolicyDefaults(cg) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some sort of assertion for this that I'm misssing? Maybe in an existing test?
Type of change
Description
Before we used to hardcode the BlockValidation policy to an ImplicitMetaAnyPolicy and we also did not enforce that the BlockValidation policy existed.
Related issues
FAB-17515