Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About FxERC20Transfer withdraw test code #50

Open
picardcapt1212 opened this issue Apr 21, 2023 · 2 comments
Open

About FxERC20Transfer withdraw test code #50

picardcapt1212 opened this issue Apr 21, 2023 · 2 comments

Comments

@picardcapt1212
Copy link

Hi, i have a question about FxERC20Transfer withdraw testcode in feature/hardhat_unittestbranch.
So i tested erc20 state transfer with test/tunnel/FxERC20Tunnel.ts.
I understand mapToken, deposit function, but i'm little confused of this withdraw line.

In the test code after deposit(), the wallet.getAddress() has 10(i will omit 10^18) in child token contract(the mapped contract).
And also the wallet.getAddress() has 9990 in the root token contract.

child token contract wallet.getAddress() balance : 10
root token contract wallet.getAddress() balance : 9990

When withdraw() function call(withdraw 5 from child token contract) i thought below will be the result.

child token contract wallet.getAddress() balance : 5
root token contract wallet.getAddress() balance : 9995

But instead of above balance, the test code is showing me below result.

child token contract wallet.getAddress() balance : 5
root token contract wallet.getAddress() balance : 9990

So to sum up my question is
Q1. Is the wallet.getAddress() balance I expected right? - child token contract: 5, root token contract: 9995
Q2. Is the withdraw test code resulted becuase the checkpointManager is not working in local test environment?
Q3. What is the checkpointManager0x600e7E2B520D51a7FE5e404E73Fb0D98bF2A913E in the test code? over here.

Thanks for advanced!

@wschwab
Copy link
Contributor

wschwab commented May 19, 2023

We're working on a complete overhaul of the tests atm, we'll try to circle back to this once it's posted, and point to the code we think should answer the questions

@DhairyaSethi
Copy link
Contributor

Withdrawal is a two step process, ie burn (withdraw() on child tunnel burns the token) and exit (submit exit-proof at receiveMessage() on root tunnel) which then unlock tokens on root. The tests have been updated to include the exit call (including proof generation) here. We've also migrated the test suite to dual of Foundry & Hardhat, more extensive cases covered in the Foundry unit tests here.
Do the checkout the updated project README for more info, & let me know if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants