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

L1->L2 testing can be simplified #623

Open
FabijanC opened this issue Oct 8, 2024 · 0 comments
Open

L1->L2 testing can be simplified #623

FabijanC opened this issue Oct 8, 2024 · 0 comments
Labels
enhancement New feature or request testing Related to code testing

Comments

@FabijanC
Copy link
Contributor

FabijanC commented Oct 8, 2024

Problem

To test L1->L2 messages coming from Anvil, our L1L2 example contract (defined in L1L2.sol, compiled in L1L2Example.json), we must:

  1. increment balance on L2
  2. withdraw from L2 to L1
  3. deposit from L1 back to L2.

Deposit cannot be called right away because there is a constraint in the code which otherwise leads to reversion:

require(amount <= userBalances[user], "The user's balance is not large enough.");

Proposal

One of the following can be done:

a. Create a common function in our Rust tests which abstracts the three steps described above.
b. Add a new method to L1L2.sol without the require on balance; could have one of the following names:

  • mockDeposit
  • forceDeposit

c. Add a new example contract with the method described in b.

@FabijanC FabijanC added enhancement New feature or request testing Related to code testing labels Oct 8, 2024
@FabijanC FabijanC changed the title L1-L2 testing can be simplified L1->L2 testing can be simplified Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing Related to code testing
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant