Open weiihann opened 2 weeks ago
Attention: Patch coverage is 70.27027%
with 22 lines
in your changes missing coverage. Please review.
Project coverage is 75.29%. Comparing base (
4e6dcd7
) to head (8c7c091
).
Files | Patch % | Lines |
---|---|---|
cmd/juno/dbcmd.go | 72.54% | 8 Missing and 6 partials :warning: |
clients/feeder/feeder.go | 46.66% | 4 Missing and 4 partials :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Can we also show to which network db corresponds to? it would be great if there is some snapshot stored without identification
Can we also show to which network db corresponds to? it would be great if there is some snapshot stored without identification
I think that's a good addition. From my understanding, the network ID isn't stored directly in the db. Let me figure out how to pull that information.
Can we also show to which network db corresponds to? it would be great if there is some snapshot stored without identification
I think that's a good addition. From my understanding, the network ID isn't stored directly in the db. Let me figure out how to pull that information.
That's right you can modify existing approach for your case:
// Verify that cfg.Network is compatible with the database.
head, err := chain.Head()
if err != nil && !errors.Is(err, db.ErrKeyNotFound) {
return nil, fmt.Errorf("get head block from database: %v", err)
}
if head != nil {
// We assume that there is at least one transaction in the block or that it is a pre-0.7 block.
if _, err = core.VerifyBlockHash(head, &cfg.Network); err != nil {
return nil, errors.New("unable to verify latest block hash; are the database and --network option compatible?")
}
}
You should iterate over networks to figure out (_, err := core.VerifyBlockHash(...); err == nil
) to which one it corresponds
You should iterate over networks to figure out (
_, err := core.VerifyBlockHash(...); err == nil
) to which one it corresponds
Added the network field.
Description
This PR adds a new CLI tool for database-related operations (i.e.
juno db [commands]
). Under thedb
category, there's currently one subcommand added which isinfo
(i.e.juno db info
) to display the blockchain information stored in the database.Rationale
The current available methods to obtain blockchain information require users to run a Juno node. It's more convenient to read the data directly from the database. In the future, we may support more DB operations such as manual CRUD, pebbleDB statistics, import/export and more.
Example
Command:
juno db info --db-path db | jq