Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
26 changes: 10 additions & 16 deletions integration/token/fungible/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion integration/token/fungible/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
8 changes: 1 addition & 7 deletions integration/token/fungible/views/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 4 additions & 9 deletions token/services/ttx/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion token/services/ttx/collectendorsements.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
11 changes: 0 additions & 11 deletions token/services/ttx/endorse_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Loading