Skip to content

Commit

Permalink
add real attestation as return & rm 0x prefix (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR authored Sep 22, 2023
1 parent 7cacf4b commit ba1a042
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"net/http"
"net/url"
"strings"
"sync"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -88,7 +89,7 @@ func (s *TokenDataReader) ReadTokenData(ctx context.Context, msg internal.EVM2EV
}

if response.Status == attestationStatusSuccess {
attestationBytes, err := hex.DecodeString(response.Attestation)
attestationBytes, err := hex.DecodeString(strings.TrimPrefix(response.Attestation, "0x"))
if err != nil {
return nil, fmt.Errorf("decode response attestation: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -38,10 +39,10 @@ type attestationResponse struct {
func TestUSDCReader_ReadTokenData(t *testing.T) {
response := attestationResponse{
Status: "complete",
Attestation: "720502893578a89a8a87982982ef781c18b193",
Attestation: "0x9049623e91719ef2aa63c55f357be2529b0e7122ae552c18aff8db58b4633c4d3920ff03d3a6d1ddf11f06bf64d7fd60d45447ac81f527ba628877dc5ca759651b08ffae25a6d3b1411749765244f0a1c131cbfe04430d687a2e12fd9d2e6dc08e118ad95d94ad832332cf3c4f7a4f3da0baa803b7be024b02db81951c0f0714de1b",
}

attestationBytes, err := hex.DecodeString(response.Attestation)
attestationBytes, err := hex.DecodeString(strings.TrimPrefix(response.Attestation, "0x"))
require.NoError(t, err)

responseBytes, err := json.Marshal(response)
Expand Down

0 comments on commit ba1a042

Please sign in to comment.