Skip to content
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

feat: remove local db from aggsender #197

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

goran-ethernal
Copy link
Collaborator

@goran-ethernal goran-ethernal commented Nov 22, 2024

Description

This PR removes the local aggsender db, and uses in memory saving of the last sent certificate.

On startup, the aggsender will get the last sent certificate for its network by using the interop_getLatestKnownCertificateHeader rpc endpoint on agglayer. If it is nil, it means that agglayer doesn't have any certificates from our network. If it has, we will save it in memory as the last sent certificate.

Then, the flow is as it was:

  • we wait for the moment in the L1 epoch to build a new certificate.
  • if the last sent certificate is nil (agglayer has no certificates from our network), or if it's status is Settled or InError, aggsender will proceed to build a new certificate.
  • if the last sent certificate has any other status than Settled or InError it means we can not build a new certificate, so we wait for the next chance to build it.

Pros of removing local aggsender db:

  • we are relaying solely on agglayer as a source of truth.
  • code is less complex.
  • aggsender config is smaller.
  • aggsender is faster since it saves the last sent certificate in memory, and it doesn't need to query db.

Cons:

  • No history tracking.
  • Some situations in production can be more difficult to track. e.g: there are 2 aggsenders sending certs with same NetworkID, or someone was manually sending certificates to the agglayer.

@goran-ethernal goran-ethernal changed the title CDK-594-aggsender-remove-db-use-memory feat: remove local db from aggsender Nov 22, 2024
@goran-ethernal goran-ethernal changed the base branch from main to feature/aggsender_recovery November 22, 2024 11:00
@goran-ethernal goran-ethernal self-assigned this Nov 22, 2024
@goran-ethernal goran-ethernal force-pushed the CDK-594-aggsender-remove-db-use-memory branch from c9a4f13 to 512bfa1 Compare November 22, 2024 11:40
@goran-ethernal goran-ethernal marked this pull request as ready for review November 22, 2024 11:49
Base automatically changed from feature/aggsender_recovery to develop November 25, 2024 09:56
agglayer/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

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

Rebase to deduce diff?

@Stefan-Ethernal Stefan-Ethernal force-pushed the CDK-594-aggsender-remove-db-use-memory branch from 512bfa1 to dd6efaf Compare November 25, 2024 12:03
Copy link

sonarcloud bot commented Nov 25, 2024

@Stefan-Ethernal Stefan-Ethernal marked this pull request as draft November 25, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants