-
Notifications
You must be signed in to change notification settings - Fork 720
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
Query for stakepools in run tx build #3152
Conversation
pparams <- executeQuery era cModeParams localConnInfo pParamsQuery | ||
(eraHistory, systemStart) <- firstExceptT ShelleyTxCmdAcquireFailure | ||
$ newExceptT $ queryEraHistoryAndSystemStart localNodeConnInfo Nothing | ||
(utxo, pparams, eraHistory, systemStart, stakePools) <- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@newhoggy I originally suggested changing from ExceptT _ IO _
to IO (Either _ _)
in the return type of executeLocalStateQueryExpr
, was that meant to avoid some of this pain here?
I'll leave it up to you, but you could also just replace joinEitherM ShelleyTxCmdAcquireFailure id
with fmap (join . first ShelleyTxCmdAcquireFailure)
then you can avoid having to create joinEither
/joinEitherM
helper functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move those helper functions to the cli or refactor as David suggested above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes
ad0f5a6
to
fa3fac9
Compare
fa3fac9
to
03339e7
Compare
03339e7
to
a4efda1
Compare
bors merge |
👎 Rejected by too few approved reviews |
@@ -794,7 +838,7 @@ executeQuery era cModeP localNodeConnInfo q = do | |||
execQuery :: IO (Either AcquireFailure (Either EraMismatch result)) | |||
execQuery = queryNodeLocalState localNodeConnInfo Nothing q | |||
|
|||
getSbe :: CardanoEraStyle era -> ExceptT ShelleyQueryCmdError IO (ShelleyBasedEra era) | |||
getSbe :: Monad m => CardanoEraStyle era -> ExceptT ShelleyQueryCmdError m (ShelleyBasedEra era) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave this as concrete IO
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to back out that change.
There is one place where m /= IO
, which is here: https://github.com/input-output-hk/cardano-node/blob/7438366f3c2dbb845bc7a73aee4288be23448b29/cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs#L691
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the compile error:
src/Cardano/CLI/Shelley/Run/Query.hs:691:18: error:
• Couldn't match type 'IO'
with 'LocalStateQueryExpr
(BlockInMode mode) ChainPoint (QueryInMode mode) () IO'
Expected type: ExceptT
ShelleyQueryCmdError
(LocalStateQueryExpr
(BlockInMode mode) ChainPoint (QueryInMode mode) () IO)
(ShelleyBasedEra era)
Actual type: ExceptT
ShelleyQueryCmdError IO (ShelleyBasedEra era)
• In a stmt of a 'do' block: sbe <- getSbe $ cardanoEraStyle era
In the expression:
do sbe <- getSbe $ cardanoEraStyle era
firstExceptT ShelleyQueryCmdEraMismatch . ExceptT
$ queryExpr . QueryInEra eInMode . QueryInShelleyBasedEra sbe
$ QueryStakePools
In a case alternative:
Just eInMode
-> do sbe <- getSbe $ cardanoEraStyle era
firstExceptT ShelleyQueryCmdEraMismatch . ExceptT
$ queryExpr . QueryInEra eInMode . QueryInShelleyBasedEra sbe
$ QueryStakePools
• Relevant bindings include
eInMode :: EraInMode era mode
(bound at src/Cardano/CLI/Shelley/Run/Query.hs:690:14)
cMode :: ConsensusMode mode
(bound at src/Cardano/CLI/Shelley/Run/Query.hs:687:11)
localNodeConnInfo :: LocalNodeConnectInfo mode
(bound at src/Cardano/CLI/Shelley/Run/Query.hs:678:7)
cModeParams :: ConsensusModeParams mode
(bound at src/Cardano/CLI/Shelley/Run/Query.hs:674:44)
|
691 | sbe <- getSbe $ cardanoEraStyle era
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a4efda1
to
e04bb8c
Compare
bors merge |
e04bb8c
to
7438366
Compare
Canceled. |
bors merge |
Build succeeded: |
3176: Query for stakepools in run tx build r=newhoggy a=newhoggy * Query for stake pool ids to pass into `makeTransactionBodyAutoBalance`. * Merge multiple separate queries into a single connection. * New `query stake-pools` command. This is a second attempt for #3152 Co-authored-by: John Ky <john.ky@iohk.io>
3176: Query for stakepools in run tx build r=newhoggy a=newhoggy * Query for stake pool ids to pass into `makeTransactionBodyAutoBalance`. * Merge multiple separate queries into a single connection. * New `query stake-pools` command. This is a second attempt for IntersectMBO/cardano-node#3152 Co-authored-by: John Ky <john.ky@iohk.io>
3176: Query for stakepools in run tx build r=newhoggy a=newhoggy * Query for stake pool ids to pass into `makeTransactionBodyAutoBalance`. * Merge multiple separate queries into a single connection. * New `query stake-pools` command. This is a second attempt for IntersectMBO/cardano-node#3152 Co-authored-by: John Ky <john.ky@iohk.io>
No description provided.