-
Notifications
You must be signed in to change notification settings - Fork 222
fix: l1 handler message hash to txn hash mapping #3367
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
base: main
Are you sure you want to change the base?
Conversation
9a9b02a to
c92ac35
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3367 +/- ##
==========================================
- Coverage 76.33% 76.32% -0.02%
==========================================
Files 351 351
Lines 33309 33349 +40
==========================================
+ Hits 25427 25452 +25
- Misses 6070 6080 +10
- Partials 1812 1817 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2d955bb to
8c1faac
Compare
8c1faac to
535f9d3
Compare
thiagodeev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var writeMu sync.Mutex | ||
| numWorkers := runtime.GOMAXPROCS(0) | ||
| workerPool := pool.New().WithErrors().WithMaxGoroutines(numWorkers) | ||
| batch := database.NewBatch() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does the migration take. Is it super quick, no need, but if not, what do you think of adding some logging to inform users. I leave it completely at your discretion.
Also, is this operation light enough to work under the 8gb of ram and 4 core minimum requirements of Juno? I think yes, but asking just to be safe. An intuitive answer is good enough in this case in my opinion – let's not put more time into this PR than strictly required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration was taking ~1 min 15 sec in my machine, let me run it in environment similar to minimum requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think how long it takes also matters because we're writing everything in a single batch. If user kills the process in the middle, all progress will be lost, and user has to suffer the same cost of migrating them again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EgeCaner Is it sepolia or mainnet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure if we should allow to cancel. In case of cancel and re-run we would do the all operations again, migration wont start from where it was cancelled. To be able to remain from where we left, we need to track additional state, by taking a look at the table we are writing L1MessageHash to L2 txn hash we cannot tell were we left?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it sepolia or mainnet?
It was Sepolia
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add some logs as well, on Mainnet it will take lot more than on sepolia
| blockNumbers := make(chan uint64) | ||
| go func() { | ||
| for blockNum := range chainHeight + 1 { | ||
| blockNumbers <- blockNum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should select context here, in case user want to cancel.
| // recalculateL1HandlerMsgHashes recalculates L1Handler message hash to txn hash mappings. | ||
| // Needed because calculateL1MsgHashes2 ran with a buggy WriteL1HandlerMsgHashes. | ||
| // Functionally same as calculateL1MsgHashes2, but optimised for concurrent reads. | ||
| type recalculateL1HandlerMsgHashesToTxnHashes struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Is it possible to move this into a separate file or package? I think this file is getting too long now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure


Due to a bug, only the first L1Handler transaction in a block was written to MsgHash to L2TxnHash mapping, resulting in consecutive ones to be missing, leading to to error in
starknet_getMessageStatus.Includes migration