11package attestation
22
33import (
4- "bytes"
54 "context"
65 "encoding/hex"
7- "errors"
86 "fmt"
97 "math"
108 "math/big"
119 "sync"
1210
11+ "github.com/flare-foundation/fdc-client/client/utils"
1312 "github.com/flare-foundation/go-flare-common/pkg/contracts/fdchub"
1413 "github.com/flare-foundation/go-flare-common/pkg/database"
1514 "github.com/flare-foundation/go-flare-common/pkg/events"
1615 "github.com/flare-foundation/go-flare-common/pkg/logger"
1716 "github.com/flare-foundation/go-flare-common/pkg/priority"
17+ "github.com/pkg/errors"
1818
1919 bitvotes "github.com/flare-foundation/fdc-client/client/attestation/bitVotes"
2020 "github.com/flare-foundation/fdc-client/client/config"
@@ -175,18 +175,18 @@ func (a *Attestation) Handle(ctx context.Context) error {
175175 responseBytes , confirmed , err := ResolveAttestationRequest (ctx , a )
176176 if err != nil {
177177 a .Status = ProcessError
178- return fmt . Errorf ( "handle, resolve request: %s" , err )
178+ return errors . Wrap ( err , "unable to resolve attestation request" )
179179 }
180180 if ! confirmed {
181181 a .Status = Unconfirmed
182- logger .Debugf ("unconfirmed request: " )
182+ logger .Debugf ("attestation request %s for round %d successfully verified but not confirmed" , a . Request . TypeAndSourceString (), a . RoundID )
183183 return nil
184184 }
185185
186186 a .Response = responseBytes
187187 err = a .validateResponse ()
188188 if err != nil {
189- return fmt . Errorf ( "handle, validate response: %s" , err )
189+ return errors . Wrap ( err , "unable to validate attestation response" )
190190 }
191191
192192 return nil
@@ -209,7 +209,7 @@ func (a *Attestation) PrepareRequest(attestationTypesConfigs config.AttestationT
209209 attestationTypeConfig , ok := attestationTypesConfigs [attType ]
210210 if ! ok {
211211 a .Status = UnsupportedPair
212- return fmt .Errorf ("prepare request: no configs for: %s" , string ( bytes . Trim (attType [:], " \x00 " ) ))
212+ return fmt .Errorf ("prepare request: no configs for: %s" , utils . Bytes32ToString (attType ))
213213 }
214214
215215 a .ResponseABI = & attestationTypeConfig .ResponseArguments
@@ -218,7 +218,7 @@ func (a *Attestation) PrepareRequest(attestationTypesConfigs config.AttestationT
218218 sourceConfig , ok := attestationTypeConfig .SourcesConfig [source ]
219219 if ! ok {
220220 a .Status = UnsupportedPair
221- return fmt .Errorf ("prepare request: no configs for: %s, %s" , string ( bytes . Trim (attType [:], " \x00 " )), string ( bytes . Trim (source [:], " \x00 " ) ))
221+ return fmt .Errorf ("prepare request: no configs for: %s, %s" , utils . Bytes32ToString (attType ), utils . Bytes32ToString (source ))
222222 }
223223
224224 a .LUTLimit = sourceConfig .LUTLimit
0 commit comments