-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add support for ConsensusTypeBFT in the orderer.go #62
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Thank you @dviejokfs ! @tock-ibm Any chance you could take a look? Core Fabric maintainers also maintain this fabric-config repository so would be good to get a maintainer familiar with SmartBFT config to take a look. |
configtx/orderer.go
Outdated
"github.com/hyperledger/fabric-config/configtx/orderer" | ||
"github.com/hyperledger/fabric-protos-go/common" |
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.
this is already imported with alias cb
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.
changed
@@ -28,6 +28,9 @@ const ( | |||
// ConsensusTypeEtcdRaft identifies the Raft-based consensus implementation. | |||
ConsensusTypeEtcdRaft = "etcdraft" | |||
|
|||
// ConsensusTypeBFT identifies the SmartBFT-based consensus implementation. | |||
ConsensusTypeBFT = "BFT" |
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.
There are no unit tests which use this constant
configtx/orderer.go
Outdated
if copyMd, ok := proto.Clone(op).(*sb.Options); ok { | ||
return proto.Marshal(copyMd) | ||
} |
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.
why is the op
object cloned before it is marshalled?
marshalling creates a deep copy, this is unnecessary.
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.
solved
configtx/orderer.go
Outdated
SmartBFT *sb.Options | ||
ConsenterMapping []common.Consenter |
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.
There aren't any unit tests that cover these new objects, please add them. See the coverage of EtcdRaft
as an example. In other words, everywhere you find orderer.ConsensusTypeEtcdRaft
in tests, add a BFT test case.
@@ -38,6 +42,9 @@ type Orderer struct { | |||
Kafka orderer.Kafka | |||
EtcdRaft orderer.EtcdRaft | |||
Organizations []Organization | |||
|
|||
SmartBFT *sb.Options |
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.
SmartBFT -> SmartBFTOptions
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.
are you sure? in Fabric 3.0 it's SmartBFT
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.
@@ -38,6 +42,9 @@ type Orderer struct { | |||
Kafka orderer.Kafka | |||
EtcdRaft orderer.EtcdRaft | |||
Organizations []Organization | |||
|
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.
Add line comments on these, and update the comment on the type, above, only EtcdRaft and BFT are supported.
configtx/orderer.go
Outdated
@@ -1060,3 +1105,49 @@ func blockDataHashingStructureValue() *standardConfigValue { | |||
}, | |||
} | |||
} | |||
|
|||
func encodeBFTBlockVerificationPolicy(consenterProtos []common.Consenter, ordererGroup *cb.ConfigGroup) error { |
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.
This is copied from Fabric right?
I think it would have been preferable to import it from Fabric, however, unfortunately, Fabric itself uses fabric-config in the integration tests.
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.
Yes, then how do you prefer to resolve it?
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.
any news @tock-ibm ?
@@ -821,6 +828,36 @@ func addOrdererValues(ordererGroup *cb.ConfigGroup, o Orderer) error { | |||
if consensusMetadata, err = marshalEtcdRaftMetadata(o.EtcdRaft); err != nil { | |||
return fmt.Errorf("marshaling etcdraft metadata for orderer type '%s': %v", orderer.ConsensusTypeEtcdRaft, err) | |||
} | |||
case orderer.ConsensusTypeBFT: |
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.
There are many other places where case orderer.ConsensusTypeEtcdRaft:
exists but case orderer.ConsensusTypeBFT:
does not. For example: func (o *OrdererGroup) Configuration() (Orderer, error)
Please scan the project for any function that uses case orderer.ConsensusTypeEtcdRaft:
and see whether BFT needs to be applied there as well.
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
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David VIEJO <[email protected]>
Type of change
Description
Add support for ConsensusTypeBFT in the orderer to be able to use this library to create the channel configuration using golang.
Additional details
None
Related issues
No related issues