Skip to content

Commit 6c23eda

Browse files
committed
[FAB-13727] Clone v1.3 builtin validation plugin
New lifecycle will require the builtin validation plugin to behave differently in several crucial ways. As opposed to inlining capability checks, we simply clone the component, leave the old one unmodified and only change the new one. Change-Id: Ieabce14668c4d733eff86dff5b69c4988df4690d Signed-off-by: Alessandro Sorniotti <ale.linux@sopit.net>
1 parent 2c8c2f0 commit 6c23eda

File tree

10 files changed

+3195
-1
lines changed

10 files changed

+3195
-1
lines changed

core/handlers/validation/builtin/default_validation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
. "github.com/hyperledger/fabric/core/handlers/validation/api/state"
2020
"github.com/hyperledger/fabric/core/handlers/validation/builtin/v12"
2121
"github.com/hyperledger/fabric/core/handlers/validation/builtin/v13"
22+
"github.com/hyperledger/fabric/core/handlers/validation/builtin/v20"
2223
"github.com/hyperledger/fabric/protos/common"
2324
"github.com/pkg/errors"
2425
)
@@ -36,6 +37,7 @@ type DefaultValidation struct {
3637
Capabilities Capabilities
3738
TxValidatorV1_2 TransactionValidator
3839
TxValidatorV1_3 TransactionValidator
40+
TxValidatorV2_0 TransactionValidator
3941
}
4042

4143
//go:generate mockery -dir . -name TransactionValidator -case underscore -output mocks/
@@ -65,7 +67,8 @@ func (v *DefaultValidation) Validate(block *common.Block, namespace string, txPo
6567
var err error
6668
switch {
6769
case v.Capabilities.V2_0Validation():
68-
fallthrough
70+
err = v.TxValidatorV2_0.Validate(block, namespace, txPosition, actionPosition, serializedPolicy.Bytes())
71+
6972
case v.Capabilities.V1_3Validation():
7073
err = v.TxValidatorV1_3.Validate(block, namespace, txPosition, actionPosition, serializedPolicy.Bytes())
7174

@@ -133,6 +136,7 @@ func (v *DefaultValidation) Init(dependencies ...validation.Dependency) error {
133136
v.Capabilities = c
134137
v.TxValidatorV1_2 = v12.New(c, sf, d, pe)
135138
v.TxValidatorV1_3 = v13.New(c, sf, d, pe)
139+
v.TxValidatorV2_0 = v20.New(c, sf, d, pe)
136140

137141
return nil
138142
}

0 commit comments

Comments
 (0)