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: rawdb.InspectDatabaseOption #111

Merged
merged 7 commits into from
Feb 7, 2025
Merged

feat: rawdb.InspectDatabaseOption #111

merged 7 commits into from
Feb 7, 2025

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Feb 3, 2025

Why this should be merged

Allows for ava-labs/coreth equivalent modifications of rawdb.InspectDatabase() through external logic injection.

How this works

Variadic options to:

  1. Record a database statistic;
  2. Mark a database statistic as metadata;
  3. Filter statistics for printing.

How this was tested

Testable example acting as a unit test.

@ARR4N ARR4N marked this pull request as ready for review February 3, 2025 11:54
@ARR4N ARR4N requested review from a team, darioush, qdm12 and ceyonur and removed request for a team February 3, 2025 11:55
@qdm12
Copy link
Collaborator

qdm12 commented Feb 3, 2025

Do we need tests of this?

I'm happy to write one and PR it upstream too, let me know 😉

core/rawdb/database.libevm.go Show resolved Hide resolved
core/rawdb/database.libevm.go Outdated Show resolved Hide resolved
core/rawdb/database.go Show resolved Hide resolved
Copy link
Collaborator

@darioush darioush left a comment

Choose a reason for hiding this comment

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

Let's add a test for the new behavior and remove WithDatabaseStatRecorder if it is unused. Then LGTM

Co-authored-by: Quentin McGaw <[email protected]>
Signed-off-by: Arran Schlosberg <[email protected]>
@qdm12
Copy link
Collaborator

qdm12 commented Feb 3, 2025

and remove WithDatabaseStatRecorder if it is unused

WithDatabaseStatRecorder will be used by coreth 😉 I'll update the coreth branches soon.

@darioush
Copy link
Collaborator

darioush commented Feb 3, 2025

If it's used then let's add the UT

qdm12 and others added 2 commits February 7, 2025 16:06
## Why this should be merged

Add an example test for `InspectDatabase` with options.

## How this works

See example code
Copy link
Collaborator

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Pre-approving to get this merged 🛥️ !

core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm_test.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm.go Outdated Show resolved Hide resolved
core/rawdb/database.libevm.go Outdated Show resolved Hide resolved
ARR4N and others added 2 commits February 7, 2025 17:16
@ARR4N ARR4N enabled auto-merge (squash) February 7, 2025 17:27
@ARR4N ARR4N merged commit c74b645 into main Feb 7, 2025
4 checks passed
@ARR4N ARR4N deleted the arr4n/rawdb-inspect-stats branch February 7, 2025 17:32
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.

3 participants