Skip to content

Commit

Permalink
verifier test pass
Browse files Browse the repository at this point in the history
Signed-off-by: May Rosenbaum <mayro1595@gmail.com>
  • Loading branch information
MayRosenbaum committed Apr 17, 2024
1 parent 2396f52 commit 37262c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 99 deletions.
10 changes: 5 additions & 5 deletions integration/lifecycle/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ var _ = Describe("Lifecycle", func() {
currentConfig := nwo.GetConfig(network, testPeers[0], orderer, "testchannel")
updatedConfig := proto.Clone(currentConfig).(*common.Config)

jsonObj, err := json.MarshalIndent(updatedConfig, "", " ")
_ = os.WriteFile("updatedConfig.json", jsonObj, 0644)
jsonObj, _ := json.MarshalIndent(updatedConfig, "", " ")
_ = os.WriteFile("updatedConfig.json", jsonObj, 0o644)

// get the configtx info for org3
sess, err = network.ConfigTxGen(commands.PrintOrg{
Expand All @@ -311,10 +311,10 @@ var _ = Describe("Lifecycle", func() {
org3Group := &ordererext.DynamicOrdererOrgGroup{ConfigGroup: &common.ConfigGroup{}}
err = protolator.DeepUnmarshalJSON(bytes.NewBuffer(sess.Out.Contents()), org3Group)
Expect(err).NotTo(HaveOccurred())
//delete(org3Group.Values, "Endpoints")
// delete(org3Group.Values, "Endpoints")

jsonObj, err = json.MarshalIndent(org3Group, "", " ")
_ = os.WriteFile("org3Group.json", jsonObj, 0644)
jsonObj, _ = json.MarshalIndent(org3Group, "", " ")
_ = os.WriteFile("org3Group.json", jsonObj, 0o644)

// update the channel config to include org3
updatedConfig.ChannelGroup.Groups["Application"].Groups["Org3"] = org3Group.ConfigGroup
Expand Down
96 changes: 2 additions & 94 deletions orderer/common/cluster/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
"encoding/pem"
"errors"
"fmt"
"math"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -798,8 +799,6 @@ func generateCertificatesSmartBFT(confAppSmartBFT *genesisconfig.Profile, certDi
}

func TestBlockVerifierFunc(t *testing.T) {
//block := sampleConfigBlock()

certPath := filepath.Join("testdata", "blockverification", "msp", "signcerts")

conf := genesisconfig.Load(genesisconfig.SampleAppChannelSmartBftProfile, filepath.Join("testdata", "blockverification"))
Expand Down Expand Up @@ -845,97 +844,6 @@ func TestBlockVerifierFunc(t *testing.T) {
require.NoError(t, err)
}

func sampleConfigBlock() *common.Block {
return &common.Block{
Header: &common.BlockHeader{
PreviousHash: []byte("foo"),
},
Data: &common.BlockData{
Data: [][]byte{
protoutil.MarshalOrPanic(&common.Envelope{
Payload: protoutil.MarshalOrPanic(&common.Payload{
Header: &common.Header{
ChannelHeader: protoutil.MarshalOrPanic(&common.ChannelHeader{
Type: int32(common.HeaderType_CONFIG),
ChannelId: "mychannel",
}),
},
Data: protoutil.MarshalOrPanic(&common.ConfigEnvelope{
Config: &common.Config{
ChannelGroup: &common.ConfigGroup{
Values: map[string]*common.ConfigValue{
"Capabilities": {
Value: protoutil.MarshalOrPanic(&common.Capabilities{
Capabilities: map[string]*common.Capability{"V3_0": {}},
}),
},
"HashingAlgorithm": {
Value: protoutil.MarshalOrPanic(&common.HashingAlgorithm{Name: "SHA256"}),
},
"BlockDataHashingStructure": {
Value: protoutil.MarshalOrPanic(&common.BlockDataHashingStructure{Width: math.MaxUint32}),
},
},
Groups: map[string]*common.ConfigGroup{
"Orderer": {
Groups: map[string]*common.ConfigGroup{
"SampleOrg": {},
},
Policies: map[string]*common.ConfigPolicy{
"BlockValidation": {
Policy: &common.Policy{
Type: 3,
},
},
},
Values: map[string]*common.ConfigValue{
"BatchSize": {
Value: protoutil.MarshalOrPanic(&orderer.BatchSize{
MaxMessageCount: 500,
AbsoluteMaxBytes: 10485760,
PreferredMaxBytes: 2097152,
}),
},
"BatchTimeout": {
Value: protoutil.MarshalOrPanic(&orderer.BatchTimeout{
Timeout: "2s",
}),
},
"Capabilities": {
Value: protoutil.MarshalOrPanic(&common.Capabilities{
Capabilities: map[string]*common.Capability{"V3_0": {}},
}),
},
"ConsensusType": {
Value: protoutil.MarshalOrPanic(&common.BlockData{Data: [][]byte{[]byte("BFT")}}),
},
"Orderers": {
Value: protoutil.MarshalOrPanic(&common.Orderers{
ConsenterMapping: []*common.Consenter{
{
Id: 1,
Host: "host1",
Port: 8001,
MspId: "SampleOrg",
Identity: []byte("identity1"),
},
},
}),
},
},
},
},
},
},
}),
}),
Signature: []byte("bar"),
}),
},
},
}
}

func TestGetTLSSessionBinding(t *testing.T) {
serverCert, err := ca.NewServerCertKeyPair("127.0.0.1")
require.NoError(t, err)
Expand Down

0 comments on commit 37262c2

Please sign in to comment.