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

Add snapshot processing for all astrid modes #12339

Merged
merged 124 commits into from
Oct 28, 2024
Merged

Add snapshot processing for all astrid modes #12339

merged 124 commits into from
Oct 28, 2024

Conversation

mh0lt
Copy link
Contributor

@mh0lt mh0lt commented Oct 16, 2024

This PR allows stand alone astrid to participate in snapshot production.

It includes the following changes:

  • All bor data storage is handled in the bor/heimdall stage
  • Stores now process db & snapshot calls
  • Snapshot production runs from multiple databases in stand alone mode
  • In the legacy stages and astrid stage mode the chain db is still used

The current state of the types which manage bor persistence are as follows:

db-types-Astrid Types

These changes have been tested by running amoy from scratch in various modes:

  • no polygon sync
  • polygon.sync
  • polygon.sync.stage

I have also tested removing chaindata (& heimdall & polygon-bridge) dbs and restarting as well as removing locally produced snapshot files.

In all cases for my testing amoy startes, syncs and runs at the tip.

Copy link
Member

@taratorio taratorio left a comment

Choose a reason for hiding this comment

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

🚀

polygon/bridge/bridge.go Outdated Show resolved Hide resolved
mu sync.Mutex
on chan struct{}
state bool
inited bool
Copy link
Member

Choose a reason for hiding this comment

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

Typo?

Suggested change
inited bool
initiated bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This means init has been called do you want me to change init to initiated, its a well known shorthand.

polygon/bridge/bridge.go Outdated Show resolved Hide resolved
polygon/bridge/reader.go Outdated Show resolved Hide resolved
borSn *BorRoSnapshots
sn *RoSnapshots
borSn *heimdall.RoSnapshots
borBridgeStore bridge.Store
Copy link
Member

Choose a reason for hiding this comment

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

Are these stores being added here just for the sake of code deduplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are being added so that temporarily block_reader can retain its interface to the stage code. Doing it like this allows us to test the functionality in the bor specific code does not break the current stage code - hence it proves that it running successfully.

Once we remove the stages all of the bor specific code - bridge snapshots etc can be removed from here.

polygon/sync/execution_client.go Outdated Show resolved Hide resolved
CalculateSprintLength(number uint64) uint64
}

func NewSnapshotStore(base Store, snapshots *heimdall.RoSnapshots, sprintLengthCalculator sprintLengthCalculator) *snapshotStore {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func NewSnapshotStore(base Store, snapshots *heimdall.RoSnapshots, sprintLengthCalculator sprintLengthCalculator) *snapshotStore {
func NewSnapshotStore(database Store, snapshots *heimdall.RoSnapshots, sprintLengthCalculator sprintLengthCalculator) *snapshotStore {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why assume that the base store is a database ?

I can change it but it seems logically incorrect - if we want to name it after the type shouldn't it just be store ?

polygon/bridge/snapshot_store.go Outdated Show resolved Hide resolved
@mh0lt mh0lt marked this pull request as ready for review October 25, 2024 22:47
@mh0lt mh0lt merged commit 26c3173 into main Oct 28, 2024
11 checks passed
@mh0lt mh0lt deleted the astrid_snapshots branch October 28, 2024 16:51
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