Skip to content

Commit 63dce37

Browse files
seo kyungsiksykesm
authored andcommitted
[FAB-16499] ChainID -> ChannelID - core/chaincode
- rename TransactionContext.ChainID to ChannelID - rename ChaincodeInstance.ChainID to ChannelID - rename TxValidator.ChainID to ChannelID - rename util2.GetTestChainID() to util2.GetTestChannelID() - rename VsccValidatorImpl.chainID to channelID Signed-off-by: seo kyungsik <iamksseo@naver.com> Change-Id: Iee0318e75c94989f25b6fe95a843d9674b247af4
1 parent b61b352 commit 63dce37

39 files changed

+323
-323
lines changed

common/ledger/blkstorage/fsblkstorage/metrics_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestStatsBlockchainHeight(t *testing.T) {
2828
defer store.Shutdown()
2929

3030
// add genesis block
31-
blockGenerator, genesisBlock := testutil.NewBlockGenerator(t, util.GetTestChainID(), false)
31+
blockGenerator, genesisBlock := testutil.NewBlockGenerator(t, util.GetTestChannelID(), false)
3232
err = store.AddBlock(genesisBlock)
3333
assert.NoError(t, err)
3434

@@ -81,7 +81,7 @@ func TestStatsBlockCommit(t *testing.T) {
8181
defer store.Shutdown()
8282

8383
// add a genesis block
84-
blockGenerator, genesisBlock := testutil.NewBlockGenerator(t, util.GetTestChainID(), false)
84+
blockGenerator, genesisBlock := testutil.NewBlockGenerator(t, util.GetTestChannelID(), false)
8585
err = store.AddBlock(genesisBlock)
8686
assert.NoError(t, err)
8787

common/ledger/testutil/test_helper.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func ConstructTransactionFromTxDetails(txDetails *TxDetails, sign bool) (*common
156156
var txID string
157157
if sign {
158158
txEnv, txID, err = ConstructSignedTxEnvWithDefaultSigner(
159-
util.GetTestChainID(),
159+
util.GetTestChannelID(),
160160
ccid,
161161
nil,
162162
txDetails.SimulationResults,
@@ -167,7 +167,7 @@ func ConstructTransactionFromTxDetails(txDetails *TxDetails, sign bool) (*common
167167
)
168168
} else {
169169
txEnv, txID, err = ConstructUnsignedTxEnv(
170-
util.GetTestChainID(),
170+
util.GetTestChannelID(),
171171
ccid,
172172
nil,
173173
txDetails.SimulationResults,
@@ -269,7 +269,7 @@ func ConstructTestBlock(t *testing.T, blockNum uint64, numTx int, txSize int) *c
269269
// The first block in the returned array is a config tx block that represents a genesis block
270270
// Except the genesis block, the size of each of the block would be the same.
271271
func ConstructTestBlocks(t *testing.T, numBlocks int) []*common.Block {
272-
bg, gb := NewBlockGenerator(t, util.GetTestChainID(), false)
272+
bg, gb := NewBlockGenerator(t, util.GetTestChannelID(), false)
273273
blocks := []*common.Block{}
274274
if numBlocks != 0 {
275275
blocks = append(blocks, gb)
@@ -283,7 +283,7 @@ func ConstructBytesProposalResponsePayload(version string, simulationResults []b
283283
Name: "foo",
284284
Version: version,
285285
}
286-
return constructBytesProposalResponsePayload(util.GetTestChainID(), ccid, nil, simulationResults)
286+
return constructBytesProposalResponsePayload(util.GetTestChannelID(), ccid, nil, simulationResults)
287287
}
288288

289289
func NewBlock(env []*common.Envelope, blockNum uint64, previousHash []byte) *common.Block {
@@ -301,13 +301,13 @@ func NewBlock(env []*common.Envelope, blockNum uint64, previousHash []byte) *com
301301
}
302302

303303
// constructBytesProposalResponsePayload constructs a ProposalResponsePayload byte for tests with a default signer.
304-
func constructBytesProposalResponsePayload(chainID string, ccid *pb.ChaincodeID, pResponse *pb.Response, simulationResults []byte) ([]byte, error) {
304+
func constructBytesProposalResponsePayload(channelID string, ccid *pb.ChaincodeID, pResponse *pb.Response, simulationResults []byte) ([]byte, error) {
305305
ss, err := signer.Serialize()
306306
if err != nil {
307307
return nil, err
308308
}
309309

310-
prop, _, err := protoutil.CreateChaincodeProposal(common.HeaderType_ENDORSER_TRANSACTION, chainID, &pb.ChaincodeInvocationSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: ccid}}, ss)
310+
prop, _, err := protoutil.CreateChaincodeProposal(common.HeaderType_ENDORSER_TRANSACTION, channelID, &pb.ChaincodeInvocationSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: ccid}}, ss)
311311
if err != nil {
312312
return nil, err
313313
}
@@ -375,7 +375,7 @@ func ConstructUnsignedTxEnv(
375375

376376
// ConstructSignedTxEnv constructs a transaction envelop for tests
377377
func ConstructSignedTxEnv(
378-
chainID string,
378+
channelID string,
379379
ccid *pb.ChaincodeID,
380380
pResponse *pb.Response,
381381
simulationResults []byte,
@@ -395,7 +395,7 @@ func ConstructSignedTxEnv(
395395
// if txid is not set, then we need to generate one while creating the proposal message
396396
prop, txid, err = protoutil.CreateChaincodeProposal(
397397
common.HeaderType_ENDORSER_TRANSACTION,
398-
chainID,
398+
channelID,
399399
&pb.ChaincodeInvocationSpec{
400400
ChaincodeSpec: &pb.ChaincodeSpec{
401401
ChaincodeId: ccid,
@@ -413,7 +413,7 @@ func ConstructSignedTxEnv(
413413
prop, txid, err = protoutil.CreateChaincodeProposalWithTxIDNonceAndTransient(
414414
txid,
415415
headerType,
416-
chainID,
416+
channelID,
417417
&pb.ChaincodeInvocationSpec{
418418
ChaincodeSpec: &pb.ChaincodeSpec{
419419
ChaincodeId: ccid,

common/util/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func ToChaincodeArgs(args ...string) [][]byte {
8181

8282
const testchainid = "testchainid"
8383

84-
//GetTestChainID returns the CHAINID constant in use by orderer
85-
func GetTestChainID() string {
84+
//GetTestChannelID returns the CHANNELID constant in use by orderer
85+
func GetTestChannelID() string {
8686
return testchainid
8787
}
8888

core/chaincode/chaincode_support_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (meqe *mockExecQuerySimulator) GetTxSimulationResults() ([]byte, error) {
150150
}
151151

152152
//initialize peer and start up. If security==enabled, login as vp
153-
func initMockPeer(chainIDs ...string) (*peer.Peer, *ChaincodeSupport, func(), error) {
153+
func initMockPeer(channelIDs ...string) (*peer.Peer, *ChaincodeSupport, func(), error) {
154154
cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
155155
if err != nil {
156156
panic(fmt.Sprintf("failed to create cryptoProvider: %s", err))
@@ -248,25 +248,25 @@ func initMockPeer(chainIDs ...string) (*peer.Peer, *ChaincodeSupport, func(), er
248248

249249
scc.DeploySysCC(lsccImpl, chaincodeSupport)
250250

251-
globalBlockNum = make(map[string]uint64, len(chainIDs))
252-
for _, id := range chainIDs {
251+
globalBlockNum = make(map[string]uint64, len(channelIDs))
252+
for _, id := range channelIDs {
253253
if err := peer.CreateMockChannel(peerInstance, id); err != nil {
254254
cleanup()
255255
return nil, nil, func() {}, err
256256
}
257257

258-
// any chain other than the default testchainid does not have a MSP set up -> create one
259-
if id != util.GetTestChainID() {
260-
mspmgmt.XXXSetMSPManager(id, mspmgmt.GetManagerForChain(util.GetTestChainID()))
258+
// any channel other than the default testchainid does not have a MSP set up -> create one
259+
if id != util.GetTestChannelID() {
260+
mspmgmt.XXXSetMSPManager(id, mspmgmt.GetManagerForChain(util.GetTestChannelID()))
261261
}
262262
globalBlockNum[id] = 1
263263
}
264264

265265
return peerInstance, chaincodeSupport, cleanup, nil
266266
}
267267

268-
func finitMockPeer(peerInstance *peer.Peer, chainIDs ...string) {
269-
for _, c := range chainIDs {
268+
func finitMockPeer(peerInstance *peer.Peer, channelIDs ...string) {
269+
for _, c := range channelIDs {
270270
if lgr := peerInstance.GetLedger(c); lgr != nil {
271271
lgr.Close()
272272
}
@@ -308,16 +308,16 @@ func processDone(t *testing.T, done chan error, expecterr bool) {
308308
}
309309
}
310310

311-
func startTx(t *testing.T, peerInstance *peer.Peer, chainID string, cis *pb.ChaincodeInvocationSpec, txId string) (*ccprovider.TransactionParams, ledger.TxSimulator) {
311+
func startTx(t *testing.T, peerInstance *peer.Peer, channelID string, cis *pb.ChaincodeInvocationSpec, txId string) (*ccprovider.TransactionParams, ledger.TxSimulator) {
312312
creator := []byte([]byte("Alice"))
313-
sprop, prop := protoutil.MockSignedEndorserProposalOrPanic(chainID, cis.ChaincodeSpec, creator, []byte("msg1"))
314-
txsim, hqe, err := startTxSimulation(peerInstance, chainID, txId)
313+
sprop, prop := protoutil.MockSignedEndorserProposalOrPanic(channelID, cis.ChaincodeSpec, creator, []byte("msg1"))
314+
txsim, hqe, err := startTxSimulation(peerInstance, channelID, txId)
315315
if err != nil {
316316
t.Fatalf("getting txsimulator failed %s", err)
317317
}
318318

319319
txParams := &ccprovider.TransactionParams{
320-
ChannelID: chainID,
320+
ChannelID: channelID,
321321
TxID: txId,
322322
Proposal: prop,
323323
SignedProp: sprop,

0 commit comments

Comments
 (0)