Skip to content

Conversation

@infrmtcs
Copy link
Contributor

No description provided.

@infrmtcs infrmtcs added the disable-deploy-test We don't want to run deploy tests with this PR because it might affect our development environment. label Nov 25, 2025
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 68.18182% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.76%. Comparing base (f208739) to head (ec27349).

Files with missing lines Patch % Lines
core/accessors.go 63.04% 7 Missing and 10 partials ⚠️
blockchain/blockchain.go 78.94% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           dat/block-transactions    #3304      +/-   ##
==========================================================
+ Coverage                   75.60%   75.76%   +0.16%     
==========================================================
  Files                         352      352              
  Lines                       33350    33352       +2     
==========================================================
+ Hits                        25214    25270      +56     
+ Misses                       6338     6268      -70     
- Partials                     1798     1814      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 2 times, most recently from 2dfe1e7 to dd31f0b Compare December 2, 2025 14:20
@infrmtcs infrmtcs force-pushed the dat/accessors branch 2 times, most recently from d40c6dc to ef27574 Compare December 3, 2025 05:22
Base automatically changed from dat/accessors to main December 3, 2025 11:19
@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 2 times, most recently from c016cdb to 27e2db3 Compare December 8, 2025 07:01
@rodrodros rodrodros requested a review from EgeCaner December 8, 2025 11:21
@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 2 times, most recently from 5051fb3 to 0834f3d Compare December 10, 2025 08:46
Copy link
Collaborator

@rodrodros rodrodros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! Couldn't find any problems.

I've just added some nitpicks that I think it can help with its reading and some questions of two small things that are not super clear to me

txHash := (*felt.TransactionHash)(txn.Hash())
for _, tx := range blockTransactions.Transactions {
txHash := (*felt.TransactionHash)(tx.Hash())
if err := TransactionBlockNumbersAndIndicesByHashBucket.Delete(batch, txHash); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I know this line is outside the scope of the PR but could you split the assignment from the if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason why we favor breaking it into 2 lines? IMO it's a good feature to scope the declaration of err, which avoid (possibly) wrong reuse of err.


if l1handler, ok := txn.(*L1HandlerTransaction); ok {
if l1handler, ok := tx.(*L1HandlerTransaction); ok {
if err := DeleteL1HandlerTxnHashByMsgHash(batch, l1handler.MessageHash()); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here

}

minBlock := min(transactions, receipts)
minBlock -= minBlock % batchSize
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: parentization would help a bit here in my opinion

As I understand it, here you want to start through the oldest non-migrated block transactions or receipts, in case the migration was interrupted (I assume). I don't understand very well the logic though.

If the first block with transactions to migrate is t = 5 and the first one with receipts to migrate is r = 10 with batch size b = 2 then:

  1. The minimum is min = min(t, r) -> min = min(10, 5) -> min = 5
  2. The result is res = min - (min % 2)
  3. Which then becomes -> res = 5 - (5 % 2) -> res = 5 - 1 -> res = 4.
  4. The block we should then start from is block 4 and not 5 🤔 – what am I missing.

Additionally, if either transactions and receipts is zero, min block will be zero as well 🤔

Copy link
Contributor Author

@infrmtcs infrmtcs Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mainly to "normalize" the batch start and end to be multiples of batchSize, which is currently 10. The main benefits are to guarantee that multiple runs use consistent batches. For example, we always run batch 0 -> 9, 10 -> 19, 20 -> 29,... but never get batch 5 -> 14. This is to avoid unexpected batch that isn't created during the experiments, which may create unexpected spike in resource usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I remember one more strict reason why we need this. Imagine that the actual next block to migrate is block 20, but block 20 doesn't have any transaction nor receipt. The the first batch will be 21 -> 30 instead of 20 -> 29.
Before rounds of benchmark, I chose batch of 100, which may this approach okay-ish because it only fails in the case where there are 100 consecutive empty blocks. However, now the batch size is 10, which means probably I'll need a better approach, since 10 consecutive empty blocks will fail.

@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 10 times, most recently from dde7821 to 6ffad37 Compare December 25, 2025 10:10
end = b.Indexes.Receipts[0]
}

return indexed.NewLazySlice[Transaction](b.Indexes.Transactions, b.Data[:end])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning behind b.Data[:end]? It looks similar to just passing b.Data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First half of the data is for transactions, second half is for receipts. We're utilizing end of data as the end for the last item, so for transactions case, we need to slice at the beginning of the first receipt

@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 3 times, most recently from a35c29f to 8feb714 Compare December 26, 2025 11:07
@infrmtcs infrmtcs changed the base branch from main to dat/closer December 26, 2025 11:07
@infrmtcs infrmtcs changed the base branch from dat/closer to dat/block-transactions December 26, 2025 11:13
@infrmtcs infrmtcs force-pushed the dat/block-transactions branch from f208739 to d8b4ae2 Compare December 28, 2025 14:40
@infrmtcs infrmtcs force-pushed the dat/bench/combined branch 2 times, most recently from 34f4feb to 9e15688 Compare December 28, 2025 16:58
@infrmtcs infrmtcs force-pushed the dat/block-transactions branch 3 times, most recently from 8367591 to 492d696 Compare December 30, 2025 08:48
@infrmtcs infrmtcs changed the base branch from dat/block-transactions to dat/migrate-block-transactions December 30, 2025 08:52
@infrmtcs infrmtcs force-pushed the dat/migrate-block-transactions branch from b650e4f to 60b4f1a Compare December 30, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable-deploy-test We don't want to run deploy tests with this PR because it might affect our development environment.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants