Skip to content

graphman: Add simpler chain rewind command to delete blocks #5645

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

Closed
wants to merge 2 commits into from

Conversation

encalypto
Copy link
Contributor

This is a simpler version of #5486, which adds a command to delete blocks past a certain point:

$ graphman chain rewind sepolia --block-hash 0xabc123 --block-number 123

Note that deployments are not rewound here.

This rewinds all subgraphs on a chain to a specified block. It has most
of the same arguments as `graphman rewind`, but takes a chain name
instead of a list of deployments.
@encalypto encalypto marked this pull request as ready for review September 16, 2024 15:37
@fordN fordN assigned encalypto and unassigned mangas Sep 16, 2024
@fordN fordN requested a review from mangas September 16, 2024 15:39
.execute(conn)
.map_err(Error::from)
}
Storage::Private(Schema { blocks, .. }) => {
Copy link
Contributor

@mangas mangas Oct 1, 2024

Choose a reason for hiding this comment

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

Would be great to ensure this can work when the block cache shard is not the primary. Would also be awesome if we could have some integration tests for this functionality

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it does work because the ChainStore should already always have the right pool when it gets created. If you already tested that's great otherwise maybe rewind something in staging

ethereum_networks::table.filter(ethereum_networks::name.eq(&self.chain)),
)
.set((
ethereum_networks::head_block_number.eq(block_ptr_to.number as i64),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is somewhere we keep the firehose cursor, I think this table has a firehose cursor too, that should be set to empty string.

Copy link
Contributor

Choose a reason for hiding this comment

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

same here regarding tests

Copy link

This pull request hasn't had any activity for the last 90 days. If there's no more activity over the course of the next 14 days, it will automatically be closed.

@github-actions github-actions bot added the Stale label Jan 28, 2025
@github-actions github-actions bot closed this Feb 11, 2025
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