Skip to content

Commit

Permalink
drop method
Browse files Browse the repository at this point in the history
  • Loading branch information
bukata-sa committed Dec 3, 2024
1 parent cdd6b9f commit 7c0d1df
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package lbtc
import (
"bytes"
"context"
"crypto/sha256"
"encoding/json"
"fmt"
"net/url"
Expand Down Expand Up @@ -245,27 +244,6 @@ func (s *TokenDataReader) ReadTokenData(ctx context.Context, msg cciptypes.EVM2E
}
}

func (s *TokenDataReader) getLBTCPayloadHash(msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta, tokenIndex int) ([32]byte, error) {
decodedSourceTokenData, err := abihelpers.DecodeAbiStruct[sourceTokenData](msg.SourceTokenData[tokenIndex])
if err != nil {
return [32]byte{}, err
}
destTokenData := decodedSourceTokenData.ExtraData
var payloadHash [32]byte
// We don't have better way to determine if the extraData is a payload or sha256(payload)
// Last parameter of the payload struct is 32-bytes nonce (see Lombard's Bridge._deposit(...) method),
// so we can assume that payload always exceeds 32 bytes
if len(destTokenData) != 32 {
payloadHash = sha256.Sum256(destTokenData)
s.lggr.Warnw("SourceTokenData.extraData size is not 32. Probably this is deposit payload, not sha256(payload). "+
"This message was sent when LBTC attestation was disabled onchain. Will use sha256 from this value",
"destTokenData", destTokenData, "newPayloadHash", payloadHash)
} else {
payloadHash = [32]byte(destTokenData)
}
return payloadHash, nil
}

func (s *TokenDataReader) callAttestationApi(ctx context.Context, lbtcMessageHash [32]byte) (attestationResponse, error) {
attestationUrl := fmt.Sprintf("%s/bridge/%s/%s", s.attestationApi.String(), apiVersion, attestationPath)
request := attestationRequest{PayloadHashes: []string{hexutil.Encode(lbtcMessageHash[:])}}
Expand Down

0 comments on commit 7c0d1df

Please sign in to comment.