From 99755b4941ef80fbdc8ec7b32b0b1ac59963789f Mon Sep 17 00:00:00 2001 From: John Saigle Date: Thu, 16 Jan 2025 14:08:22 -0500 Subject: [PATCH] Address issues related to EVM endianness --- node/pkg/transfer-verifier/transfer-verifier-evm-structs.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/node/pkg/transfer-verifier/transfer-verifier-evm-structs.go b/node/pkg/transfer-verifier/transfer-verifier-evm-structs.go index ee56483d0a..72e45dd0c5 100644 --- a/node/pkg/transfer-verifier/transfer-verifier-evm-structs.go +++ b/node/pkg/transfer-verifier/transfer-verifier-evm-structs.go @@ -746,8 +746,7 @@ func (tv *TransferVerifier[ethClient, Connector]) chainId( return 0, errors.New("result for chainId has insufficient length") } - // TODO: should this be big endian? - chainID := vaa.ChainID(binary.LittleEndian.Uint16(result)) + chainID := vaa.ChainID(binary.BigEndian.Uint16(result)) tv.nativeChainCache[tokenAddressAsKey] = chainID @@ -797,7 +796,6 @@ func (tv *TransferVerifier[ethClient, Connector]) isWrappedAsset( // The boolean result will be returned as a byte string with length // equal to EVM_WORD_LENGTH. Grab the last byte. - // TODO is 1 == true? Does this work? wrapped := result[EVM_WORD_LENGTH-1] == 1 tv.isWrappedCache[tokenAddressAsKey] = wrapped @@ -999,7 +997,6 @@ func (tv *TransferVerifier[evmClient, connector]) getDecimals( // An ERC20 token's decimals should fit in a single byte. A call to `decimals()` // returns a uint8 value encoded in string with 32-bytes. To get the decimals, // we grab the last byte, expecting all the preceding bytes to be equal to 0. - // TODO: find out if there is some official documentation for why this uint8 is in the last index of the 32byte return. decimals = result[EVM_WORD_LENGTH-1] // Add the decimal value to the cache