Skip to content

Commit 7da2338

Browse files
author
Jason Yellick
committed
Fix import cycle after merge
Despite the verification running and returning positive, the merge seems to have created an import cycle, this changeset fixes that. Change-Id: I903766efa524f942d8389bebea27ca0b4e373aa5 Signed-off-by: Jason Yellick <[email protected]>
1 parent ea69374 commit 7da2338

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

orderer/multichain/manager_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestNewChain(t *testing.T) {
150150
oldConfigEnv := utils.UnmarshalConfigurationEnvelopeOrPanic(oldGenesisTxPayload.Data)
151151

152152
newChainID := "TestNewChain"
153-
newChainMessage := ab.ChainCreationConfigurationTransaction(static.AcceptAllPolicyKey, newChainID, oldConfigEnv)
153+
newChainMessage := utils.ChainCreationConfigurationTransaction(static.AcceptAllPolicyKey, newChainID, oldConfigEnv)
154154

155155
status := manager.ProposeChain(newChainMessage)
156156

orderer/multichain/systemchain.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/hyperledger/fabric/orderer/common/sharedconfig"
2727
cb "github.com/hyperledger/fabric/protos/common"
2828
ab "github.com/hyperledger/fabric/protos/orderer"
29+
"github.com/hyperledger/fabric/protos/utils"
2930

3031
"github.com/golang/protobuf/proto"
3132
)
@@ -153,7 +154,7 @@ func (sc *systemChain) authorize(configEnvelope *cb.ConfigurationEnvelope) cb.St
153154
return cb.Status_BAD_REQUEST
154155
}
155156

