-
Notifications
You must be signed in to change notification settings - Fork 318
truffle tests erroring with "VM Exception while processing transaction: invalid JUMP" #25
Comments
If I try to
|
What happens if you set minLiquidity to 1? Also if your eth balance and token balance are both 1000, maybe send less than 1000 (like 500 of each). Also the abi is likely giving you issues b/c of vyper unit types that solidity doesnt have. |
Similar but not exactly the same error with minLiquidity of 1:
Error: Returned error: VM Exception while processing transaction: invalid JUMP at 377780708130f00ef852fcc086eded95c7eb0e896d0eb49c8c2fd4879bfdf303/014e15cbb300f9408e2886949053208fc5e07cd5:39
The eth and token balances far exceed 1000, so that isn’t the issue, but I will change the test to check for headroom.
I think I can get by using the abi of my solidity interface instead of the abi that is checked into the repo. My interface has worked for all the tests except addLiquidity so it’s at least mostly right. Am I doing the contract initialization correctly?
I’ve had to track down reverts in other code, but haven’t had to debut a JUMP before. What does the error even mean?
|
Your deploy order seems to be good. The JUMP error is a Vyper bug. Basically Uniswap uses Vypers Unfortunately when REVERT was added, But yeah something is causing the addLiquidity function to fail. Try calling Do you have any tests for the tutorial token to make sure thats working? |
I do call |
I have some tests on TutorialToken, but I’ll add some more. I’m using open zeppelin, so that stuff should all be up to standards.
… On Feb 23, 2019, at 1:09 PM, Hayden Adams ***@***.***> wrote:
Your deploy order seems to be good.
The JUMP error is a Vyper bug. Basically Uniswap uses Vypers create_with_code_of() which was created before the REVERT opcode was added. It sets up a new contract with a delegatecall pattern to a library contract.
Unfortunately when REVERT was added, create_with_code_of() fell through the cracks so if a call fails on a proxy delegatecall contract created with this function, it throws by doing an invalid jump.
But yeah something is causing the addLiquidity function to fail.
Try calling tutorialTokenUniswapInstance.factoryAddress() and tutorialTokenUniswapInstance.tokenAddress() and make sure it outputs the expected addresses.
Do you have any tests for the tutorial token to make sure thats working?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This is my TutorialToken.sol. It is pretty simple so I doubt I've added any bugs here.
|
@wysenynja I figured it out. https://github.com/Uniswap/contracts-vyper/blob/master/contracts/uniswap_exchange.vy#L65 First liquidity provider needs to add at least 1000000000 wei to the contract. |
Thank you!! Will change that when I get home and test it out
… On Feb 24, 2019, at 11:10 AM, Hayden Adams ***@***.***> wrote:
@wysenynja I figured it out.
https://github.com/Uniswap/contracts-vyper/blob/master/contracts/uniswap_exchange.vy#L65
First liquidity provider needs to add at least 1000000000 wei to the contract.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Fo sho lmk if there are still issues |
New test:
Sweet success:
|
@haydenadams any reason why 1000000000 wei was chosen? Out of pure curiosity :) |
Thanks a lot @wysenynja @haydenadams , this saved my day! |
I'm trying to interact with uniswap through a truffle contract written in solidity 0.5.4. I have
truffle migrate
able to deploy the contract bytecode that is checked into the repo. The abi is giving me issues, but I've worked around that for now (trufflesuite/truffle#1623). I have a test that AFAICT is successfully initializing the contract and setting up an exchange for a test ERC20 token. However, when I try to add liquidity, I get "invalid JUMP".To ease debugging this, I should probably just push my whole repo up to GitHub, but I wasn't wanting to open source it just yet.
Here are some relevant pieces:
IUniswapExchange.sol
IUniswapFactory.sol
test/uniswap.js
:The text was updated successfully, but these errors were encountered: