Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/hyperledger-labs/SmartBFT v0.0.0-20240916013553-852e5be5889b
github.com/hyperledger/fabric-config v0.3.0
github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.7
github.com/miekg/pkcs11 v1.1.1 // indirect
Expand Down
17 changes: 16 additions & 1 deletion tools/cryptogen/config_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ConfigBlockParameters struct {
ChannelID string
ArmaPath string
Organizations []OrganizationParameters
Namespaces []string
}

// OrganizationParameters represents the properties of an organization.
Expand Down Expand Up @@ -132,7 +133,21 @@ func CreateDefaultConfigBlockWithCrypto(conf ConfigBlockParameters) (*common.Blo
}

// We generate a fake organization for the meta namespace.
metaSpec := OrgSpec{Name: metaNamespaceOrg, Domain: metaNamespaceOrg}
// The admin user will be used as the meta-namespace key.
// We create a user for each namespace to be used as its key.
metaSpec := OrgSpec{
Name: metaNamespaceOrg,
Domain: metaNamespaceOrg,
Users: UsersSpec{
Specs: make([]UserSpec, len(conf.Namespaces)),
},
}
for i, ns := range conf.Namespaces {
metaSpec.Users.Specs[i] = UserSpec{
Name: ns,
}
}

cryptoConf.GenericOrgs = append(cryptoConf.GenericOrgs, metaSpec)
profile.Application.MetaNamespaceVerificationKeyPath = path.Join(
GenericOrganizationsDir, metaNamespaceOrg, MSPDir, AdminCertsDir,
Expand Down
8 changes: 7 additions & 1 deletion tools/cryptogen/config_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestMakeConfig(t *testing.T) {
block, err := CreateDefaultConfigBlockWithCrypto(ConfigBlockParameters{
TargetPath: target,
ChannelID: chanName,
Namespaces: []string{"ns-1", "ns-2"},
Organizations: []OrganizationParameters{
{ // Joint org with two ordering parties.
Name: "org-1",
Expand Down Expand Up @@ -99,7 +100,12 @@ func TestMakeConfig(t *testing.T) {

t.Log(test.GetTree(t, target))

var expectedDirs []string //nolint:prealloc // Hard to estimate size.
expectedDirs := []string{
filepath.Join(GenericOrganizationsDir, "meta-namespace", "msp"),
filepath.Join(GenericOrganizationsDir, "meta-namespace", "users", "Admin@meta-namespace"),
filepath.Join(GenericOrganizationsDir, "meta-namespace", "users", "ns-1@meta-namespace"),
filepath.Join(GenericOrganizationsDir, "meta-namespace", "users", "ns-2@meta-namespace"),
}

org1Dir := filepath.Join(GenericOrganizationsDir, "org-1")
org2Dir := filepath.Join(OrdererOrganizationsDir, "org-2")
Expand Down