diff --git a/pubsignals/linkedMultiQuery.go b/pubsignals/linkedMultiQuery.go index 028ddfd..553171e 100644 --- a/pubsignals/linkedMultiQuery.go +++ b/pubsignals/linkedMultiQuery.go @@ -58,8 +58,8 @@ func (c *LinkedMultiQuery) VerifyQuery( return outputs, err } - requests := []QueryRequest{} - querySignalsMeta := make(queryMetaPubSignals, len(c.CircuitQueryHash)) + requests := []queryRequest{} + querySignalsMeta := make(queriesMetaPubSignals, len(c.CircuitQueryHash)) for i, q := range c.CircuitQueryHash { querySignalsMeta[i] = struct { OperatorOutput *big.Int @@ -99,7 +99,7 @@ func (c *LinkedMultiQuery) VerifyQuery( }{QueryMetadata: &queriesMetadata[i], QueryHash: queryHash}) } - sortedPubsignalsMetadata := make(queryMetaPubSignals, len(c.CircuitQueryHash)) + sortedPubsignalsMetadata := make(queriesMetaPubSignals, len(c.CircuitQueryHash)) copy(sortedPubsignalsMetadata, querySignalsMeta) sort.Sort(sortedPubsignalsMetadata) @@ -136,21 +136,21 @@ func (c *LinkedMultiQuery) VerifyQuery( return outputs, nil } -type QueryRequest struct { +type queryRequest struct { QueryMetadata *QueryMetadata QueryHash *big.Int } -type QueryMetaPubSignals struct { +type queryMetaPubSignals struct { OperatorOutput *big.Int QueryHash *big.Int } -type queryMetaPubSignals []QueryMetaPubSignals +type queriesMetaPubSignals []queryMetaPubSignals -func (q queryMetaPubSignals) Len() int { return len(q) } -func (q queryMetaPubSignals) Swap(i, j int) { q[i], q[j] = q[j], q[i] } -func (q queryMetaPubSignals) Less(i, j int) bool { return q[i].QueryHash.Cmp(q[j].QueryHash) < 0 } +func (q queriesMetaPubSignals) Len() int { return len(q) } +func (q queriesMetaPubSignals) Swap(i, j int) { q[i], q[j] = q[j], q[i] } +func (q queriesMetaPubSignals) Less(i, j int) bool { return q[i].QueryHash.Cmp(q[j].QueryHash) < 0 } -type queryRequests []QueryRequest +type queryRequests []queryRequest func (q queryRequests) Len() int { return len(q) } func (q queryRequests) Swap(i, j int) { q[i], q[j] = q[j], q[i] } diff --git a/pubsignals/query.go b/pubsignals/query.go index 0b5780d..1c2ca0a 100644 --- a/pubsignals/query.go +++ b/pubsignals/query.go @@ -180,11 +180,10 @@ func (q Query) verifyClaimInclusion(pubSig *CircuitOutputs, if pubSig.ClaimPathNotExists == 1 { return errors.New("proof doesn't contains target query key") } - } else { - - if metadata.SlotIndex != pubSig.SlotIndex { - return errors.New("proof was generated for another slot") - } + return nil + } + if metadata.SlotIndex != pubSig.SlotIndex { + return errors.New("proof was generated for another slot") } return nil diff --git a/pubsignals/queryCredentialSubjectV3.go b/pubsignals/queryCredentialSubjectV3.go index 4dbc2f4..deba26b 100644 --- a/pubsignals/queryCredentialSubjectV3.go +++ b/pubsignals/queryCredentialSubjectV3.go @@ -50,7 +50,7 @@ func verifyCredentialSubjectV3( for i := pubSig.ValueArraySize; i < len(pubSig.Value); i++ { if pubSig.Value[i].Cmp(new(big.Int)) != 0 { - return errors.New("signal values other then values queries must be set to zero.") + return errors.New("signal values other then values queries must be set to zero") } }