v2-core icon indicating copy to clipboard operation
v2-core copied to clipboard

Sorting tokens in fixture does not work

Open sz-piotr opened this issue 4 years ago • 5 comments

https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/test/shared/fixtures.ts#L40

Because ethers returns a string from this method call, .address always results in undefined, thus the order of tokens is never changed.

sz-piotr avatar Sep 15 '20 09:09 sz-piotr

Good catch! I guess token0 and token1 must always be the same for the fixture, so we never had failing tests out of it.

moodysalem avatar Sep 15 '20 14:09 moodysalem

Good catch! I guess token0 and token1 must always be the same for the fixture, so we never had failing tests out of it.

Sir, how can token0 and token1 be same for pairFixture ?

Devilla avatar Oct 28 '20 20:10 Devilla

I mean same addresses across test runs (but token0 != token1), since we use the same mnemonic for every test run

moodysalem avatar Oct 28 '20 21:10 moodysalem

Okay so it'll fail for different pair address and pass for same pair address right?

Devilla avatar Oct 29 '20 08:10 Devilla

I think the best fix would be to lowercase the addresses of the token and just compare like how it is done from the factory contract as well.

ghost avatar Dec 31 '23 19:12 ghost