Skip to content

Conversation

@Mechanix97
Copy link
Contributor

@Mechanix97 Mechanix97 commented Apr 14, 2025

Feat (aggregation mode) save last processed block in a file

Description

From Issue #1870

Save the last processed block in a json file which path is indicated in the argument config file.

Check if the last_processed_block is lower than the current block of the chain.

Add a method to the config to save the current last_processed_block (discarding the previous file)

Type of change

Please delete options that are not relevant.

  • New feature

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

@Mechanix97 Mechanix97 marked this pull request as ready for review April 14, 2025 17:45
@Mechanix97 Mechanix97 changed the title 1870 refactor (aggregation mode) save last processed block in a file Refactor (aggregation mode) save last processed block in a file Apr 14, 2025
@JuArce JuArce changed the title Refactor (aggregation mode) save last processed block in a file feat(aggregation_mode): save last processed block in a file Apr 14, 2025
Copy link
Collaborator

@JuArce JuArce left a comment

Choose a reason for hiding this comment

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

lgtm

  • It creates the file if it does not exist ✅
  • It updates the file only if the verification was correctly sent to ethereum ✅
  • It use the current block when the events were fetched and not when the process finishes, which is correct ✅

.gitignore Outdated
**/broadcast
volume
config-files/*.last_processed_batch.json
config-files/*.last_processed_block.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to last_aggregated_block.json, or the folder/name to reflect this is for aggregation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

fetch_logs_from_secs_ago: 86400 # 24hs
# Anvil start with block time is 7 seconds
block_time_secs: 7
last_processed_block_filepath: config-files/proof-aggregator.last_processed_block.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Idem the other suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

@JuArce JuArce left a comment

Choose a reason for hiding this comment

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

Lgtm but this structure could be removed to avoid an extra level of indirection

#[derive(Debug, Deserialize, Serialize)]
pub struct LastAggregatedBlock {
    pub last_aggregated_block: u64,
}

@JuArce JuArce added this pull request to the merge queue Apr 15, 2025
Merged via the queue into staging with commit 0d8b99b Apr 15, 2025
3 checks passed
@JuArce JuArce deleted the 1870-refactoraggregation_mode-save-last-processed-block-in-a-file branch April 15, 2025 21:26
@JuArce JuArce linked an issue Apr 22, 2025 that may be closed by this pull request
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.

feat(aggregation_mode): save last processed block in a file

4 participants