Add support for ConsensusTypeBFT in the orderer.go#62
Add support for ConsensusTypeBFT in the orderer.go#62dviejokfs wants to merge 11 commits intohyperledger:mainfrom
Conversation
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
|
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/golang/protobuf/proto" | ||
| "github.com/hyperledger/fabric-config/configtx/internal/policydsl" | ||
| "github.com/hyperledger/fabric-config/configtx/orderer" | ||
| "github.com/hyperledger/fabric-protos-go/common" |
There was a problem hiding this comment.
this is already imported with alias cb
| ConsensusTypeEtcdRaft = "etcdraft" | ||
|
|
||
| // ConsensusTypeBFT identifies the SmartBFT-based consensus implementation. | ||
| ConsensusTypeBFT = "BFT" |
There was a problem hiding this comment.
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.
why is the op object cloned before it is marshalled?
marshalling creates a deep copy, this is unnecessary.
configtx/orderer.go
Outdated
| SmartBFT *sb.Options | ||
| ConsenterMapping []common.Consenter |
There was a problem hiding this comment.
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.
| EtcdRaft orderer.EtcdRaft | ||
| Organizations []Organization | ||
|
|
||
| SmartBFT *sb.Options |
There was a problem hiding this comment.
are you sure? in Fabric 3.0 it's SmartBFT
| Kafka orderer.Kafka | ||
| EtcdRaft orderer.EtcdRaft | ||
| Organizations []Organization | ||
|
|
There was a problem hiding this comment.
Add line comments on these, and update the comment on the type, above, only EtcdRaft and BFT are supported.
configtx/orderer.go
Outdated
| } | ||
| } | ||
|
|
||
| func encodeBFTBlockVerificationPolicy(consenterProtos []common.Consenter, ordererGroup *cb.ConfigGroup) error { |
There was a problem hiding this comment.
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.
Yes, then how do you prefer to resolve it?
| 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.
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.
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
- Bump Go version to 1.22.0 and set toolchain to go1.23.5 in go.mod. - Update indirect dependencies in go.mod and go.sum, including: - Upgrade `golang.org/x/net` to v0.34.0 - Upgrade `golang.org/x/sys` to v0.29.0 - Upgrade `golang.org/x/text` to v0.21.0 - Upgrade `google.golang.org/grpc` to v1.67.3 - Upgrade `google.golang.org/protobuf` to v1.36.3 - Add `github.com/hyperledger/fabric-protos-go-apiv2` v0.3.7 - Refactor proto imports across multiple files to use `github.com/hyperledger/fabric-protos-go-apiv2` instead of `github.com/hyperledger/fabric-protos-go`. Signed-off-by: dviejokfs <dviejo@kfs.es>

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