-
Notifications
You must be signed in to change notification settings - Fork 724
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
Add governance Info action test #5629
Conversation
396e4a3
to
e67fe96
Compare
cb8da1f
to
f9b1c99
Compare
let actions = | ||
map snd | ||
$ filter ((== govActionIdx) . fst) | ||
$ map (first (\gai -> do | ||
let (L.GovActionIx i) = L.gaidGovActionIx gai | ||
i | ||
)) | ||
$ Map.assocs $ L.proposalsGovActionStates proposals | ||
case actions of | ||
[L.GovActionState{L.gasDRepVotes=votes}] | ||
| length votes == 3 -> ias{hasReceivedVotes = True} |
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.
Quite readable for what it does, nice ❤️
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.
Compared with the existing cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/ProposeNewConstitution.hs
and this one works similarly 👍
One question though: don't we want to use query gov-state
(or alike) instead of using foldBlocks
at the end? I thought we were moving away from this foldBlock
pattern, in its existing shape at least.
cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/InfoAction.hs
Outdated
Show resolved
Hide resolved
void $ H.execCli' execConfig | ||
[ "conway", "query", "utxo" | ||
, "--address", Text.unpack $ paymentKeyInfoAddr $ head wallets | ||
, "--cardano-mode" | ||
, "--testnet-magic", show @Int testnetMagic | ||
, "--out-file", work </> "utxo-1.json" | ||
] | ||
|
||
txin1 <- do | ||
utxoJson <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json" | ||
UTxO utxo <- H.noteShowM $ decodeEraUTxO sbe utxoJson | ||
H.noteShow =<< H.headM (Map.keys utxo) |
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.
Could you make this a function? This is used a number of times in this test, but also in others.
Making it a function would reduce the test's length and make the important part stand out a bit more.
@smelc an info action is not visible in the ledger state, not sure about gov-state. I can't use |
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.
LGTM!
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} |
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.
Why do we need this?
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.
afair HLint was complaining about !! 0
, which is fine here in my opinion
] | ||
|
||
-- Create Drep registration certificates | ||
let drepCertFile :: Int -> FilePath |
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 is fine for now but we can inject the dreps into the genesis after the next release of api and cli. We will probably want a single standalone test that makes sure the cli can generate the certificates and successfully submit them.
0bcf75e
to
dfc7f4c
Compare
Description
Add a governance info testnet scenario.
Checklist
See Runnings tests for more details
CHANGELOG.md
for affected package.cabal
files are updatedhlint
. See.github/workflows/check-hlint.yml
to get thehlint
versionstylish-haskell
. See.github/workflows/stylish-haskell.yml
to get thestylish-haskell
versionghc-8.10.7
andghc-9.2.7
Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.