@@ -15,7 +15,6 @@ import (
1515 "time"
1616
1717 "github.com/google/uuid"
18- "github.com/hyperledger/fabric-x-common/protoutil"
1918 "github.com/stretchr/testify/assert"
2019 "github.com/stretchr/testify/require"
2120 "google.golang.org/protobuf/proto"
@@ -26,10 +25,10 @@ import (
2625 "github.com/hyperledger/fabric-x-committer/mock"
2726 "github.com/hyperledger/fabric-x-committer/service/coordinator/dependencygraph"
2827 "github.com/hyperledger/fabric-x-committer/service/vc"
28+ "github.com/hyperledger/fabric-x-committer/service/verifier/policy"
2929 "github.com/hyperledger/fabric-x-committer/utils/channel"
3030 "github.com/hyperledger/fabric-x-committer/utils/connection"
3131 "github.com/hyperledger/fabric-x-committer/utils/monitoring"
32- "github.com/hyperledger/fabric-x-committer/utils/signature"
3332 "github.com/hyperledger/fabric-x-committer/utils/test"
3433)
3534
@@ -157,14 +156,7 @@ func (e *coordinatorTestEnv) ensureStreamActive(t *testing.T) {
157156
158157func (e * coordinatorTestEnv ) createNamespaces (t * testing.T , blkNum int , nsIDs ... string ) {
159158 t .Helper ()
160- p := & protoblocktx.NamespacePolicy {
161- Type : protoblocktx .PolicyType_THRESHOLD_RULE ,
162- Policy : protoutil .MarshalOrPanic (& protoblocktx.ThresholdRule {
163- Scheme : signature .Ecdsa ,
164- PublicKey : []byte ("publicKey" ),
165- }),
166- }
167- pBytes , err := proto .Marshal (p )
159+ pBytes , err := proto .Marshal (policy .MakeECDSAThresholdRuleNsPolicy ([]byte ("publicKey" )))
168160 require .NoError (t , err )
169161
170162 blockNum := uint64 (blkNum ) //nolint:gosec // int -> uint64.
@@ -258,14 +250,7 @@ func TestCoordinatorServiceValidTx(t *testing.T) {
258250
259251 preMetricsValue := test .GetIntMetricValue (t , env .coordinator .metrics .transactionReceivedTotal )
260252
261- p := & protoblocktx.NamespacePolicy {
262- Type : protoblocktx .PolicyType_THRESHOLD_RULE ,
263- Policy : protoutil .MarshalOrPanic (& protoblocktx.ThresholdRule {
264- Scheme : signature .Ecdsa ,
265- PublicKey : []byte ("publicKey" ),
266- }),
267- }
268- pBytes , err := proto .Marshal (p )
253+ pBytes , err := proto .Marshal (policy .MakeECDSAThresholdRuleNsPolicy ([]byte ("publicKey" )))
269254 require .NoError (t , err )
270255 err = env .csStream .Send (& protocoordinatorservice.Batch {
271256 Txs : []* protocoordinatorservice.Tx {
@@ -378,14 +363,7 @@ func TestCoordinatorServiceDependentOrderedTxs(t *testing.T) {
378363 utNsVersion := uint64 (0 )
379364 mainKey := []byte ("main-key" )
380365 subKey := []byte ("sub-key" )
381- p := & protoblocktx.NamespacePolicy {
382- Type : protoblocktx .PolicyType_THRESHOLD_RULE ,
383- Policy : protoutil .MarshalOrPanic (& protoblocktx.ThresholdRule {
384- Scheme : signature .Ecdsa ,
385- PublicKey : []byte ("public-key" ),
386- }),
387- }
388- pBytes , err := proto .Marshal (p )
366+ pBytes , err := proto .Marshal (policy .MakeECDSAThresholdRuleNsPolicy ([]byte ("publicKey" )))
389367 require .NoError (t , err )
390368
391369 // We send a block with a series of TXs with apparent conflicts, but all should be committed successfully if
@@ -595,13 +573,7 @@ func TestCoordinatorRecovery(t *testing.T) {
595573 // To simulate a failure scenario in which a block is partially committed, we first create block 2
596574 // with two transaction but actual block 2 is supposed to have four transactions. Once the partial block 2
597575 // is committed, we will restart the service and send a full block 2 with all four transactions.
598- nsPolicy , err := proto .Marshal (& protoblocktx.NamespacePolicy {
599- Type : protoblocktx .PolicyType_THRESHOLD_RULE ,
600- Policy : protoutil .MarshalOrPanic (& protoblocktx.ThresholdRule {
601- Scheme : signature .Ecdsa ,
602- PublicKey : []byte ("publicKey" ),
603- }),
604- })
576+ nsPolicy , err := proto .Marshal (policy .MakeECDSAThresholdRuleNsPolicy ([]byte ("publicKey" )))
605577 require .NoError (t , err )
606578 block2 := & protocoordinatorservice.Batch {
607579 Txs : []* protocoordinatorservice.Tx {
0 commit comments