Skip to content

Conversation

@avilagaston9
Copy link
Contributor

Fix explorer panic on last page

Motivation

We have a bug when navigating the last pages of batches on https://stage.explorer.alignedlayer.com/batches and https://holesky.explorer.alignedlayer.com/batches.

This occurs because the old batches don't have a fee_per_proof field in the db. So it panics when calling EthConverter.wei_to_eth() with a nil value.

Description

Handles properly the case where fee_per_proof is nil.

Type of change

  • Bug fix

How to test

Steps to reproduce the bug locally

  1. git checkout testnet
  2. Run a local net with the explorer and send some batches.
  3. Enter to the explorer db (postgresql container) edit the fee_per_proof of one batch:
docker exec -it <container_id> bash`
psql -U explorer_user -d explorer_db
UPDATE batches SET fee_per_proof = NULL WHERE merkle_root = '0xfc97db8cc6bd3e838b9924fc278ee20620374707ad89e81406f23dad97fd8ae3'
RETURNING *;
  1. Go to localhost:4000/batches and navigate through the pages until the edited batch. You should see the panic
  2. You should also see the panic going to localhost:4000/batches/0xfc97db8cc6bd3e838b9924fc278ee20620374707ad89e81406f23dad97fd8ae3 with the chosen merkle root.

Test the fix

  1. git checkout hotfix/explorer_last_page
  2. Run the local net and navigate through localhost:4000/batches and localhost:4000/batches/0xfc97db8cc6bd3e838b9924fc278ee20620374707ad89e81406f23dad97fd8ae3. The panic shouldn't appear.
  3. fee_per_proof should look like this:
image

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@avilagaston9 avilagaston9 marked this pull request as ready for review January 10, 2025 18:27
@avilagaston9 avilagaston9 self-assigned this Jan 10, 2025
@JuArce JuArce merged commit b23698b into testnet Jan 13, 2025
1 check passed
@JuArce JuArce deleted the hotfix/explorer_last_page branch January 13, 2025 17:20
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

Successfully merging this pull request may close these issues.

5 participants