hotfix(explorer): panic on batches last page #1731
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_prooffield in the db. So it panics when callingEthConverter.wei_to_eth()with a nil value.Description
Handles properly the case where
fee_per_proofis nil.Type of change
How to test
Steps to reproduce the bug locally
git checkout testnetfee_per_proofof one batch:localhost:4000/batchesand navigate through the pages until the edited batch. You should see the paniclocalhost:4000/batches/0xfc97db8cc6bd3e838b9924fc278ee20620374707ad89e81406f23dad97fd8ae3with the chosen merkle root.Test the fix
hotfix/explorer_last_pagelocalhost:4000/batchesandlocalhost:4000/batches/0xfc97db8cc6bd3e838b9924fc278ee20620374707ad89e81406f23dad97fd8ae3. The panic shouldn't appear.fee_per_proofshould look like this:Checklist
testnet, everything else tostaging