156-
if creationConfigItem.Key != ab.CreationPolicyKey {
157+
if creationConfigItem.Key != utils.CreationPolicyKey {
157158
logger.Debugf("Failing to validate chain creation because first configuration item was not the CreationPolicy")
158159
return cb.Status_BAD_REQUEST
159160
}

orderer/multichain/systemchain_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func TestGoodProposal(t *testing.T) {
128128
ChainID: newChainID,
129129
Type: int32(cb.HeaderType_CONFIGURATION_ITEM),
130130
},
131-
Key: ab.CreationPolicyKey,
131+
Key: utils.CreationPolicyKey,
132132
Type: cb.ConfigurationItem_Orderer,
133133
Value: utils.MarshalOrPanic(&ab.CreationPolicy{
134134
Policy: static.AcceptAllPolicyKey,
@@ -185,7 +185,7 @@ func TestProposalWithBadPolicy(t *testing.T) {
185185
mcc.ms.mpm.mp = &mockPolicy{}
186186

187187
chainCreateTx := &cb.ConfigurationItem{
188-
Key: ab.CreationPolicyKey,
188+
Key: utils.CreationPolicyKey,
189189
Type: cb.ConfigurationItem_Orderer,
190190
Value: utils.MarshalOrPanic(&ab.CreationPolicy{
191191
Policy: static.AcceptAllPolicyKey,
@@ -208,7 +208,7 @@ func TestProposalWithMissingPolicy(t *testing.T) {
208208
mcc.ms.msc.chainCreators = []string{static.AcceptAllPolicyKey}
209209

210210
chainCreateTx := &cb.ConfigurationItem{
211-
Key: ab.CreationPolicyKey,
211+
Key: utils.CreationPolicyKey,
212212
Type: cb.ConfigurationItem_Orderer,
213213
Value: utils.MarshalOrPanic(&ab.CreationPolicy{
214214
Policy: static.AcceptAllPolicyKey,
@@ -232,7 +232,7 @@ func TestProposalWithBadDigest(t *testing.T) {
232232
mcc.ms.msc.chainCreators = []string{static.AcceptAllPolicyKey}
233233

234234
chainCreateTx := &cb.ConfigurationItem{
235-
Key: ab.CreationPolicyKey,
235+
Key: utils.CreationPolicyKey,
236236
Type: cb.ConfigurationItem_Orderer,
237237
Value: utils.MarshalOrPanic(&ab.CreationPolicy{
238238
Policy: static.AcceptAllPolicyKey,

orderer/sample_clients/broadcast_config/newchain.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package main
1919
import (
2020
"github.com/hyperledger/fabric/orderer/common/bootstrap/static"
2121
cb "github.com/hyperledger/fabric/protos/common"
22-
ab "github.com/hyperledger/fabric/protos/orderer"
2322
"github.com/hyperledger/fabric/protos/utils"
2423
)
2524

@@ -39,5 +38,5 @@ func newChainRequest(creationPolicy, newChainID string) *cb.Envelope {
3938
oldGenesisTxPayload := utils.ExtractPayloadOrPanic(oldGenesisTx)
4039
oldConfigEnv := utils.UnmarshalConfigurationEnvelopeOrPanic(oldGenesisTxPayload.Data)
4140

42-
return ab.ChainCreationConfigurationTransaction(static.AcceptAllPolicyKey, newChainID, oldConfigEnv)
41+
return utils.ChainCreationConfigurationTransaction(static.AcceptAllPolicyKey, newChainID, oldConfigEnv)
4342
}

protos/utils/blockutils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121

2222
"github.com/golang/protobuf/proto"
2323

24-
"github.com/hyperledger/fabric/orderer/common/cauthdsl"
25-
"github.com/hyperledger/fabric/orderer/common/configtx"
24+
"github.com/hyperledger/fabric/common/cauthdsl"
25+
"github.com/hyperledger/fabric/common/configtx"
2626
cb "github.com/hyperledger/fabric/protos/common"
2727
ab "github.com/hyperledger/fabric/protos/orderer"
2828
)

protos/orderer/configuration.go protos/utils/configuration.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package orderer
17+
package utils
1818

1919
import (
2020
cu "github.com/hyperledger/fabric/core/util"
2121
cb "github.com/hyperledger/fabric/protos/common"
22-
"github.com/hyperledger/fabric/protos/utils"
22+
ab "github.com/hyperledger/fabric/protos/orderer"
2323
)
2424

2525
const CreationPolicyKey = "CreationPolicy"
@@ -34,25 +34,25 @@ func ChainCreationConfiguration(creationPolicy, newChainID string, template *cb.
3434
var hashBytes []byte
3535

3636
for i, item := range template.Items {
37-
configItem := utils.UnmarshalConfigurationItemOrPanic(item.ConfigurationItem)
37+
configItem := UnmarshalConfigurationItemOrPanic(item.ConfigurationItem)
3838
configItem.Header.ChainID = newChainID
3939
newConfigItems[i] = &cb.SignedConfigurationItem{
40-
ConfigurationItem: utils.MarshalOrPanic(configItem),
40+
ConfigurationItem: MarshalOrPanic(configItem),
4141
}
4242
hashBytes = append(hashBytes, newConfigItems[i].ConfigurationItem...)
4343
}
4444

4545
digest := cu.ComputeCryptoHash(hashBytes)
4646

4747
authorizeItem := &cb.SignedConfigurationItem{
48-
ConfigurationItem: utils.MarshalOrPanic(&cb.ConfigurationItem{
48+
ConfigurationItem: MarshalOrPanic(&cb.ConfigurationItem{
4949
Header: &cb.ChainHeader{
5050
ChainID: newChainID,
5151
Type: int32(cb.HeaderType_CONFIGURATION_ITEM),
5252
},
5353
Type: cb.ConfigurationItem_Orderer,
5454
Key: CreationPolicyKey,
55-
Value: utils.MarshalOrPanic(&CreationPolicy{
55+
Value: MarshalOrPanic(&ab.CreationPolicy{
5656
Policy: creationPolicy,
5757
Digest: digest,
5858
}),
@@ -73,14 +73,14 @@ func ChainCreationConfigurationTransaction(creationPolicy, newChainID string, te
7373
configurationEnvelope := ChainCreationConfiguration(creationPolicy, newChainID, template)
7474

7575
newGenesisTx := &cb.Envelope{
76-
Payload: utils.MarshalOrPanic(&cb.Payload{
76+
Payload: MarshalOrPanic(&cb.Payload{
7777
Header: &cb.Header{
7878
ChainHeader: &cb.ChainHeader{
7979
Type: int32(cb.HeaderType_CONFIGURATION_TRANSACTION),
8080
ChainID: newChainID,
8181
},
8282
},
83-
Data: utils.MarshalOrPanic(configurationEnvelope),
83+
Data: MarshalOrPanic(configurationEnvelope),
8484
}),
8585
}
8686

0 commit comments

Comments
 (0)