Test the CLI's "query proposals" command #6045
Merged
Garnix CI / package checks/cardano-testnet/cardano-testnet-test [x86_64-linux]
failed
Jan 14, 2025 in 38m 42s
Run results
Build failed
Details
Last 100 lines of logs:
┃ │ /nix/store/v1ilfpzlbrzbamiimxk01clnk94ciisv-cardano-cli-exe-cardano-cli-10.2.0.0/bin/cardano-cli conway query drep-stake-distribution --all-dreps
┃ │ [(DRepKeyHash (KeyHash {unKeyHash = "76b97aadc6e3e702fe82e7d391a5295a19bf2416b23aa5cc99484e90"}),Coin 15019729983513),(DRepKeyHash (KeyHash {unKeyHash = "931b0d4f202e0e1c4ca9fec714277c529a55f836d16d9917d16e5f00"}),Coin 15019729983513),(DRepKeyHash (KeyHash {unKeyHash = "b6ed8fe29f16f3e1e952516f8153aaf2f17a4637517d814cab5dfaec"}),Coin 15019729983513)]
415 ┃
416 ┃ -- TODO: we could check that the Coin amount below is the one reported
417 ┃ -- by query stake-address-info
418 ┃
419 ┃ H.assertWith drepStakeDistribution $ \dreps ->
420 ┃ length dreps == 3 -- Because, by default, 3 DReps are created
421 ┃
422 ┃ forM_ drepStakeDistribution $ \(_drep, Coin coin) -> do
423 ┃ let expected = 15_000_003_000_000
424 ┃ -- FIXME: For some reason the stake distribution fluctuates here.
425 ┃ -- Where those stake fluctuations come from?
426 ┃ tolerance = 10_000_000_000
427 ┃ H.assertWithinTolerance coin expected tolerance
┃ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
┃ │ ━━━ Failed (- lhs) (+ rhs) ━━━
┃ │ - 15019729983513
┃ │ + 15010003000000
428 ┃
429 ┃ TestQueryCommitteeMembersStateCmd ->
430 ┃ -- committee-state
431 ┃ H.noteM_ $ execCli' execConfig [ eraName, "query", "committee-state" ]
432 ┃
433 ┃ TestQueryTreasuryValueCmd -> do
434 ┃ -- treasury
435 ┃ H.noteM_ $ execCli' execConfig [ eraName, "query", "treasury" ]
436 ┃
437 ┃ TestQueryProposalsCmd -> do
438 ┃ -- query proposals
439 ┃ -- Tested further in Cardano.Testnet.Test.Gov.ProposeNewConstitution.hprop_ledger_events_propose_new_constitution
440 ┃ H.noteM_ $ execCli' execConfig [ eraName, "query", "proposals", "--all-proposals" ]
441 ┃
442 ┃ where
443 ┃ -- | Wait for the part of the epoch when futurePParams are known
444 ┃ waitForFuturePParamsToStabilise
445 ┃ :: HasCallStack
446 ┃ => MonadIO m
447 ┃ => MonadTest m
448 ┃ => MonadAssertion m
449 ┃ => MonadCatch m
450 ┃ => EpochStateView
451 ┃ -> ShelleyGenesis StandardCrypto
452 ┃ -> m SlotNo -- ^ The block number reached
453 ┃ waitForFuturePParamsToStabilise epochStateView shelleyGenesisConf = withFrozenCallStack $
454 ┃ H.noteShowM . H.nothingFailM $
455 ┃ watchEpochStateUpdate epochStateView (EpochInterval 2) $ \(_, slotNo, _) -> do
456 ┃ pure $ if areFuturePParamsStable shelleyGenesisConf slotNo
457 ┃ then Just slotNo
458 ┃ else Nothing
459 ┃
460 ┃ -- We wait till a slot after: 4 * securityParam / slotCoeff
461 ┃ -- If we query 'govState' before that we get 'PotentialPParamsUpdate'
462 ┃ -- in 'futurePParams' field
463 ┃ areFuturePParamsStable :: ShelleyGenesis StandardCrypto -> SlotNo -> Bool
464 ┃ areFuturePParamsStable
465 ┃ ShelleyGenesis{ Api.sgActiveSlotsCoeff = activeSlotsCoeff
466 ┃ , Api.sgEpochLength = L.EpochSize epochLength
467 ┃ , Api.sgSecurityParam = securityParam
468 ┃ }
469 ┃ (SlotNo slotNo) =
470 ┃ let firstSlotOfEpoch = slotNo `div` epochLength * epochLength
471 ┃ slotsInEpochToWaitOut = ceiling (4 * fromIntegral securityParam / unboundRational activeSlotsCoeff) + 1
472 ┃ minSlotInThisEpochToWaitTo = firstSlotOfEpoch + slotsInEpochToWaitOut + 1
473 ┃ in slotNo >= minSlotInThisEpochToWaitTo
474 ┃
475 ┃ readVerificationKeyFromFile :: (HasCallStack, MonadIO m, MonadCatch m, MonadTest m, HasTextEnvelope (VerificationKey keyrole), SerialiseAsBech32 (VerificationKey keyrole))
476 ┃ => AsType keyrole
477 ┃ -> FilePath
478 ┃ -> File content direction
479 ┃ -> m (VerificationKey keyrole)
480 ┃ readVerificationKeyFromFile asKey work =
481 ┃ H.evalEitherM . liftIO . runExceptT . readVerificationKeyOrFile asKey . VerificationKeyFilePath . File . (work </>) . unFile
482 ┃
483 ┃ _verificationStakeKeyToStakeAddress :: Int -> VerificationKey StakeKey -> StakeAddress
484 ┃ _verificationStakeKeyToStakeAddress testnetMagic delegatorVKey =
485 ┃ makeStakeAddress (fromNetworkMagic $ NetworkMagic $ fromIntegral testnetMagic) (StakeCredentialByKey $ verificationKeyHash delegatorVKey)
486 ┃
487 ┃ getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
488 ┃ getTxIx sbe txId amount (AnyNewEpochState sbe' _ tbs, _, _) = do
489 ┃ Refl <- H.leftFail $ assertErasEqual sbe sbe'
490 ┃ shelleyBasedEraConstraints sbe' $ do
491 ┃ return $ Map.foldlWithKey (\acc (TxIn (TxId thisTxId) (TxIx thisTxIx)) (TxOut _ txOutValue _ _) ->
492 ┃ case acc of
493 ┃ Nothing | hashToStringAsHex thisTxId == txId &&
494 ┃ txOutValueToLovelace txOutValue == amount -> Just $ fromIntegral thisTxIx
495 ┃ | otherwise -> Nothing
496 ┃ x -> x) Nothing $ getUTxOValues sbe' tbs
This failure can be reproduced by running:
> recheckAt (Seed 5596914508734103242 1578178741050653147) "1:" CliQueries
Use "--pattern '$NF ~ /CliQueries/' --hedgehog-replay '1: Seed 5596914508734103242 1578178741050653147'" to reproduce from the command-line.
Use -p '/CliQueries/' to rerun this test only.
SubmitApi
transaction: OK (76.65s)
✓ transaction passed 1 test.
14 out of 22 tests failed (843.96s)
Loading