From 008a9ebb7211ac1cb043b0cb5cf59f5258ba6abc Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 19 Jul 2024 15:25:16 -0400 Subject: [PATCH 1/3] test: Add a Conway parameter change governance test --- cardano-chain-gen/cardano-chain-gen.cabal | 1 + .../src/Cardano/Mock/Forging/Tx/Conway.hs | 10 +++ cardano-chain-gen/src/Cardano/Mock/Query.hs | 20 ++++-- .../test/Test/Cardano/Db/Mock/Unit/Conway.hs | 1 + .../Cardano/Db/Mock/Unit/Conway/Governance.hs | 70 ++++++++++++++++++- .../testfiles/fingerprint/conwayParamChange | 1 + 6 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 cardano-chain-gen/test/testfiles/fingerprint/conwayParamChange diff --git a/cardano-chain-gen/cardano-chain-gen.cabal b/cardano-chain-gen/cardano-chain-gen.cabal index daeb65b38..1ca8f7d4b 100644 --- a/cardano-chain-gen/cardano-chain-gen.cabal +++ b/cardano-chain-gen/cardano-chain-gen.cabal @@ -195,6 +195,7 @@ test-suite cardano-chain-gen , esqueleto , extra , filepath + , microlens , silently , stm , strict-stm diff --git a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs index dfad4c18a..1332cb251 100644 --- a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs +++ b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs @@ -50,6 +50,7 @@ module Cardano.Mock.Forging.Tx.Conway ( mkRegDelegTxCert, mkAddCommitteeTx, mkTreasuryWithdrawalTx, + mkParamChangeTx, mkGovActionProposalTx, mkGovVoteTx, Babbage.mkParamUpdateTx, @@ -563,6 +564,15 @@ mkTreasuryWithdrawalTx rewardAccount amount = mkGovActionProposalTx govAction withdrawals = Map.singleton rewardAccount amount hashProtection = SNothing +mkParamChangeTx :: + Core.PParamsUpdate StandardConway -> + AlonzoTx StandardConway +mkParamChangeTx paramsUpdate = mkGovActionProposalTx govAction + where + govAction = Governance.ParameterChange prevGovAction paramsUpdate hashProtection + prevGovAction = SNothing + hashProtection = SNothing + mkGovActionProposalTx :: Governance.GovAction StandardConway -> AlonzoTx StandardConway diff --git a/cardano-chain-gen/src/Cardano/Mock/Query.hs b/cardano-chain-gen/src/Cardano/Mock/Query.hs index 70eac04d4..66c513d22 100644 --- a/cardano-chain-gen/src/Cardano/Mock/Query.hs +++ b/cardano-chain-gen/src/Cardano/Mock/Query.hs @@ -2,6 +2,7 @@ {-# LANGUAGE TypeApplications #-} module Cardano.Mock.Query ( + queryParamFromEpoch, queryVersionMajorFromEpoch, queryParamProposalFromEpoch, queryNullTxDepositExists, @@ -19,6 +20,18 @@ import Cardano.Prelude hiding (from, on) import Database.Esqueleto.Experimental import Prelude () +queryParamFromEpoch :: + (MonadIO io, PersistField field) => + EntityField Db.EpochParam field -> + Word64 -> + ReaderT SqlBackend io (Maybe field) +queryParamFromEpoch field epochNo = do + res <- selectOne $ do + prop <- from $ table @Db.EpochParam + where_ (prop ^. Db.EpochParamEpochNo ==. val epochNo) + pure (prop ^. field) + pure $ unValue <$> res + -- | Query protocol parameters from @EpochParam@ by epoch number. Note that epoch -- parameters are inserted at the beginning of the next epoch. -- @@ -32,12 +45,7 @@ queryVersionMajorFromEpoch :: MonadIO io => Word64 -> ReaderT SqlBackend io (Maybe Word16) -queryVersionMajorFromEpoch epochNo = do - res <- selectOne $ do - prop <- from $ table @Db.EpochParam - where_ (prop ^. Db.EpochParamEpochNo ==. val epochNo) - pure (prop ^. Db.EpochParamProtocolMajor) - pure $ unValue <$> res +queryVersionMajorFromEpoch = queryParamFromEpoch Db.EpochParamProtocolMajor -- | Query protocol parameter proposals from @ParamProposal@ by epoch number. queryParamProposalFromEpoch :: diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs index 335135dad..1d3073fe4 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs @@ -221,6 +221,7 @@ unitTests iom knownMigrations = , test "new committee member" Governance.newCommittee , test "update constitution" Governance.updateConstitution , test "treasury withdrawal" Governance.treasuryWithdrawal + , test "protocol parameter change" Governance.paramChange ] ] where diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs index 431c9321d..7d0ef0278 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs @@ -11,6 +11,7 @@ module Test.Cardano.Db.Mock.Unit.Conway.Governance ( drepDistr, newCommittee, + paramChange, updateConstitution, treasuryWithdrawal, ) where @@ -22,7 +23,8 @@ import Cardano.Ledger.BaseTypes (AnchorData (..), Network (..), hashAnchorData, import Cardano.Ledger.Coin (Coin (..)) import Cardano.Ledger.Conway.Governance (GovActionId (..), GovActionIx (..), Voter (..)) import qualified Cardano.Ledger.Conway.Governance as Governance -import Cardano.Ledger.Core (txIdTx) +import Cardano.Ledger.Conway.PParams (ppuGovActionDepositL) +import Cardano.Ledger.Core (emptyPParamsUpdate, txIdTx) import Cardano.Ledger.Credential (Credential (..)) import Cardano.Ledger.Keys (KeyHash (..)) import Cardano.Ledger.SafeHash (SafeToHash (..)) @@ -35,6 +37,8 @@ import qualified Cardano.Mock.Query as Query import Cardano.Prelude import Cardano.Slotting.Slot (EpochNo (..)) import Data.Maybe (fromJust) +import Data.Maybe.Strict (StrictMaybe (..)) +import Lens.Micro import qualified Ouroboros.Consensus.Shelley.Eras as Consensus import Test.Cardano.Db.Mock.Config import qualified Test.Cardano.Db.Mock.UnifiedApi as Api @@ -252,3 +256,67 @@ treasuryWithdrawal = "Unexpected constution voting anchor" where testLabel = "conwayTreasuryWithdrawal" + +paramChange :: IOManager -> [(Text, Text)] -> Assertion +paramChange = + withFullConfig conwayConfigDir testLabel $ \interpreter server dbSync -> do + startDBSync dbSync + + -- Add stake + void (Api.registerAllStakeCreds interpreter server) + + -- Register a DRep and delegate votes to it + void (Api.registerDRepsAndDelegateVotes interpreter server) + + -- DRep distribution is calculated at end of the current epoch + epoch0 <- Api.fillUntilNextEpoch interpreter server + + -- Register committee hot credentials + -- TODO[sgillespie]: Let's get this in UnifiedApi or something + void $ + Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> + mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + + -- Create and vote for a governance proposal + void $ + Api.withConwayFindLeaderAndSubmit interpreter server $ \ledger -> do + let proposalTx = Conway.mkParamChangeTx newParams + newParams = + emptyPParamsUpdate & ppuGovActionDepositL .~ SJust (Coin 100) + + addVoteTx = + Conway.mkGovVoteTx + govActionId + ( [ DRepVoter (Prelude.head Forging.unregisteredDRepIds) + , StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) + ] + ++ map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds + ) + + govActionId = + GovActionId + { gaidTxId = txIdTx proposalTx + , gaidGovActionIx = GovActionIx 0 + } + + pure [proposalTx, addVoteTx] + + -- It takes 2 epochs to enact a proposal--ratification will happen on the next + -- epoch and enacted on the following. + epoch1 <- Api.fillEpochs interpreter server 2 + + -- Wait for it to synch + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 4) + + epochNo <- unEpochNo <$> getCurrentEpoch interpreter + + -- Should have updated epoch param + assertEqQuery + dbSync + (join <$> Query.queryParamFromEpoch Db.EpochParamGovActionDeposit epochNo) + (Just $ Db.DbWord64 100) + "Unexpected constution voting anchor" + where + testLabel = "conwayParamChange" diff --git a/cardano-chain-gen/test/testfiles/fingerprint/conwayParamChange b/cardano-chain-gen/test/testfiles/fingerprint/conwayParamChange new file mode 100644 index 000000000..61068d990 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/fingerprint/conwayParamChange @@ -0,0 +1 @@ +[12,16,18,21,24,30,31,32,33,40,41,42,43,47,52,60,62,70,80,84,86,92,98,100,106,109,110,111,112,127,134,138,146,149,154,166,168,178,183,188,193,194,198,200,202,220,222,223,224,225,231,239,242,247,261,282,283,288,289,301,302,303,308,313,315,316,320,331,334,344,345,363,364,368,369,375,377,381,389,394,407,418,422,425,430,437,438,439,440,447,450,453,454,456,458,461,467,492,499,507,516,524,538,541,544,546,550,567,573,576,577,579,580,586,589,595,597,603,605,609,616,618,619,623,624,634,636,643,644,659,664,665,672,678,692,705,711,712,719,726,730,739,740,743,747,749,751,754,759,762,763,765,767,773,777,786,788,789,794,801,806,807,829,830,832,849,851,853,869,871,874,875,878,882,888,893,895,896,898,899,903,906,908,911,912,913,922,930,932,938,941,944,950,960,963,966,968,972,977,985,986,988,990,991,994,997,1001,1005,1008,1014,1019,1020,1021,1026,1027,1031,1032,1033,1036,1037,1049,1050,1053,1057,1062,1067,1068,1070,1074,1083,1102,1104,1107,1111,1115,1117,1118,1120,1125,1127,1137,1149,1151,1155,1161,1164,1167,1174,1187,1200,1201,1206,1213,1218,1221,1237,1242,1248,1258,1263,1266,1272,1277,1286,1299,1300,1304,1309,1313,1317,1336,1338,1343,1356,1363,1366,1376,1377,1379,1390,1397,1401,1408,1409,1410,1418,1423,1424,1429,1432,1435,1438,1439,1442,1444,1449,1453,1454,1461,1462,1470,1473,1474,1481,1484,1486,1503] \ No newline at end of file From 7dbba3ab61465a84fe66a4f05f48791eacf522ab Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 19 Jul 2024 16:21:18 -0400 Subject: [PATCH 2/3] test: Add a Conway hard fork initiation governance test --- cardano-chain-gen/cardano-chain-gen.cabal | 1 + .../src/Cardano/Mock/Forging/Tx/Conway.hs | 7 + .../test/Test/Cardano/Db/Mock/Unit/Conway.hs | 1 + .../Cardano/Db/Mock/Unit/Conway/Governance.hs | 80 ++++- .../genesis.alonzo.json | 188 ++++++++++++ .../genesis.byron.json | 31 ++ .../genesis.conway.json | 278 ++++++++++++++++++ .../config-conway-bootstrap/genesis.json | 118 ++++++++ .../config-conway-bootstrap/pools/bulk1.creds | 1 + .../config-conway-bootstrap/test-config.json | 110 +++++++ .../test-db-sync-config.json | 115 ++++++++ .../test/testfiles/fingerprint/conwayHardFork | 1 + 12 files changed, 924 insertions(+), 7 deletions(-) create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.alonzo.json create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.byron.json create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.conway.json create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.json create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/pools/bulk1.creds create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-config.json create mode 100644 cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-db-sync-config.json create mode 100644 cardano-chain-gen/test/testfiles/fingerprint/conwayHardFork diff --git a/cardano-chain-gen/cardano-chain-gen.cabal b/cardano-chain-gen/cardano-chain-gen.cabal index 1ca8f7d4b..cb6533cf0 100644 --- a/cardano-chain-gen/cardano-chain-gen.cabal +++ b/cardano-chain-gen/cardano-chain-gen.cabal @@ -179,6 +179,7 @@ test-suite cardano-chain-gen , cardano-db-sync , cardano-chain-gen , cardano-ledger-alonzo + , cardano-ledger-binary , cardano-ledger-conway , cardano-ledger-core , cardano-ledger-mary diff --git a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs index 1332cb251..452eb91fb 100644 --- a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs +++ b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs @@ -51,6 +51,7 @@ module Cardano.Mock.Forging.Tx.Conway ( mkAddCommitteeTx, mkTreasuryWithdrawalTx, mkParamChangeTx, + mkHardForkTx, mkGovActionProposalTx, mkGovVoteTx, Babbage.mkParamUpdateTx, @@ -573,6 +574,12 @@ mkParamChangeTx paramsUpdate = mkGovActionProposalTx govAction prevGovAction = SNothing hashProtection = SNothing +mkHardForkTx :: ProtVer -> AlonzoTx StandardConway +mkHardForkTx version = mkGovActionProposalTx govAction + where + govAction = Governance.HardForkInitiation prevGovAction version + prevGovAction = SNothing + mkGovActionProposalTx :: Governance.GovAction StandardConway -> AlonzoTx StandardConway diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs index 1d3073fe4..65fab8c06 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs @@ -222,6 +222,7 @@ unitTests iom knownMigrations = , test "update constitution" Governance.updateConstitution , test "treasury withdrawal" Governance.treasuryWithdrawal , test "protocol parameter change" Governance.paramChange + , test "hardfork initiation" Governance.hardFork ] ] where diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs index 7d0ef0278..f43157ef3 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs @@ -12,6 +12,7 @@ module Test.Cardano.Db.Mock.Unit.Conway.Governance ( drepDistr, newCommittee, paramChange, + hardFork, updateConstitution, treasuryWithdrawal, ) where @@ -19,7 +20,8 @@ module Test.Cardano.Db.Mock.Unit.Conway.Governance ( import qualified Cardano.Db as Db import Cardano.DbSync.Era.Shelley.Generic.Util (unCredentialHash) import Cardano.Ledger.Address (RewardAccount (..)) -import Cardano.Ledger.BaseTypes (AnchorData (..), Network (..), hashAnchorData, textToUrl) +import Cardano.Ledger.BaseTypes (AnchorData (..), Network (..), ProtVer (..), hashAnchorData, textToUrl) +import Cardano.Ledger.Binary.Version (natVersion) import Cardano.Ledger.Coin (Coin (..)) import Cardano.Ledger.Conway.Governance (GovActionId (..), GovActionIx (..), Voter (..)) import qualified Cardano.Ledger.Conway.Governance as Governance @@ -287,12 +289,12 @@ paramChange = addVoteTx = Conway.mkGovVoteTx govActionId - ( [ DRepVoter (Prelude.head Forging.unregisteredDRepIds) - , StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) - ] - ++ map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds + ( map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds + ++ [ DRepVoter (Prelude.head Forging.unregisteredDRepIds) + , StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) + ] ) govActionId = @@ -320,3 +322,67 @@ paramChange = "Unexpected constution voting anchor" where testLabel = "conwayParamChange" + +hardFork :: IOManager -> [(Text, Text)] -> Assertion +hardFork = + withFullConfig configDir testLabel $ \interpreter server dbSync -> do + startDBSync dbSync + + -- Add stake + void (Api.registerAllStakeCreds interpreter server) + + -- Register a DRep and delegate votes to it + void (Api.registerDRepsAndDelegateVotes interpreter server) + + -- DRep distribution is calculated at end of the current epoch + epoch0 <- Api.fillUntilNextEpoch interpreter server + + -- Register committee hot credentials + -- TODO[sgillespie]: Let's get this in UnifiedApi or something + void $ + Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> + mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + + -- Create and vote for a governance proposal + void $ + Api.withConwayFindLeaderAndSubmit interpreter server $ \ledger -> do + let proposalTx = Conway.mkHardForkTx version + version = ProtVer (natVersion @10) 0 + + addVoteTx = + Conway.mkGovVoteTx + govActionId + ( map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds + ++ [ StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) + , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) + ] + ) + + govActionId = + GovActionId + { gaidTxId = txIdTx proposalTx + , gaidGovActionIx = GovActionIx 0 + } + + pure [proposalTx, addVoteTx] + + -- It takes 2 epochs to enact a proposal--ratification will happen on the next + -- epoch and enacted on the following. + epoch1 <- Api.fillEpochs interpreter server 2 + + -- Wait for it to synch + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 4) + + epochNo <- getCurrentEpoch interpreter + + -- Protocol major version should now be 10 + assertEqBackoff + dbSync + (Query.queryVersionMajorFromEpoch (unEpochNo epochNo)) + (Just 10) + [] + "Unexpected protocol major version" + where + configDir = "config-conway-bootstrap" + testLabel = "conwayHardFork" diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.alonzo.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.alonzo.json new file mode 100644 index 000000000..bcc2d3176 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.alonzo.json @@ -0,0 +1,188 @@ +{ + "collateralPercentage": 1, + "maxBlockExUnits": { + "exUnitsMem": 500000000000, + "exUnitsSteps": 500000000000 + }, + "maxCollateralInputs": 5, + "maxValueSize": 4000, + "costModels": { + "PlutusV1": { + "sha2_256-memory-arguments": 4, + "equalsString-cpu-arguments-constant": 1000, + "cekDelayCost-exBudgetMemory": 100, + "lessThanEqualsByteString-cpu-arguments-intercept": 103599, + "divideInteger-memory-arguments-minimum": 1, + "appendByteString-cpu-arguments-slope": 621, + "blake2b-cpu-arguments-slope": 29175, + "iData-cpu-arguments": 150000, + "encodeUtf8-cpu-arguments-slope": 1000, + "unBData-cpu-arguments": 150000, + "multiplyInteger-cpu-arguments-intercept": 61516, + "cekConstCost-exBudgetMemory": 100, + "nullList-cpu-arguments": 150000, + "equalsString-cpu-arguments-intercept": 150000, + "trace-cpu-arguments": 150000, + "mkNilData-memory-arguments": 32, + "lengthOfByteString-cpu-arguments": 150000, + "cekBuiltinCost-exBudgetCPU": 29773, + "bData-cpu-arguments": 150000, + "subtractInteger-cpu-arguments-slope": 0, + "unIData-cpu-arguments": 150000, + "consByteString-memory-arguments-intercept": 0, + "divideInteger-memory-arguments-slope": 1, + "divideInteger-cpu-arguments-model-arguments-slope": 118, + "listData-cpu-arguments": 150000, + "headList-cpu-arguments": 150000, + "chooseData-memory-arguments": 32, + "equalsInteger-cpu-arguments-intercept": 136542, + "sha3_256-cpu-arguments-slope": 82363, + "sliceByteString-cpu-arguments-slope": 5000, + "unMapData-cpu-arguments": 150000, + "lessThanInteger-cpu-arguments-intercept": 179690, + "mkCons-cpu-arguments": 150000, + "appendString-memory-arguments-intercept": 0, + "modInteger-cpu-arguments-model-arguments-slope": 118, + "ifThenElse-cpu-arguments": 1, + "mkNilPairData-cpu-arguments": 150000, + "lessThanEqualsInteger-cpu-arguments-intercept": 145276, + "addInteger-memory-arguments-slope": 1, + "chooseList-memory-arguments": 32, + "constrData-memory-arguments": 32, + "decodeUtf8-cpu-arguments-intercept": 150000, + "equalsData-memory-arguments": 1, + "subtractInteger-memory-arguments-slope": 1, + "appendByteString-memory-arguments-intercept": 0, + "lengthOfByteString-memory-arguments": 4, + "headList-memory-arguments": 32, + "listData-memory-arguments": 32, + "consByteString-cpu-arguments-intercept": 150000, + "unIData-memory-arguments": 32, + "remainderInteger-memory-arguments-minimum": 1, + "bData-memory-arguments": 32, + "lessThanByteString-cpu-arguments-slope": 248, + "encodeUtf8-memory-arguments-intercept": 0, + "cekStartupCost-exBudgetCPU": 100, + "multiplyInteger-memory-arguments-intercept": 0, + "unListData-memory-arguments": 32, + "remainderInteger-cpu-arguments-model-arguments-slope": 118, + "cekVarCost-exBudgetCPU": 29773, + "remainderInteger-memory-arguments-slope": 1, + "cekForceCost-exBudgetCPU": 29773, + "sha2_256-cpu-arguments-slope": 29175, + "equalsInteger-memory-arguments": 1, + "indexByteString-memory-arguments": 1, + "addInteger-memory-arguments-intercept": 1, + "chooseUnit-cpu-arguments": 150000, + "sndPair-cpu-arguments": 150000, + "cekLamCost-exBudgetCPU": 29773, + "fstPair-cpu-arguments": 150000, + "quotientInteger-memory-arguments-minimum": 1, + "decodeUtf8-cpu-arguments-slope": 1000, + "lessThanInteger-memory-arguments": 1, + "lessThanEqualsInteger-cpu-arguments-slope": 1366, + "fstPair-memory-arguments": 32, + "modInteger-memory-arguments-intercept": 0, + "unConstrData-cpu-arguments": 150000, + "lessThanEqualsInteger-memory-arguments": 1, + "chooseUnit-memory-arguments": 32, + "sndPair-memory-arguments": 32, + "addInteger-cpu-arguments-intercept": 197209, + "decodeUtf8-memory-arguments-slope": 8, + "equalsData-cpu-arguments-intercept": 150000, + "mapData-cpu-arguments": 150000, + "mkPairData-cpu-arguments": 150000, + "quotientInteger-cpu-arguments-constant": 148000, + "consByteString-memory-arguments-slope": 1, + "cekVarCost-exBudgetMemory": 100, + "indexByteString-cpu-arguments": 150000, + "unListData-cpu-arguments": 150000, + "equalsInteger-cpu-arguments-slope": 1326, + "cekStartupCost-exBudgetMemory": 100, + "subtractInteger-cpu-arguments-intercept": 197209, + "divideInteger-cpu-arguments-model-arguments-intercept": 425507, + "divideInteger-memory-arguments-intercept": 0, + "cekForceCost-exBudgetMemory": 100, + "blake2b-cpu-arguments-intercept": 2477736, + "remainderInteger-cpu-arguments-constant": 148000, + "tailList-cpu-arguments": 150000, + "encodeUtf8-cpu-arguments-intercept": 150000, + "equalsString-cpu-arguments-slope": 1000, + "lessThanByteString-memory-arguments": 1, + "multiplyInteger-cpu-arguments-slope": 11218, + "appendByteString-cpu-arguments-intercept": 396231, + "lessThanEqualsByteString-cpu-arguments-slope": 248, + "modInteger-memory-arguments-slope": 1, + "addInteger-cpu-arguments-slope": 0, + "equalsData-cpu-arguments-slope": 10000, + "decodeUtf8-memory-arguments-intercept": 0, + "chooseList-cpu-arguments": 150000, + "constrData-cpu-arguments": 150000, + "equalsByteString-memory-arguments": 1, + "cekApplyCost-exBudgetCPU": 29773, + "quotientInteger-memory-arguments-slope": 1, + "verifySignature-cpu-arguments-intercept": 3345831, + "unMapData-memory-arguments": 32, + "mkCons-memory-arguments": 32, + "sliceByteString-memory-arguments-slope": 1, + "sha3_256-memory-arguments": 4, + "ifThenElse-memory-arguments": 1, + "mkNilPairData-memory-arguments": 32, + "equalsByteString-cpu-arguments-slope": 247, + "appendString-cpu-arguments-intercept": 150000, + "quotientInteger-cpu-arguments-model-arguments-slope": 118, + "cekApplyCost-exBudgetMemory": 100, + "equalsString-memory-arguments": 1, + "multiplyInteger-memory-arguments-slope": 1, + "cekBuiltinCost-exBudgetMemory": 100, + "remainderInteger-memory-arguments-intercept": 0, + "sha2_256-cpu-arguments-intercept": 2477736, + "remainderInteger-cpu-arguments-model-arguments-intercept": 425507, + "lessThanEqualsByteString-memory-arguments": 1, + "tailList-memory-arguments": 32, + "mkNilData-cpu-arguments": 150000, + "chooseData-cpu-arguments": 150000, + "unBData-memory-arguments": 32, + "blake2b-memory-arguments": 4, + "iData-memory-arguments": 32, + "nullList-memory-arguments": 32, + "cekDelayCost-exBudgetCPU": 29773, + "subtractInteger-memory-arguments-intercept": 1, + "lessThanByteString-cpu-arguments-intercept": 103599, + "consByteString-cpu-arguments-slope": 1000, + "appendByteString-memory-arguments-slope": 1, + "trace-memory-arguments": 32, + "divideInteger-cpu-arguments-constant": 148000, + "cekConstCost-exBudgetCPU": 29773, + "encodeUtf8-memory-arguments-slope": 8, + "quotientInteger-cpu-arguments-model-arguments-intercept": 425507, + "mapData-memory-arguments": 32, + "appendString-cpu-arguments-slope": 1000, + "modInteger-cpu-arguments-constant": 148000, + "verifySignature-cpu-arguments-slope": 1, + "unConstrData-memory-arguments": 32, + "quotientInteger-memory-arguments-intercept": 0, + "equalsByteString-cpu-arguments-constant": 150000, + "sliceByteString-memory-arguments-intercept": 0, + "mkPairData-memory-arguments": 32, + "equalsByteString-cpu-arguments-intercept": 112536, + "appendString-memory-arguments-slope": 1, + "lessThanInteger-cpu-arguments-slope": 497, + "modInteger-cpu-arguments-model-arguments-intercept": 425507, + "modInteger-memory-arguments-minimum": 1, + "sha3_256-cpu-arguments-intercept": 0, + "verifySignature-memory-arguments": 1, + "cekLamCost-exBudgetMemory": 100, + "sliceByteString-cpu-arguments-intercept": 150000 + } + }, + "executionPrices": { + "prMem": 0.1, + "prSteps": 0.1 + }, + "lovelacePerUTxOWord": 1, + "maxTxExUnits": { + "exUnitsMem": 500000000000, + "exUnitsSteps": 500000000000 + } +} \ No newline at end of file diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.byron.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.byron.json new file mode 100644 index 000000000..25ced6be5 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.byron.json @@ -0,0 +1,31 @@ +{ "bootStakeholders": + { "1a3e49767796fd99b057ad54db3310fd640806fcb0927399bbca7b43": 1 } +, "heavyDelegation": + { } +, "startTime": 1637266922 +, "nonAvvmBalances": + { } +, "blockVersionData": + { "scriptVersion": 0 + , "slotDuration": "20000" + , "maxBlockSize": "2000000" + , "maxHeaderSize": "2000000" + , "maxTxSize": "4096" + , "maxProposalSize": "700" + , "mpcThd": "20000000000000" + , "heavyDelThd": "300000000000" + , "updateVoteThd": "1000000000000" + , "updateProposalThd": "100000000000000" + , "updateImplicit": "10000" + , "softforkRule": + { "initThd": "900000000000000" + , "minThd": "600000000000000" + , "thdDecrement": "50000000000000" + } + , "txFeePolicy": + { "summand": "155381000000000" , "multiplier": "43946000000" } + , "unlockStakeEpoch": "18446744073709551615" + } +, "protocolConsts": { "k": 10 , "protocolMagic": 42 } +, "avvmDistr": {} +} diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.conway.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.conway.json new file mode 100644 index 000000000..5873665e0 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.conway.json @@ -0,0 +1,278 @@ +{ + "poolVotingThresholds": { + "committeeNormal": 0.6, + "committeeNoConfidence": 0.51, + "hardForkInitiation": 0.51, + "motionNoConfidence": 0.6, + "ppSecurityGroup": 0.6 + }, + "dRepVotingThresholds": { + "motionNoConfidence": 0.67, + "committeeNormal": 0.67, + "committeeNoConfidence": 0.6, + "updateToConstitution": 0.75, + "hardForkInitiation": 0.6, + "ppNetworkGroup": 0.67, + "ppEconomicGroup": 0.67, + "ppTechnicalGroup": 0.67, + "ppGovGroup": 0.75, + "treasuryWithdrawal": 0.67 + }, + "committeeMinSize": 3, + "committeeMaxTermLength": 73, + "govActionLifetime": 8, + "govActionDeposit": 50000000000, + "dRepDeposit": 500000000, + "dRepActivity": 20, + "minFeeRefScriptCostPerByte": 44, + "plutusV3CostModel": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1159724, + 392670, + 0, + 2, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 35190005, + 10, + 57996947, + 18975, + 10, + 39121781, + 32260, + 10, + 23000, + 100, + 23000, + 100, + 832808, + 18, + 3209094, + 6, + 331451, + 1, + 65990684, + 23097, + 18, + 114242, + 18, + 94393407, + 87060, + 18, + 16420089, + 18, + 2145798, + 36, + 3795345, + 12, + 889023, + 1, + 204237282, + 23271, + 36, + 129165, + 36, + 189977790, + 85902, + 36, + 33012864, + 36, + 388443360, + 1, + 401885761, + 72, + 2331379, + 72, + 1927926, + 82523, + 4, + 117366, + 10475, + 4, + 1292075, + 24469, + 74, + 0, + 1, + 936157, + 49601, + 237, + 0, + 1 + ], + "constitution": { + "anchor": { + "url": "https://raw.githubusercontent.com/carloslodelar/proposals/main/constitution.txt", + "dataHash": "f89cc2469ce31c3dfda2f3e0b56c5c8b4ee4f0e5f66c30a3f12a95298b01179e" + } + }, + "committee": { + "members": { + "scriptHash-8fc13431159fdda66347a38c55105d50d77d67abc1c368b876d52ad1": 336, + "scriptHash-921e1ccb4812c4280510c9ccab81c561f3d413e7d744d48d61215d1f": 400, + "scriptHash-d5d09d9380cf9dcde1f3c6cd88b08ca9e00a3d550022ca7ee4026342": 400, + "scriptHash-2c698e41831684b16477fb50082b0c0e396d436504e39037d5366582": 400 + }, + "threshold": 0.66 + } +} \ No newline at end of file diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.json new file mode 100644 index 000000000..efe875ab3 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/genesis.json @@ -0,0 +1,118 @@ +{ + "maxLovelaceSupply": 60000000, + "securityParam": 10, + "slotsPerKESPeriod": 129600, + "updateQuorum": 2, + "activeSlotsCoeff": 0.2, + "protocolParams": { + "minUTxOValue": 0, + "eMax": 18, + "extraEntropy": { + "tag": "NeutralNonce" + }, + "minFeeB": 0, + "tau": 0.0, + "maxBlockBodySize": 65536, + "maxTxSize": 16384, + "minPoolCost": 0, + "minFeeA": 1, + "nOpt": 3, + "maxBlockHeaderSize": 1100, + "keyDeposit": 0, + "poolDeposit": 0, + "protocolVersion": { + "minor": 0, + "major": 9 + }, + "a0": 0.3, + "rho": 0.0, + "decentralisationParam": 0 + }, + "networkMagic": 42, + "initialFunds": { + "00ae51de0c8e130f9ec51755f163258fe661e95e2648080f8e5c9583571b9b85d81adacab01fd7ee2f6e1619a0ca67b619a849bbb069ef0e42": 900000, + "005fdb717fabe97938da294e151d96b4af375bea38d176021edb9975b8921c25093b263793a1baf36166b819543f5822c62f725715a4136b39": 900000, + "60b13227c296440956c2a014359d6d83e9a854deec46471b57bd2ed2b6": 900000, + "60959e277d0f9213ac343e7841dc247089879585c9b6f49e8e0a0e8ce7": 900000, + "607903a7c2c29c52a963f40cf58357cb5bae37e2d57e2463b51e747efb": 900000, + "00c34b6acfb276a6ec529b3ab56d56988dcd8968647ceeebc28be28751ed15a48df4d479feca6e418ad433041bce1e94cc58d0e104455189bf": 900000, + "005fdb717fabe97938da294e151d96b4af375bea38d176021ed1111111921c25093b263793a1baf36166b819543f5822c62f72571111111111": 900000, + "005fdb717fabe97938da294e151d96b4af375bea38d176021ed222222295be61304693df94ba89ff989e6542f174bb10d5ff49e8e8b1292519": 900000, + "005fdb717fabe97938da294e151d96b4af375bea38d176021ed3333333921c25093b263793a1baf36166b819543f5822c62f72573333333333": 900000, + "005fdb717fabe97938da294e151d96b4af375bea38d176021ed1231231b09771da66c23a23450a53420f25b609cfa3b776068da27bee2371e1": 900000 + }, + "networkId": "Testnet", + "maxKESEvolutions": 60, + "genDelegs": { + "30c3083efd794227fde2351a04500349d1b467556c30e35d6794a501": { + "delegate": "3af50e522694318e8856d34021140817aa21d47ff62a4d0ddcba1924", + "vrf": "2846ed605f6629976ec92e9e65140c1cb3a95c563c996592c926a2ae7e5a461f" + }, + "471cc34983f6a2fd7b4018e3147532185d69a448d6570d46019e58e6": { + "delegate": "1683652d05e83e25eb648a9543db33cf8ff1f7a2af9129d3a901dd4a", + "vrf": "4df7c5a5b30469756bd09db60cbe9b0cf1b2447e0c41122d130768c179b7d166" + } + }, + "slotLength": 1, + "systemStart": "2021-11-18T20:22:02Z", + "epochLength": 500, + "staking": { + "pools": { + "9f1b441b9b781b3c3abb43b25679dc17dbaaf116dddca1ad09dc1de0": { + "publicKey": "9f1b441b9b781b3c3abb43b25679dc17dbaaf116dddca1ad09dc1de0", + "cost": 5, + "metadata": null, + "owners": [], + "vrf": "a78358019b160775d7b04f7c5e06462e1469823cead9b005c941ecefcc386c51", + "pledge": 0, + "margin": 0.01, + "rewardAccount": { + "network": "Testnet", + "credential": { + "key hash": "addfa484e8095ff53f45b25cf337923cf79abe6ec192fdf288d621f9" + } + }, + "relays": [] + }, + "5af582399de8c226391bfd21424f34d0b053419c4d93975802b7d107": { + "publicKey": "5af582399de8c226391bfd21424f34d0b053419c4d93975802b7d107", + "cost": 5, + "metadata": null, + "owners": ["95be61304693df94ba89ff989e6542f174bb10d5ff49e8e8b1292519"], + "vrf": "71833bb9a56532e952bdb30f5f2773ec375d0e02e81a5374246485979012b02a", + "pledge": 0, + "margin": 0.01, + "rewardAccount": { + "network": "Testnet", + "credential": { + "key hash": "95be61304693df94ba89ff989e6542f174bb10d5ff49e8e8b1292519" + } + }, + "relays": [] + }, + "58eef2925db2789f76ea057c51069e52c5e0a44550f853c6cdf620f8": { + "publicKey": "58eef2925db2789f76ea057c51069e52c5e0a44550f853c6cdf620f8", + "cost": 100, + "metadata": null, + "owners": ["921c25093b263793a1baf36166b819543f5822c62f72573333333333"], + "vrf": "8ce25eb830d7f4f7b79e65de7392dab4a156e0298446df022b6175fcaf7aba27", + "pledge": 0, + "margin": 0.01, + "rewardAccount": { + "network": "Testnet", + "credential": { + "key hash": "b09771da66c23a23450a53420f25b609cfa3b776068da27bee2371e1" + } + }, + "relays": [] + } + }, + "stake": { + "921c25093b263793a1baf36166b819543f5822c62f725715a4136b39": "58eef2925db2789f76ea057c51069e52c5e0a44550f853c6cdf620f8", + "ed15a48df4d479feca6e418ad433041bce1e94cc58d0e104455189bf": "5af582399de8c226391bfd21424f34d0b053419c4d93975802b7d107", + "1b9b85d81adacab01fd7ee2f6e1619a0ca67b619a849bbb069ef0e42": "9f1b441b9b781b3c3abb43b25679dc17dbaaf116dddca1ad09dc1de0", + "b09771da66c23a23450a53420f25b609cfa3b776068da27bee2371e1": "58eef2925db2789f76ea057c51069e52c5e0a44550f853c6cdf620f8", + "95be61304693df94ba89ff989e6542f174bb10d5ff49e8e8b1292519": "9f1b441b9b781b3c3abb43b25679dc17dbaaf116dddca1ad09dc1de0" + } + } +} diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/pools/bulk1.creds b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/pools/bulk1.creds new file mode 100644 index 000000000..f0216586b --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/pools/bulk1.creds @@ -0,0 +1 @@ +[[{"cborHex":"8284582091bb7c5b3b409250d63addeaa4f41123c78b703d2612516a3c059f7c2b1e15310000584071ce22482933f85ffddf9cb90778cb0248ebe441b2697d413f9225b01ce786e2a120c227ec96ca8d713157758cf0ea45cc7723d2d9f3f9adad219500b3c6c80e582057ed87e13cbdc2fec8a4ebc6242b76d6c71fa483d3813799a2cb3eb710d1f577","description":"","type":"NodeOperationalCertificate"},{"cborHex":"58403467216a6c6555397c57c79830c9723ddc8668fc9c44c50386193a2ea559887bf8f07e0ad5c29d6080333329fa971867061ffeba0c30f2672fe5809f461b6ecb","description":"VRF Signing Key","type":"VrfSigningKey_PraosVRF"},{"cborHex":"590260d4ea8d759ab61e5dce8b6dfea931cd9e3918ea61d2870152a6146553c323bb7de6713109f8b9ac327796747cc3c85a48678d89cb3f09901b1c57dd2bd1dbc8a8e0f5fd64ce2c5c994e3382320a97ee17341bba737c92bfff4f1e213b5f606f32f91989d2a1b255cb8620abb8667ef3831eb752953052925412aea10b5a2b8649c3aadb079a19dee0387404d161804028f42984c44d6c90ce6366535acf6d712c973068222b6bd646cf037fa0b2aec7ab924a0a6668aebfb53282f6dd1baedd349909d3150dfd06068bd35efcd4db9cca6d9f43ec25864fbc2ee781ac7f9f0bd566544eb374e4663fbe18b513ac13a15c0c2b9dd5607d43c09afbf66ca70651cfc980562e4d69bb7d986f8203cd6c723463b0603e45a3be8ec288b40435d6c4c763122657892f5a558d7a1b52f435b2ae0727d3ef8ae37dee24cc1091002d33b2c9a46ffad59ead9c39e285a65b4911e7579b67550426765eff92d0bb47dd66c452df274d42aacb03ed094b698e2e5d2e188dbed041ae7bf2ee57d3fe7934d038c3a6920347d646eca70d6f403f2b5db5a37ecb1d39e593c1ed19838e2b6dc26228f03bc56f73495e17bc4b78b0ea16f7ef6eaef6ba11dd63d0807720cafd80c978b76c42b86bffc4b32710cba203656afb69fb266934869d2be758f33787f2365f5d65fe19a6a9c546c165cff0ff805fef2281b0b24706be9750c0401467aab795dfc931f3d8e943b7fe877c09816100a4bb1667cfe9753d9cf2477275e4eaef45aee37fa658cab049f8645b32447a0358df23f82f96f624bb0432486b9e755e179faef04387cb15210a2d17d147cbd693a3d56e1b899e3a66bd4d3dc1d4634d","description":"KES Signing Key","type":"KesSigningKey_ed25519_kes_2^6"}],[{"cborHex":"82845820970179a0f36e39aa8bb4095dc4fb219e8382d0ba20ec9b235c458e636d1e596f0000584098aad60b0bfbfda4981ba5f92b07a6b09990e7364191bf6d34558f15f39b51a04a07c852c4255a484353c5a0f325e79c448099fb3d859c12216029bd97f6090c5820d478654ee2c301f78446db60537377f69875ffcba2781a81c0e2bf3c77209410","description":"","type":"NodeOperationalCertificate"},{"cborHex":"58409da4aabcc214be4a6f7dd3efe77b1809c969edf867f3e592b6a84fd3ce2f33134f50bf8a1710b0854ba79a9a7e90c5b6a3082d4608d057e5ab432c933f293767","description":"VRF Signing Key","type":"VrfSigningKey_PraosVRF"},{"cborHex":"590260a65014be8d192af8cd1be12ed2e3aff1744f92bfea2406948344f4a6f07f5d92cfc2561ac2d8c8a52e3001c6b4d52c04dcedacc0bbf3e48a43dd230c5a6cbc2803922803a9c2245f0634e96d50b395644609794811b7d07f69fb8642af58a3fd51566a15976f198dd61ac47812d021c298038cca5af7f69d9be3b280c4d50e2f75c21a414cbecaf4ed3229563ca26934906df54d7e10a5d7e579cb34ce6d1932ac015fbd8c34610d7b63e42ac208fe5cee7c78938a61c57d7f5c917d70dfd7dfc456ffcd745b64d3aa282368e71dd22f2631eec3df03f6c482724936a3b687dc6c9f4f332cf1e185eceef8d8de538948aec9d0e1dcb9cc252db3eb722af488a3adcef9ecb560c737cfe736d5d89ea2cd0e38d5ddffb5a5f8645ce9acc1ece25ba1cac3c1e0b43d22d4479d4daa703b0cc95ec6954d90c7a5d4feae748417c01db58f6dc1f0e256bf0e886ec1268d7bd3ef603c999cdc3e431a3d823d2ae70353504baff71b1e308f410f3c6eea3f4fc3390771cca3625bde1afe4b1bce88c60e3472719fe716a5fe34e6adc94c9407c31e3837df08c2206e8f6462b7889c00c5a1b2e129abdc312131b2591affcce31ef301f136cc91a2453d11fe0bd03885284d8622c3b48fc1209fd1f802caa1028f8efd72f7b180eae644eb0134429ddd7f6035c8b1d696e33deff624faceec6fe1092f837ddb96ba5e5cf9ea145ec1d56527945ef3e0bb80245643dc1766bc0fcce58dcfdd718c3b84334def83d41f5ed693dfab9ce3f9ac2509929f4beef897dee36940c9f8a26ce577707d4a3125c08c6807a00f88d040da929cefb6f6b76494358e07f2e278bb5e7c6ee8a83d997205","description":"KES Signing Key","type":"KesSigningKey_ed25519_kes_2^6"}],[{"cborHex":"82845820112b314dfe4d619bb215c52c4973b51ac269f161370ea57aed3f334811f2923300005840c1715a7c12b52bca14e33d8b8d23e2c9b139e2be0beded4426bc401d3f8f16a5a6660f78f192329de7566c3b2d1fe5e9a2bb5476573689a03660a18b7f20850258200ba394a87622c06c4d67af4e3fa2314824c5d8db428f8200c6eb49033c7e27ec","description":"","type":"NodeOperationalCertificate"},{"cborHex":"58400def24a9256e667363b8a9529d6d8d4893c932a40c02eecd2777a55940254fffab6800ebfb93be0b69dbe2f9ef6dfe39fc0117304c6370485e48b11dc709d59c","description":"VRF Signing Key","type":"VrfSigningKey_PraosVRF"},{"cborHex":"5902605f91217f9ae5ea1ce6dd6b42eafdc5e95c4361e98be395dbf9fc87285eaf6171fd737c7d240941941555484ffdb6f01704a938e58a65ec522a9041df131ebb69fd876eaa1c3621a549c3c5e22eef483e267c2282d02f5a1a60d00786e6951f4ac4c9a8536a8333f02d5ccef2b3093851d10b903694ebc5f6b97039e0a5a48e385838b6db8143362c324e90ffdad680e6c18c7280495c2d4fc28600f93e48091eb0d92aed0ec63312a03d9d89d44ac5b71aa1c1ea289b31ef88a0ca7c0508e944af118730f5443ac68fdc227620234f663c8dfa75796935a14955fbb9f1f216984504b3fc391d6ca2275a4f202029981c4ca5d06cff3dec78c2b28aee2dd4594e5ef286705932e989e619030f5c54a47bf767b883b19eca6d0663008385c807a2da97e2a0d99810ade35e71254eb667cac8261f2990a903ef658942c19ef5109fe33539224b5fb98281c4f90757b7fc0dc3d7239f77b4d1905bed3083773daebfbe15e791b33a8d051325af9dbfe2b1451b7fddc8ae5b7454ba68a219d9b186686a02c57bccae68bc9bdf3c05a9008cf78adc0e5e464537769646b8cc0f6fa71b555d7426aa15f06635fbbdf48c2d3eba56f23ad26799cb5253b456e2b30eb7013775390278c761d35ddd129b0a07b686dad1ab09cd9416dcd7e476648d9d2e6dc7addc8a1b842b7c3a59bdbd803bec78fcb058c64251886ff7a3106387150c651edba78d20f890d2c3d208bc37eb2d449487d6b11160913af836ff4877153893179e739c3e483c75e7b26e8c06e35ed50d3e805879fdd8bb6281581fecee6b30a1343b0dd696103072f2afc35c90677706231c8daa754c401b49e47719cc219d","description":"KES Signing Key","type":"KesSigningKey_ed25519_kes_2^6"}]] \ No newline at end of file diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-config.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-config.json new file mode 100644 index 000000000..e2d7db5d7 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-config.json @@ -0,0 +1,110 @@ +{ + "AlonzoGenesisFile": "genesis.alonzo.json", + "AlonzoGenesisHash": "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874", + "ByronGenesisFile": "genesis.byron.json", + "ByronGenesisHash": "865a9da19944fc00cefe5a0cdcb6dc9d3964a74681d9488ab79967f13a6400b3", + "ConwayGenesisFile": "genesis.conway.json", + "ConwayGenesisHash": "e061972cc4c8d2c76e15b30c3898ef291a533c8f82642c57c0610052599ce60e", + "LastKnownBlockVersion-Alt": 0, + "LastKnownBlockVersion-Major": 9, + "LastKnownBlockVersion-Minor": 1, + "MaxKnownMajorProtocolVersion": 9, + "PBftSignatureThreshold": 1.1, + "Protocol": "Cardano", + "RequiresNetworkMagic": "RequiresMagic", + "ShelleyGenesisFile": "genesis.json", + "ShelleyGenesisHash": "733960b0b305cbfedcca13d2fea87b077f17501d257d4d2844d1f1e3d9dea0b7", + "TestAllegraHardForkAtEpoch": 0, + "TestAlonzoHardForkAtEpoch": 0, + "TestBabbageHardForkAtEpoch": 0, + "TestConwayHardForkAtEpoch": 0, + "TestEnableDevelopmentHardForkEras": false, + "TestEnableDevelopmentNetworkProtocols": false, + "TestMaryHardForkAtEpoch": 0, + "TestShelleyHardForkAtEpoch": 0, + "TraceAcceptPolicy": true, + "TraceBlockFetchClient": false, + "TraceBlockFetchDecisions": false, + "TraceBlockFetchProtocol": false, + "TraceBlockFetchProtocolSerialised": false, + "TraceBlockFetchServer": false, + "TraceChainDb": true, + "TraceChainSyncBlockServer": false, + "TraceChainSyncClient": false, + "TraceChainSyncHeaderServer": false, + "TraceChainSyncProtocol": false, + "TraceConnectionManager": true, + "TraceDNSResolver": true, + "TraceDNSSubscription": true, + "TraceDiffusionInitialization": true, + "TraceErrorPolicy": true, + "TraceForge": true, + "TraceHandshake": false, + "TraceInboundGovernor": true, + "TraceIpSubscription": true, + "TraceLedgerPeers": true, + "TraceLocalChainSyncProtocol": false, + "TraceLocalErrorPolicy": true, + "TraceLocalHandshake": false, + "TraceLocalRootPeers": true, + "TraceLocalTxSubmissionProtocol": false, + "TraceLocalTxSubmissionServer": false, + "TraceMempool": true, + "TraceMux": false, + "TracePeerSelection": true, + "TracePeerSelectionActions": true, + "TracePublicRootPeers": true, + "TraceServer": true, + "TraceTxInbound": false, + "TraceTxOutbound": false, + "TraceTxSubmissionProtocol": false, + "TracingVerbosity": "NormalVerbosity", + "TurnOnLogMetrics": true, + "TurnOnLogging": true, + "defaultBackends": [ + "KatipBK" + ], + "defaultScribes": [ + [ + "StdoutSK", + "stdout" + ] + ], + "hasEKG": 12788, + "hasPrometheus": [ + "127.0.0.1", + 12798 + ], + "minSeverity": "Debug", + "options": { + "mapBackends": { + "cardano.node.metrics": [ + "EKGViewBK" + ], + "cardano.node.resources": [ + "EKGViewBK" + ] + }, + "mapSubtrace": { + "cardano.node.metrics": { + "subtrace": "Neutral" + } + } + }, + "rotation": { + "rpKeepFilesNum": 10, + "rpLogLimitBytes": 5000000, + "rpMaxAgeHours": 24 + }, + "setupBackends": [ + "KatipBK" + ], + "setupScribes": [ + { + "scFormat": "ScText", + "scKind": "StdoutSK", + "scName": "stdout", + "scRotation": null + } + ] +} diff --git a/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-db-sync-config.json b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-db-sync-config.json new file mode 100644 index 000000000..13555f30a --- /dev/null +++ b/cardano-chain-gen/test/testfiles/config-conway-bootstrap/test-db-sync-config.json @@ -0,0 +1,115 @@ +{ + "EnableLogMetrics": false, + "EnableLogging": true, + "EnableFutureGenesis" : true, + "NetworkName": "testing", + "NodeConfigFile": "test-config.json", + "PrometheusPort": 8080, + "RequiresNetworkMagic": "RequiresMagic", + "defaultBackends": [ + "KatipBK" + ], + "defaultScribes": [ + [ + "StdoutSK", + "stdout" + ] + ], + "minSeverity": "Info", + "options": { + "cfokey": { + "value": "Release-1.0.0" + }, + "mapBackends": {}, + "mapSeverity": { + "db-sync-node": "Info", + "db-sync-node.Mux": "Error", + "db-sync-node.Subscription": "Error" + }, + "mapSubtrace": { + "#ekgview": { + "contents": [ + [ + { + "contents": "cardano.epoch-validation.benchmark", + "tag": "Contains" + }, + [ + { + "contents": ".monoclock.basic.", + "tag": "Contains" + } + ] + ], + [ + { + "contents": "cardano.epoch-validation.benchmark", + "tag": "Contains" + }, + [ + { + "contents": "diff.RTS.cpuNs.timed.", + "tag": "Contains" + } + ] + ], + [ + { + "contents": "#ekgview.#aggregation.cardano.epoch-validation.benchmark", + "tag": "StartsWith" + }, + [ + { + "contents": "diff.RTS.gcNum.timed.", + "tag": "Contains" + } + ] + ] + ], + "subtrace": "FilterTrace" + }, + "#messagecounters.aggregation": { + "subtrace": "NoTrace" + }, + "#messagecounters.ekgview": { + "subtrace": "NoTrace" + }, + "#messagecounters.katip": { + "subtrace": "NoTrace" + }, + "#messagecounters.monitoring": { + "subtrace": "NoTrace" + }, + "#messagecounters.switchboard": { + "subtrace": "NoTrace" + }, + "benchmark": { + "contents": [ + "GhcRtsStats", + "MonotonicClock" + ], + "subtrace": "ObservableTrace" + }, + "cardano.epoch-validation.utxo-stats": { + "subtrace": "NoTrace" + } + } + }, + "rotation": { + "rpKeepFilesNum": 10, + "rpLogLimitBytes": 5000000, + "rpMaxAgeHours": 24 + }, + "setupBackends": [ + "AggregationBK", + "KatipBK" + ], + "setupScribes": [ + { + "scFormat": "ScText", + "scKind": "StdoutSK", + "scName": "stdout", + "scRotation": null + } + ] +} diff --git a/cardano-chain-gen/test/testfiles/fingerprint/conwayHardFork b/cardano-chain-gen/test/testfiles/fingerprint/conwayHardFork new file mode 100644 index 000000000..16eb26840 --- /dev/null +++ b/cardano-chain-gen/test/testfiles/fingerprint/conwayHardFork @@ -0,0 +1 @@ +[0,2,6,7,9,19,24,25,28,32,41,48,54,57,67,68,74,75,79,81,85,86,89,90,109,119,137,139,146,154,155,156,158,162,164,166,173,174,184,186,188,194,197,204,206,208,212,215,219,222,224,236,239,240,250,254,260,267,268,271,277,287,290,296,298,305,308,316,324,334,349,362,371,381,398,412,423,424,426,437,440,444,446,447,458,464,465,468,470,476,478,483,487,497,503,507,515,516,520,521,525,530,535,546,547,561,568,576,587,593,596,600,608,614,617,618,619,623,630,634,637,643,645,649,650,652,654,655,657,667,670,683,687,691,694,698,718,724,731,736,740,741,742,743,744,748,749,754,759,760,763,765,769,773,776,777,778,782,785,788,789,804,809,811,813,815,819,823,831,832,837,840,844,853,854,858,860,863,878,902,906,907,914,919,924,925,926,935,938,940,942,945,948,957,959,972,977,983,984,987,992,996,998,1003,1008,1014,1015,1021,1023,1037,1042,1043,1045,1046,1057,1059,1061,1063,1069,1090,1092,1100,1108,1113,1117,1118,1119,1122,1134,1140,1156,1159,1161,1163,1164,1165,1166,1173,1178,1187,1190,1191,1192,1197,1198,1211,1212,1232,1233,1235,1249,1252,1258,1259,1263,1272,1275,1282,1283,1285,1288,1296,1298,1299,1301,1304,1305,1322,1328,1330,1335,1346,1347,1348,1350,1365,1371,1373,1377,1380,1385,1388,1390,1394,1397,1402,1404,1407,1408,1413,1431,1433,1448,1450,1451,1454,1457,1466,1481,1483,1488,1492,1493,1499,1504] \ No newline at end of file From 127b7554afd2d95892dcc84ed9d4a7a57d8538e1 Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Mon, 22 Jul 2024 14:04:13 -0400 Subject: [PATCH 3/3] refactor: Factor out governance initialization for tests --- .../Mock/Forging/Tx/Conway/Scenarios.hs | 8 ++ .../src/Cardano/Mock/Forging/Tx/Generic.hs | 23 ++- .../test/Test/Cardano/Db/Mock/UnifiedApi.hs | 24 ++++ .../Cardano/Db/Mock/Unit/Conway/Governance.hs | 132 +++--------------- .../testfiles/fingerprint/conwayDrepDistr | 2 +- .../testfiles/fingerprint/conwayNewCommittee | 2 +- 6 files changed, 77 insertions(+), 114 deletions(-) diff --git a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs index 9b18ec460..b668e623f 100644 --- a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs +++ b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs @@ -10,6 +10,7 @@ module Cardano.Mock.Forging.Tx.Conway.Scenarios ( delegateAndSendBlocks, registerDRepsAndDelegateVotes, + registerCommitteeCreds, ) where import Cardano.Ledger.Address (Addr (..), Withdrawals (..)) @@ -120,3 +121,10 @@ registerDRepAndDelegateVotes' drepId stakeIx ledger = do delegTx <- Conway.mkDCertTx [regDelegCert] (Withdrawals mempty) Nothing pure [paymentTx, regTx, delegTx] + +registerCommitteeCreds :: Interpreter -> IO CardanoBlock +registerCommitteeCreds interpreter = do + let txs' = mapM (uncurry Conway.mkCommitteeAuthTx) bootstrapCommitteeCreds + blockTxs <- withConwayLedgerState interpreter $ const txs' + + forgeNextFindLeader interpreter (map TxConway blockTxs) diff --git a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Generic.hs b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Generic.hs index 28ea4154d..c5561a166 100644 --- a/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Generic.hs +++ b/cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Generic.hs @@ -26,6 +26,9 @@ module Cardano.Mock.Forging.Tx.Generic ( registeredShelleyGenesisKeys, bootstrapCommitteeCreds, unregisteredDRepIds, + spoVoters, + committeeVoters, + drepVoters, consPoolParams, getPoolStakeCreds, ) where @@ -36,6 +39,7 @@ import qualified Cardano.Crypto.Hash as Hash import Cardano.Ledger.Address import Cardano.Ledger.BaseTypes import Cardano.Ledger.Coin (Coin (..)) +import Cardano.Ledger.Conway.Governance (Voter (..)) import qualified Cardano.Ledger.Core as Core import Cardano.Ledger.Credential import Cardano.Ledger.Crypto (ADDRHASH) @@ -51,7 +55,7 @@ import qualified Cardano.Ledger.UMap as UMap import Cardano.Mock.Forging.Crypto import Cardano.Mock.Forging.Tx.Alonzo.ScriptsExamples import Cardano.Mock.Forging.Types -import Cardano.Prelude hiding (length, (.)) +import Cardano.Prelude import Data.Coerce (coerce) import Data.List (nub) import Data.List.Extra ((!?)) @@ -64,6 +68,7 @@ import Ouroboros.Consensus.Cardano.Block (LedgerState) import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock) import qualified Ouroboros.Consensus.Shelley.Ledger.Ledger as Consensus +import Prelude ((!!)) resolveAddress :: forall era p. @@ -308,6 +313,22 @@ mkDummyScriptHash n = ScriptHash $ mkDummyHash (Proxy @(ADDRHASH StandardCrypto) mkDummyHash :: forall h a. HashAlgorithm h => Proxy h -> Int -> Hash.Hash h a mkDummyHash _ = coerce . hashWithSerialiser @h toCBOR +spoVoters :: + EraCrypto era ~ StandardCrypto => + LedgerState (ShelleyBlock proto era) -> + [Voter StandardCrypto] +spoVoters ledger = + [ StakePoolVoter (resolvePool (PoolIndex 0) ledger) + , StakePoolVoter (resolvePool (PoolIndex 1) ledger) + , StakePoolVoter (resolvePool (PoolIndex 2) ledger) + ] + +committeeVoters :: [Voter StandardCrypto] +committeeVoters = map (CommitteeVoter . snd) bootstrapCommitteeCreds + +drepVoters :: [Voter StandardCrypto] +drepVoters = maybeToList (DRepVoter <$> head unregisteredDRepIds) + consPoolParams :: KeyHash 'StakePool StandardCrypto -> StakeCredential StandardCrypto -> diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/UnifiedApi.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/UnifiedApi.hs index 6b877dc4d..8be4970ac 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/UnifiedApi.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/UnifiedApi.hs @@ -20,8 +20,10 @@ module Test.Cardano.Db.Mock.UnifiedApi ( fillEpochs, fillEpochPercentage, rollbackTo, + initGovernance, registerAllStakeCreds, registerDRepsAndDelegateVotes, + registerCommitteeCreds, ) where import Cardano.Ledger.Alonzo (AlonzoEra) @@ -203,6 +205,22 @@ rollbackTo interpreter mockServer point = do rollbackInterpreter interpreter point atomically $ rollback mockServer point +initGovernance :: Interpreter -> ServerHandle IO CardanoBlock -> IO [CardanoBlock] +initGovernance interpreter mockServer = do + -- Add stake + blk0 <- registerAllStakeCreds interpreter mockServer + + -- Register a DRep and delegate votes to it + blk1 <- registerDRepsAndDelegateVotes interpreter mockServer + + -- DRep distribution is calculated a-*t end of the current epoch + epoch <- fillUntilNextEpoch interpreter mockServer + + -- Register committee hot credentials + blk2 <- registerCommitteeCreds interpreter mockServer + + pure ([blk0, blk1] ++ epoch ++ [blk2]) + registerAllStakeCreds :: Interpreter -> ServerHandle IO CardanoBlock -> IO CardanoBlock registerAllStakeCreds interpreter mockServer = do blk <- forgeWithStakeCreds interpreter @@ -215,6 +233,12 @@ registerDRepsAndDelegateVotes interpreter mockServer = do atomically (addBlock mockServer blk) pure blk +registerCommitteeCreds :: Interpreter -> ServerHandle IO CardanoBlock -> IO CardanoBlock +registerCommitteeCreds interpreter mockServer = do + blk <- Conway.registerCommitteeCreds interpreter + atomically (addBlock mockServer blk) + pure blk + -- Expected number. This should be taken from the parameters, instead of hardcoded. blocksPerEpoch :: Int blocksPerEpoch = 100 diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs index f43157ef3..78216d75c 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs @@ -23,7 +23,7 @@ import Cardano.Ledger.Address (RewardAccount (..)) import Cardano.Ledger.BaseTypes (AnchorData (..), Network (..), ProtVer (..), hashAnchorData, textToUrl) import Cardano.Ledger.Binary.Version (natVersion) import Cardano.Ledger.Coin (Coin (..)) -import Cardano.Ledger.Conway.Governance (GovActionId (..), GovActionIx (..), Voter (..)) +import Cardano.Ledger.Conway.Governance (GovActionId (..), GovActionIx (..)) import qualified Cardano.Ledger.Conway.Governance as Governance import Cardano.Ledger.Conway.PParams (ppuGovActionDepositL) import Cardano.Ledger.Core (emptyPParamsUpdate, txIdTx) @@ -33,6 +33,7 @@ import Cardano.Ledger.SafeHash (SafeToHash (..)) import Cardano.Mock.ChainSync.Server (IOManager) import Cardano.Mock.Forging.Interpreter (getCurrentEpoch) import qualified Cardano.Mock.Forging.Tx.Conway as Conway +import Cardano.Mock.Forging.Tx.Generic (committeeVoters, drepVoters, spoVoters) import qualified Cardano.Mock.Forging.Tx.Generic as Forging import Cardano.Mock.Forging.Types import qualified Cardano.Mock.Query as Query @@ -53,17 +54,10 @@ drepDistr = withFullConfigAndDropDB conwayConfigDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) - - -- DRep distribution is calculated at end of the current epoch - epoch1 <- Api.fillUntilNextEpoch interpreter server + epoch0 <- Api.initGovernance interpreter server -- Wait for it to sync - assertBlockNoBackoff dbSync (length epoch1 + 2) + assertBlockNoBackoff dbSync (length epoch0) -- Should now have a DRep distribution let drepId = Prelude.head Forging.unregisteredDRepIds @@ -80,11 +74,7 @@ newCommittee = withFullConfig conwayConfigDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register a DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) + epoch0 <- Api.initGovernance interpreter server -- Create and vote for gov action let committeeHash = "e0a714319812c3f773ba04ec5d6b3ffcd5aad85006805b047b082541" @@ -95,16 +85,8 @@ newCommittee = let -- Create gov action tx addCcTx = Conway.mkAddCommitteeTx committeeCred - -- Create votes for all stake pools. We start in the Conway bootstrap phase, so - -- DRep votes are not yet required. - addVoteTx = - Conway.mkGovVoteTx - govActionId - [ DRepVoter (Prelude.head Forging.unregisteredDRepIds) - , StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) - ] + -- Create votes for all stake pools + addVoteTx = Conway.mkGovVoteTx govActionId (drepVoters ++ spoVoters ledger) govActionId = GovActionId { gaidTxId = txIdTx addCcTx @@ -116,10 +98,10 @@ newCommittee = -- It takes 2 epochs to enact a proposal--ratification will happen on the next -- epoch and enacted on the following. - epochs <- Api.fillEpochs interpreter server 2 + epoch1 <- Api.fillEpochs interpreter server 2 -- Wait for it to sync - assertBlockNoBackoff dbSync (length epochs + 3) + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 1) -- Should now have a committee member assertEqQuery dbSync @@ -134,19 +116,7 @@ updateConstitution = withFullConfig conwayConfigDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register a DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) - - -- DRep distribution is calculated at end of the current epoch - epoch0 <- Api.fillUntilNextEpoch interpreter server - - -- Register committee hot credentials - void $ - Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> - mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + epoch0 <- Api.initGovernance interpreter server let newUrl = fromJust (textToUrl 64 "constitution.new") dataHash = hashAnchorData @Consensus.StandardCrypto (AnchorData "constitution content") @@ -160,12 +130,7 @@ updateConstitution = proposalTx = Conway.mkNewConstitutionTx anchor -- Create votes - addVoteTx = - Conway.mkGovVoteTx - govActionId - ( DRepVoter (Prelude.head Forging.unregisteredDRepIds) - : map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds - ) + addVoteTx = Conway.mkGovVoteTx govActionId (drepVoters ++ committeeVoters) govActionId = GovActionId { gaidTxId = txIdTx proposalTx @@ -179,7 +144,7 @@ updateConstitution = epoch1 <- Api.fillEpochs interpreter server 2 -- Wait for it to sync - assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 4) + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 1) -- Constitution should now be updated (EpochNo epochNo) <- getCurrentEpoch interpreter @@ -196,20 +161,7 @@ treasuryWithdrawal = withFullConfig conwayConfigDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register a DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) - - -- DRep distribution is calculated at end of the current epoch - epoch0 <- Api.fillUntilNextEpoch interpreter server - - -- Register committee hot credentials - -- TODO[sgillespie]: Let's get this in UnifiedApi or something - void $ - Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> - mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + epoch0 <- Api.initGovernance interpreter server -- Make sure we have treasury to spend void $ @@ -228,12 +180,7 @@ treasuryWithdrawal = rewardAccount (Coin 10_000) - addVoteTx = - Conway.mkGovVoteTx - govActionId - ( DRepVoter (Prelude.head Forging.unregisteredDRepIds) - : map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds - ) + addVoteTx = Conway.mkGovVoteTx govActionId (drepVoters ++ committeeVoters) govActionId = GovActionId @@ -248,7 +195,7 @@ treasuryWithdrawal = epoch1 <- Api.fillEpochs interpreter server 2 -- Wait for it to sync - assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 5) + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 2) -- Should now have a treasury reward assertEqQuery @@ -264,20 +211,7 @@ paramChange = withFullConfig conwayConfigDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register a DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) - - -- DRep distribution is calculated at end of the current epoch - epoch0 <- Api.fillUntilNextEpoch interpreter server - - -- Register committee hot credentials - -- TODO[sgillespie]: Let's get this in UnifiedApi or something - void $ - Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> - mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + epoch0 <- Api.initGovernance interpreter server -- Create and vote for a governance proposal void $ @@ -289,13 +223,7 @@ paramChange = addVoteTx = Conway.mkGovVoteTx govActionId - ( map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds - ++ [ DRepVoter (Prelude.head Forging.unregisteredDRepIds) - , StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) - ] - ) + (committeeVoters ++ drepVoters ++ spoVoters ledger) govActionId = GovActionId @@ -310,7 +238,7 @@ paramChange = epoch1 <- Api.fillEpochs interpreter server 2 -- Wait for it to synch - assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 4) + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 1) epochNo <- unEpochNo <$> getCurrentEpoch interpreter @@ -328,20 +256,7 @@ hardFork = withFullConfig configDir testLabel $ \interpreter server dbSync -> do startDBSync dbSync - -- Add stake - void (Api.registerAllStakeCreds interpreter server) - - -- Register a DRep and delegate votes to it - void (Api.registerDRepsAndDelegateVotes interpreter server) - - -- DRep distribution is calculated at end of the current epoch - epoch0 <- Api.fillUntilNextEpoch interpreter server - - -- Register committee hot credentials - -- TODO[sgillespie]: Let's get this in UnifiedApi or something - void $ - Api.withConwayFindLeaderAndSubmit interpreter server $ \_ -> - mapM (uncurry Conway.mkCommitteeAuthTx) Forging.bootstrapCommitteeCreds + epoch0 <- Api.initGovernance interpreter server -- Create and vote for a governance proposal void $ @@ -352,12 +267,7 @@ hardFork = addVoteTx = Conway.mkGovVoteTx govActionId - ( map (CommitteeVoter . snd) Forging.bootstrapCommitteeCreds - ++ [ StakePoolVoter (Forging.resolvePool (PoolIndex 0) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 1) ledger) - , StakePoolVoter (Forging.resolvePool (PoolIndex 2) ledger) - ] - ) + (committeeVoters ++ spoVoters ledger) govActionId = GovActionId @@ -372,7 +282,7 @@ hardFork = epoch1 <- Api.fillEpochs interpreter server 2 -- Wait for it to synch - assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 4) + assertBlockNoBackoff dbSync (length (epoch0 <> epoch1) + 1) epochNo <- getCurrentEpoch interpreter diff --git a/cardano-chain-gen/test/testfiles/fingerprint/conwayDrepDistr b/cardano-chain-gen/test/testfiles/fingerprint/conwayDrepDistr index 1c8cb8caa..0845d76d4 100644 --- a/cardano-chain-gen/test/testfiles/fingerprint/conwayDrepDistr +++ b/cardano-chain-gen/test/testfiles/fingerprint/conwayDrepDistr @@ -1 +1 @@ -[12,16,18,21,24,30,31,32,33,40,41,42,43,47,52,60,62,70,80,84,86,92,98,100,106,109,110,111,112,127,134,138,146,149,154,166,168,178,183,188,193,194,198,200,202,220,222,223,224,225,231,239,242,247,261,282,283,288,289,301,302,303,308,313,315,316,320,331,334,344,345,363,364,368,369,375,377,381,389,394,407,418,422,425,430,437,438,439,440,447,450,453,454,456,458,461,467,492,499,507] \ No newline at end of file +[12,16,18,21,24,30,31,32,33,40,41,42,43,47,52,60,62,70,80,84,86,92,98,100,106,109,110,111,112,127,134,138,146,149,154,166,168,178,183,188,193,194,198,200,202,220,222,223,224,225,231,239,242,247,261,282,283,288,289,301,302,303,308,313,315,316,320,331,334,344,345,363,364,368,369,375,377,381,389,394,407,418,422,425,430,437,438,439,440,447,450,453,454,456,458,461,467,492,499,507,516] \ No newline at end of file diff --git a/cardano-chain-gen/test/testfiles/fingerprint/conwayNewCommittee b/cardano-chain-gen/test/testfiles/fingerprint/conwayNewCommittee index 79da17351..ebc1151d0 100644 --- a/cardano-chain-gen/test/testfiles/fingerprint/conwayNewCommittee +++ b/cardano-chain-gen/test/testfiles/fingerprint/conwayNewCommittee @@ -1 +1 @@ -[12,16,18,21,24,30,31,32,33,40,41,42,43,47,52,60,62,70,80,84,86,92,98,100,106,109,110,111,112,127,134,138,146,149,154,166,168,178,183,188,193,194,198,200,202,220,222,223,224,225,231,239,242,247,261,282,283,288,289,301,302,303,308,313,315,316,320,331,334,344,345,363,364,368,369,375,377,381,389,394,407,418,422,425,430,437,438,439,440,447,450,453,454,456,458,461,467,492,499,507,516,524,538,541,544,546,550,567,573,576,577,579,580,586,589,595,597,603,605,609,616,618,619,623,624,634,636,643,644,659,664,665,672,678,692,705,711,712,719,726,730,739,740,743,747,749,751,754,759,762,763,765,767,773,777,786,788,789,794,801,806,807,829,830,832,849,851,853,869,871,874,875,878,882,888,893,895,896,898,899,903,906,908,911,912,913,922,930,932,938,941,944,950,960,963,966,968,972,977,985,986,988,990,991,994,997,1001] \ No newline at end of file +[12,16,18,21,24,30,31,32,33,40,41,42,43,47,52,60,62,70,80,84,86,92,98,100,106,109,110,111,112,127,134,138,146,149,154,166,168,178,183,188,193,194,198,200,202,220,222,223,224,225,231,239,242,247,261,282,283,288,289,301,302,303,308,313,315,316,320,331,334,344,345,363,364,368,369,375,377,381,389,394,407,418,422,425,430,437,438,439,440,447,450,453,454,456,458,461,467,492,499,507,516,524,538,541,544,546,550,567,573,576,577,579,580,586,589,595,597,603,605,609,616,618,619,623,624,634,636,643,644,659,664,665,672,678,692,705,711,712,719,726,730,739,740,743,747,749,751,754,759,762,763,765,767,773,777,786,788,789,794,801,806,807,829,830,832,849,851,853,869,871,874,875,878,882,888,893,895,896,898,899,903,906,908,911,912,913,922,930,932,938,941,944,950,960,963,966,968,972,977,985,986,988,990,991,994,997,1001,1005,1008,1014,1019,1020,1021,1026,1027,1031,1032,1033,1036,1037,1049,1050,1053,1057,1062,1067,1068,1070,1074,1083,1102,1104,1107,1111,1115,1117,1118,1120,1125,1127,1137,1149,1151,1155,1161,1164,1167,1174,1187,1200,1201,1206,1213,1218,1221,1237,1242,1248,1258,1263,1266,1272,1277,1286,1299,1300,1304,1309,1313,1317,1336,1338,1343,1356,1363,1366,1376,1377,1379,1390,1397,1401,1408,1409,1410,1418,1423,1424,1429,1432,1435,1438,1439,1442,1444,1449,1453,1454,1461,1462,1470,1473,1474,1481,1484,1486,1504] \ No newline at end of file