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

Add unit tests for core/lib/dal/src/blocks_dal.rs's get_batch_pubdata function #124

Open
ilitteri opened this issue Feb 9, 2024 · 0 comments · May be fixed by #160
Open

Add unit tests for core/lib/dal/src/blocks_dal.rs's get_batch_pubdata function #124

ilitteri opened this issue Feb 9, 2024 · 0 comments · May be fixed by #160

Comments

@ilitteri
Copy link
Collaborator

ilitteri commented Feb 9, 2024

Descripction

Test scenarios

Retrieving genesis and consequent batches pubdata should not fail and retrieved pubdata should be correct in Rollup mode

  • Create a genesis batch and a consequent batch.
  • Insert both batches into the DB.
  • Commit both batches using RollupModeL1BatchCommitDataGenerator.
  • Call BlocksDal::get_batch_pubdata using the genesis batch number.
  • Call BlocksDal::get_batch_pubdata using the genesis consequent batch number.
  • Check that both calls succeed.
  • Check that both results are not None and that the retrieved pubdata matches with the created batches pubdata.

Retrieving genesis and consequent batches pubdata should not fail and retrieved pubdata should be correct in Validium mode

  • Create a genesis batch and a consequent batch.
  • Insert both batches into the DB.
  • Commit both batches using ValidiumModeL1BatchCommitDataGenerator.
  • Call BlocksDal::get_batch_pubdata using the genesis batch number.
  • Call BlocksDal::get_batch_pubdata using the genesis consequent batch number.
  • Check that both calls succeed.
  • Check that both results are not None and that the retrieved pubdata matches with the created batches pubdata.

Retrieving the pubdata from a non-existing batch should fail

  • Create a genesis batch, insert it into the DB, and commit it.
  • Call BlocksDal::get_batch_pubdata using a non-existing batch number.
  • Check that the call succeeds.
  • Check that the result is None.

Hint: there are useful functions in eth_sender's tests to create, insert, and commit batches. Also, the tests' structure should be pretty similar to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment