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

Restore stable query cmds #955

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Restore stable query cmds #955

merged 2 commits into from
Oct 30, 2024

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Oct 29, 2024

Resolves #953

Changelog

- description: |
    Restore stable query cmds
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@Jimbo4350 Jimbo4350 force-pushed the jordan/restore-stable-queries branch from d1a63a1 to a7bb1ad Compare October 29, 2024 20:45
Copy link
Contributor

@smelc smelc left a comment

Choose a reason for hiding this comment

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

Left a few comments but LGTM 👍

I checked that all commands that were in 9.0.0 are brought back 👍

pTip envCli =
subParser "tip" $
Opt.info (pQueryTipCmd ShelleyBasedEraConway envCli) $
Opt.progDesc "Get the node's current tip (slot no, hash, block no)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Opt.progDesc "Get the node's current tip (slot no, hash, block no)"
Opt.progDesc "Get the node's current tip (slot number, hash, block number)"

Optional.

Rationale: I think abbreviations can be misleading, in particular to non-native.

-- Queries actually depend on the node to client version which may coincide
-- with a hardfork but not necessarily. We will expose commands at the top level
-- regardless if they are compatible with the era or not. The help text should be
-- updated to make this clear. Gating commands behind eras
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment's last sentence is incomplete.

@@ -32,6 +33,8 @@ data ClientCommand
KeyCommands KeyCmds
| -- | Era agnostic node commands
NodeCommands NodeCmds
| -- | Query commands
forall era. QueryCommands (QueryCmds era)
Copy link
Contributor

Choose a reason for hiding this comment

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

pQueryCmdsTopLevel is instantiated by ConwayEra, so we can avoid the existential quantifier here if we want.

Copy link
Contributor

@carbolymer carbolymer Oct 30, 2024

Choose a reason for hiding this comment

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

I like this idea. I think we should define

type MainnetEra = ConwayEra

mainnetEra :: ShelleyBasedEra MainnetEra
mainnetEra = shelleyBasedEra

and use it wherever we need to reference the currently supported era.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I have a way to remove all mention of era.

Opt.info (pQueryPoolStateCmd ShelleyBasedEraConway envCli) $
Opt.progDesc $
mconcat
[ "DEPRECATED. Use query pool-state instead. Dump the pool parameters "
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this was deprecated, maybe not reintroduce it?

pStakeDistribution :: EnvCli -> Parser (QueryCmds ConwayEra)
pStakeDistribution envCli =
subParser "stake-distribution" $
Opt.info (pQueryStakeDistributionCmd ShelleyBasedEraConway envCli) $
Copy link
Contributor

@carbolymer carbolymer Oct 30, 2024

Choose a reason for hiding this comment

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

Let's not hardcode eras in multiple places. The current era ShelleyBasedEraConway should be defined in one place only and referenced from where it's needed.

Opt.info (pQueryTxMempoolCmd envCli) $
Opt.progDesc "Local Mempool info"

pSlotNumber :: EnvCli -> Parser (QueryCmds ConwayEra)
Copy link
Contributor

@carbolymer carbolymer Oct 30, 2024

Choose a reason for hiding this comment

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

All those parsers should accept era parameter (instead of hardcoding an era) and get reused in pQueryCmds.

@@ -60,6 +61,13 @@ addressCmdsTopLevel envCli = AddressCommand <$> pAddressCmds envCli
nodeCmdsTopLevel :: Parser ClientCommand
nodeCmdsTopLevel = NodeCommands <$> pNodeCmds

-- Queries actually depend on the node to client version which may coincide
-- with a hardfork but not necessarily. We will expose commands at the top level
Copy link
Contributor

Choose a reason for hiding this comment

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

We will expose commands at the top level (...)

The help text should be (...)

I don't think mentioning our intentions in the comments brings any value. Unless it's a TODO, which is easier to spot and correct than a prose with wishes.

i =
Opt.progDesc $
mconcat
[ "Node query commands. Will query the local node whose Unix domain socket is "
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to mention why this commands set is narrowed down in comparison to conway query.

Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

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

Makes sense. I left some non-critical remarks (can be done in a follow-up PR if we're in a hurry here).

@carbolymer carbolymer added this pull request to the merge queue Oct 30, 2024
Merged via the queue into main with commit 112b13b Oct 30, 2024
27 checks passed
@carbolymer carbolymer deleted the jordan/restore-stable-queries branch October 30, 2024 10:03
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.

[FR] - Bring back query tip as toplevel command
3 participants