Skip to content

Commit

Permalink
[FAB-12971] Disable prover service and token tx
Browse files Browse the repository at this point in the history
Before v1.4 cut, disable prover service and invalidate token tx
After v1.4 cut, restore the code.

Change-Id: I5e123c59b8fd0416335ec44ceee5f3fa75394495
Signed-off-by: Wenjian Qiao <[email protected]>
  • Loading branch information
wenjianqiao committed Nov 30, 2018
1 parent babe08d commit 64be3b0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 29 deletions.
51 changes: 27 additions & 24 deletions core/committer/txvalidator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,32 +381,35 @@ func (v *TxValidator) validateTx(req *blockValidationRequest, results chan<- *bl
logger.Infof("Find chaincode upgrade transaction for chaincode %s on channel %s with new version %s", upgradeCC.ChaincodeName, upgradeCC.ChainID, upgradeCC.ChaincodeVersion)
txsUpgradedChaincode = upgradeCC
}
} else if common.HeaderType(chdr.Type) == common.HeaderType_TOKEN_TRANSACTION {

txID = chdr.TxId
if !v.Support.Capabilities().FabToken() {
logger.Errorf("FabToken capability is not enabled. Unsupported transaction type [%s] in block [%d] transaction [%d]",
common.HeaderType(chdr.Type), block.Header.Number, tIdx)
results <- &blockValidationResult{
tIdx: tIdx,
validationCode: peer.TxValidationCode_UNSUPPORTED_TX_PAYLOAD,
}
return
}
// FAB-12971 comment out below block before v1.4 cut. Will uncomment after v1.4.
/*
} else if common.HeaderType(chdr.Type) == common.HeaderType_TOKEN_TRANSACTION {
txID = chdr.TxId
if !v.Support.Capabilities().FabToken() {
logger.Errorf("FabToken capability is not enabled. Unsupported transaction type [%s] in block [%d] transaction [%d]",
common.HeaderType(chdr.Type), block.Header.Number, tIdx)
results <- &blockValidationResult{
tIdx: tIdx,
validationCode: peer.TxValidationCode_UNSUPPORTED_TX_PAYLOAD,
}
return
}
// Check if there is a duplicate of such transaction in the ledger and
// obtain the corresponding result that acknowledges the error type
erroneousResultEntry := v.checkTxIdDupsLedger(tIdx, chdr, v.Support.Ledger())
if erroneousResultEntry != nil {
results <- erroneousResultEntry
return
}
// Check if there is a duplicate of such transaction in the ledger and
// obtain the corresponding result that acknowledges the error type
erroneousResultEntry := v.checkTxIdDupsLedger(tIdx, chdr, v.Support.Ledger())
if erroneousResultEntry != nil {
results <- erroneousResultEntry
return
}
// Set the namespace of the invocation field
txsChaincodeName = &sysccprovider.ChaincodeInstance{
ChainID: channel,
ChaincodeName: "Token",
ChaincodeVersion: ""}
// Set the namespace of the invocation field
txsChaincodeName = &sysccprovider.ChaincodeInstance{
ChainID: channel,
ChaincodeName: "Token",
ChaincodeVersion: ""}
*/
} else if common.HeaderType(chdr.Type) == common.HeaderType_CONFIG {
configEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion core/committer/txvalidator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,7 @@ func validateTxWithStateBasedEndorsement(t *testing.T, l ledger.PeerLedger, v tx
}

func TestTokenValidTransaction(t *testing.T) {
t.Skip("Skipping TestTokenValidTransaction until token transaction is enabled after v1.4")
l, v := setupLedgerAndValidatorWithFabTokenCapabilities(t)
defer ledgermgmt.CleanupTestEnv()
defer l.Close()
Expand Down Expand Up @@ -1484,10 +1485,11 @@ func TestTokenCapabilityNotEnabled(t *testing.T) {
// We expect the tx to be invalid because of a duplicate txid
txsfltr := lutils.TxValidationFlags(b.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER])
assertion.True(txsfltr.IsInvalid(0))
assertion.True(txsfltr.Flag(0) == peer.TxValidationCode_UNSUPPORTED_TX_PAYLOAD)
assertion.True(txsfltr.Flag(0) == peer.TxValidationCode_UNKNOWN_TX_TYPE)
}

func TestTokenDuplicateTxId(t *testing.T) {
t.Skip("Skipping TestTokenDuplicateTxId until token transaction is enabled after v1.4")
theLedger := new(mockLedger)
vcs := struct {
*mocktxvalidator.Support
Expand Down
1 change: 1 addition & 0 deletions integration/token/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var _ = Describe("Token EndToEnd", func() {
})

It("executes a basic solo network and submits token transaction", func() {
Skip("Skipping token e2e test until token transaction is enabled after v1.4")
By("getting the orderer by name")
orderer := network.Orderer("orderer")

Expand Down
9 changes: 5 additions & 4 deletions peer/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ func serve(args []string) error {
defer service.GetGossipService().Stop()

// register prover grpc service
err = registerProverService(peerServer, aclProvider, signingIdentity)
if err != nil {
return err
}
// FAB-12971 disable prover service before v1.4 cut. Will uncomment after v1.4 cut
// err = registerProverService(peerServer, aclProvider, signingIdentity)
// if err != nil {
// return err
// }

// initialize system chaincodes

Expand Down

0 comments on commit 64be3b0

Please sign in to comment.