diff --git a/go.mod b/go.mod index 777bec5a89..b0951ba8f0 100644 --- a/go.mod +++ b/go.mod @@ -260,6 +260,7 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect + go.etcd.io/gofail v0.1.0 // indirect go.mongodb.org/mongo-driver/v2 v2.5.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect diff --git a/go.sum b/go.sum index 0a50b8163d..239a9d4613 100644 --- a/go.sum +++ b/go.sum @@ -1572,6 +1572,8 @@ github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaD go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg= +go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M= go.mongodb.org/mongo-driver/v2 v2.5.0 h1:yXUhImUjjAInNcpTcAlPHiT7bIXhshCTL3jVBkF3xaE= go.mongodb.org/mongo-driver/v2 v2.5.0/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/integration/token/fungible/support.go b/integration/token/fungible/support.go index b8d983c571..23e60534e5 100644 --- a/integration/token/fungible/support.go +++ b/integration/token/fungible/support.go @@ -102,15 +102,11 @@ func IssueCash(network *integration.Infrastructure, wallet string, typ token.Typ } func IssueSuccessfulCash(network *integration.Infrastructure, wallet string, typ token.Type, amount uint64, receiver *token3.NodeReference, auditor *token3.NodeReference, anonymous bool, issuer *token3.NodeReference, finalities ...*token3.NodeReference) string { - return issueCashForTMSID(network, wallet, typ, amount, receiver, auditor, anonymous, issuer, nil, finalities, false, []string{}) + return issueCashForTMSID(network, wallet, typ, amount, receiver, auditor, anonymous, issuer, nil, finalities, []string{}) } func IssueCashForTMSID(network *integration.Infrastructure, wallet string, typ token.Type, amount uint64, receiver *token3.NodeReference, auditor *token3.NodeReference, anonymous bool, issuer *token3.NodeReference, tmsId *token2.TMSID, expectedErrorMsgs ...string) string { - return issueCashForTMSID(network, wallet, typ, amount, receiver, auditor, anonymous, issuer, tmsId, []*token3.NodeReference{}, false, expectedErrorMsgs) -} - -func IssueCashWithNoAuditorSigVerification(network *integration.Infrastructure, wallet string, typ token.Type, amount uint64, receiver *token3.NodeReference, auditor *token3.NodeReference, anonymous bool, issuer *token3.NodeReference, expectedErrorMsgs ...string) string { - return issueCashForTMSID(network, wallet, typ, amount, receiver, auditor, anonymous, issuer, nil, []*token3.NodeReference{}, true, expectedErrorMsgs) + return issueCashForTMSID(network, wallet, typ, amount, receiver, auditor, anonymous, issuer, tmsId, []*token3.NodeReference{}, expectedErrorMsgs) } func issueCashForTMSID( @@ -124,19 +120,17 @@ func issueCashForTMSID( issuer *token3.NodeReference, tmsId *token2.TMSID, endorsers []*token3.NodeReference, - skipAuditorSignatureVerification bool, expectedErrorMsgs []string, ) string { txIDBoxed, err := network.Client(issuer.ReplicaName()).CallView("issue", common.JSONMarshall(&views.IssueCash{ - Anonymous: anonymous, - Auditor: auditor.Id(), - IssuerWallet: wallet, - TokenType: typ, - Quantity: amount, - Recipient: network.Identity(receiver.Id()), - RecipientEID: receiver.Id(), - TMSID: tmsId, - SkipAuditorSignatureVerification: skipAuditorSignatureVerification, + Anonymous: anonymous, + Auditor: auditor.Id(), + IssuerWallet: wallet, + TokenType: typ, + Quantity: amount, + Recipient: network.Identity(receiver.Id()), + RecipientEID: receiver.Id(), + TMSID: tmsId, })) topology.ToOptions(network.FscPlatform.Peers[0].Options).Endorser() diff --git a/integration/token/fungible/tests.go b/integration/token/fungible/tests.go index 3998b21cfb..79f1bbdb11 100644 --- a/integration/token/fungible/tests.go +++ b/integration/token/fungible/tests.go @@ -909,7 +909,7 @@ func TestPublicParamsUpdate(network *integration.Infrastructure, newAuditorID st if updateWithAppend { IssueCash(network, "", "USD", 110, alice, auditor, true, newIssuer) } else { - IssueCashWithNoAuditorSigVerification(network, "", "USD", 110, alice, auditor, true, newIssuer, "is not in auditors") + IssueCash(network, "", "USD", 110, alice, auditor, true, newIssuer, "failed verifying auditor signature") } } diff --git a/integration/token/fungible/views/issue.go b/integration/token/fungible/views/issue.go index 30980ae651..86cf4f0d85 100644 --- a/integration/token/fungible/views/issue.go +++ b/integration/token/fungible/views/issue.go @@ -38,8 +38,6 @@ type IssueCash struct { RecipientWalletID string // RecipientEID is the expected enrolment id of the recipient RecipientEID string - // SkipAuditorSignatureVerification set to true to skip the verification of the auditor signature during endorsement collection - SkipAuditorSignatureVerification bool } type IssueCashView struct { @@ -122,11 +120,7 @@ func (p *IssueCashView) Call(context view.Context) (interface{}, error) { // Before completing, all recipients receive the approved transaction. // Depending on the token driver implementation, the recipient's signature might or might not be needed to make // the token transaction valid. - var eOpts []ttx.EndorsementsOpt - if p.SkipAuditorSignatureVerification { - eOpts = append(eOpts, ttx.WithSkipAuditorSignatureVerification()) - } - _, err = context.RunView(ttx.NewCollectEndorsementsView(tx, eOpts...)) + _, err = context.RunView(ttx.NewCollectEndorsementsView(tx)) assert.NoError(err, "failed to sign issue transaction for "+tx.ID()) // Sanity checks: diff --git a/token/services/ttx/auditor.go b/token/services/ttx/auditor.go index c71a8e5161..e8d550d751 100644 --- a/token/services/ttx/auditor.go +++ b/token/services/ttx/auditor.go @@ -123,13 +123,12 @@ func (r *RegisterAuditorView) Call(context view.Context) (interface{}, error) { } type AuditingViewInitiator struct { - tx *Transaction - local bool - skipAuditorSignatureVerification bool + tx *Transaction + local bool } -func newAuditingViewInitiator(tx *Transaction, local, skipAuditorSignatureVerification bool) *AuditingViewInitiator { - return &AuditingViewInitiator{tx: tx, local: local, skipAuditorSignatureVerification: skipAuditorSignatureVerification} +func newAuditingViewInitiator(tx *Transaction, local bool) *AuditingViewInitiator { + return &AuditingViewInitiator{tx: tx, local: local} } func (a *AuditingViewInitiator) Call(context view.Context) (interface{}, error) { @@ -237,10 +236,6 @@ func (a *AuditingViewInitiator) startLocal(context view.Context) (view.Session, func (a *AuditingViewInitiator) verifyAuditorSignature(context view.Context, signature []byte) (token.Identity, error) { logger.DebugfContext(context.Context(), "Validate auditing") - if a.skipAuditorSignatureVerification { - return a.tx.Opts.Auditor, nil - } - // check the signature signed, err := a.tx.MarshallToAudit() if err != nil { diff --git a/token/services/ttx/collectendorsements.go b/token/services/ttx/collectendorsements.go index 1a0920eee7..a6a19a1817 100644 --- a/token/services/ttx/collectendorsements.go +++ b/token/services/ttx/collectendorsements.go @@ -368,7 +368,7 @@ func (c *CollectEndorsementsView) requestAudit(context view.Context) ([]view.Ide return nil, errors.Wrapf(err, "failed getting sig service for [%s]", c.tx.Opts.Auditor) } local := sigService.IsMe(context.Context(), c.tx.Opts.Auditor) - sessionBoxed, err := context.RunView(newAuditingViewInitiator(c.tx, local, c.Opts.SkipAuditorSignatureVerification)) + sessionBoxed, err := context.RunView(newAuditingViewInitiator(c.tx, local)) if err != nil { return nil, errors.WithMessagef(err, "failed requesting auditing from [%s]", c.tx.Opts.Auditor.String()) } diff --git a/token/services/ttx/endorse_opts.go b/token/services/ttx/endorse_opts.go index 96bc32e7ef..6c3b3c4d7e 100644 --- a/token/services/ttx/endorse_opts.go +++ b/token/services/ttx/endorse_opts.go @@ -10,8 +10,6 @@ package ttx type EndorsementsOpts struct { // SkipAuditing set it to true to skip the auditing phase SkipAuditing bool - // SkipAuditorSignatureVerification set it to true to skip the verification of the auditor signature - SkipAuditorSignatureVerification bool // SkipApproval set it to true to skip the approval phase SkipApproval bool // SkipDistributeEnv set it to true to skip the distribution phase @@ -52,15 +50,6 @@ func WithSkipAuditing() EndorsementsOpt { } } -// WithSkipAuditorSignatureVerification to skip auditor signature verification -func WithSkipAuditorSignatureVerification() EndorsementsOpt { - return func(o *EndorsementsOpts) error { - o.SkipAuditorSignatureVerification = true - - return nil - } -} - // WithSkipApproval to skip approval func WithSkipApproval() EndorsementsOpt { return func(o *EndorsementsOpts) error {