Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address issues related to EVM endianness
Browse files Browse the repository at this point in the history
johnsaigle committed Jan 16, 2025
1 parent ad182d0 commit 99755b4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions node/pkg/transfer-verifier/transfer-verifier-evm-structs.go
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 99755b4

Please sign in to comment.