Skip to content

Commit

Permalink
Add the following fields for PV2 cost model:
Browse files Browse the repository at this point in the history
    "byteStringToInteger-cpu-arguments-c0"
    "byteStringToInteger-cpu-arguments-c1"
    "byteStringToInteger-cpu-arguments-c2"
    "byteStringToInteger-memory-arguments-intercept"
    "byteStringToInteger-memory-arguments-slope"
    "integerToByteString-cpu-arguments-c0"
    "integerToByteString-cpu-arguments-c1"
    "integerToByteString-cpu-arguments-c2"
    "integerToByteString-memory-arguments-intercept"
    "integerToByteString-memory-arguments-slope"
Add the following fields to the PV3 cost model:
    "divideInteger-cpu-arguments-model-arguments-minimum"
    "divideInteger-cpu-arguments-model-arguments-c20"
    "divideInteger-cpu-arguments-model-arguments-c11"
    "divideInteger-cpu-arguments-model-arguments-c10"
    "divideInteger-cpu-arguments-model-arguments-c02"
    "divideInteger-cpu-arguments-model-arguments-c01"
    "divideInteger-cpu-arguments-model-arguments-c00"
    "modInteger-cpu-arguments-model-arguments-minimum"
    "modInteger-cpu-arguments-model-arguments-c20"
    "modInteger-cpu-arguments-model-arguments-c11"
    "modInteger-cpu-arguments-model-arguments-c10"
    "modInteger-cpu-arguments-model-arguments-c02"
    "modInteger-cpu-arguments-model-arguments-c01"
    "modInteger-cpu-arguments-model-arguments-c00"
    "quotientInteger-cpu-arguments-model-arguments-minimum"
    "quotientInteger-cpu-arguments-model-arguments-c20"
    "quotientInteger-cpu-arguments-model-arguments-c11"
    "quotientInteger-cpu-arguments-model-arguments-c10"
    "quotientInteger-cpu-arguments-model-arguments-c02"
    "quotientInteger-cpu-arguments-model-arguments-c01"
    "quotientInteger-cpu-arguments-model-arguments-c00"
    "remainderInteger-cpu-arguments-model-arguments-c20"
    "remainderInteger-cpu-arguments-model-arguments-c11"
    "remainderInteger-cpu-arguments-model-arguments-c10"
    "remainderInteger-cpu-arguments-model-arguments-c02"
    "remainderInteger-cpu-arguments-model-arguments-c01"
    "remainderInteger-cpu-arguments-model-arguments-c00"
    "remainderInteger-cpu-arguments-model-arguments-minimum"

Modify `governanceActionId` to use Word16 instead of Word32
  • Loading branch information
Jimbo4350 committed Jun 17, 2024
1 parent a4d60bf commit 090a3f8
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data GovernanceActionUpdateCommitteeCmdArgs era
, oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey]
, newCommitteeVkeySource :: ![(VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey, EpochNo)]
, requiredThreshold :: !Rational
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, mPrevGovernanceActionId :: !(Maybe (TxId, Word16))
, outFile :: !(File () Out)
} deriving Show

Expand All @@ -64,7 +64,7 @@ data GovernanceActionCreateConstitutionCmdArgs era
, networkId :: !L.Network
, deposit :: !L.Coin
, stakeCredential :: !StakeIdentifier
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, mPrevGovernanceActionId :: !(Maybe (TxId, Word16))
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, constitutionUrl :: !ConstitutionUrl
Expand Down Expand Up @@ -93,7 +93,7 @@ data GovernanceActionCreateNoConfidenceCmdArgs era
, returnStakeAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, mPrevGovernanceActionId :: !(Maybe (TxId, Word16))
, outFile :: !(File () Out)
} deriving Show

Expand Down Expand Up @@ -133,7 +133,7 @@ data GovernanceActionHardforkInitCmdArgs era
, networkId :: !L.Network
, deposit :: !L.Coin
, returnStakeAddress :: !StakeIdentifier
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, mPrevGovernanceActionId :: !(Maybe (TxId, Word16))
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, protVer :: !L.ProtVer
Expand All @@ -156,7 +156,7 @@ data UpdateProtocolParametersConwayOnwards era
, returnAddr :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, governanceActionId :: !(Maybe (TxId, Word32))
, governanceActionId :: !(Maybe (TxId, Word16))
, constitutionScriptHash :: !(Maybe ScriptHash)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data GovernanceVoteCreateCmdArgs era
= GovernanceVoteCreateCmdArgs
{ eon :: ConwayEraOnwards era
, voteChoice :: Vote
, governanceAction :: (TxId, Word32)
, governanceAction :: (TxId, Word16)
, votingStakeCredentialSource :: AnyVotingStakeVerificationKeyOrHashOrFile
, mAnchor :: Maybe (VoteUrl, L.SafeHash L.StandardCrypto L.AnchorData)
, outFile :: VoteFile Out
Expand Down
14 changes: 7 additions & 7 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3284,21 +3284,21 @@ pAnchorDataHash =
, Opt.help "Proposal anchor data hash (obtain it with \"cardano-cli conway governance hash anchor-data ...\")"
]

pPreviousGovernanceAction :: Parser (Maybe (TxId, Word32))
pPreviousGovernanceAction :: Parser (Maybe (TxId, Word16))
pPreviousGovernanceAction = optional $
(,) <$> pTxId "prev-governance-action-tx-id" "Txid of the previous governance action."
<*> pWord32 "prev-governance-action-index" "Action index of the previous governance action."
<*> pWord16 "prev-governance-action-index" "Action index of the previous governance action."

pGovernanceActionId :: Parser (TxId, Word32)
pGovernanceActionId :: Parser (TxId, Word16)
pGovernanceActionId =
(,) <$> pTxId "governance-action-tx-id" "Txid of the governance action."
<*> pWord32 "governance-action-index" "Tx's governance action index."
<*> pWord16 "governance-action-index" "Tx's governance action index."

pWord32 :: String -> String -> Parser Word32
pWord32 l h =
pWord16 :: String -> String -> Parser Word16
pWord16 l h =
Opt.option auto $ mconcat
[ Opt.long l
, Opt.metavar "WORD32"
, Opt.metavar "WORD16"
, Opt.help h
]

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ instance Error CostModelsError where
CostModelsErrorReadFile e ->
"Cannot read cost model: " <> prettyError e
CostModelsErrorJSONDecode fp err ->
"Error decoding JSON cost model at " <> pshow fp <> ": " <> pshow err <> formatExplanation
"Error decoding JSON cost model at " <> pshow fp <> ": " <> pretty err <> formatExplanation
CostModelsErrorEmpty fp ->
"The decoded cost model was empty at: " <> pshow fp <> formatExplanation
where
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error decoding JSON cost model at "some/file.txt": "some error"
Error decoding JSON cost model at "some/file.txt": some error
The expected format of the cost models file is
{
"PlutusV1" : <costModel>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "Governance proposal",
"description": "Update protocol parameters proposal",
"cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745"
"cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30a01010101010101010101ff029f0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745"
}
12 changes: 6 additions & 6 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -6702,7 +6702,7 @@ Usage: cardano-cli conway governance action create-constitution
| --deposit-return-stake-address ADDRESS
)
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--anchor-url TEXT
--anchor-data-hash HASH
--constitution-url TEXT
Expand Down Expand Up @@ -6739,7 +6739,7 @@ Usage: cardano-cli conway governance action update-committee
--epoch NATURAL]
--threshold RATIONAL
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--out-file FILE

Create or update a new committee proposal.
Expand Down Expand Up @@ -6772,7 +6772,7 @@ Usage: cardano-cli conway governance action create-no-confidence
--anchor-url TEXT
--anchor-data-hash HASH
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--out-file FILE

Create a no confidence proposal.
Expand All @@ -6791,7 +6791,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update
--anchor-url TEXT
--anchor-data-hash HASH
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
[--constitution-script-hash HASH]
[--min-fee-linear LOVELACE]
[--min-fee-constant LOVELACE]
Expand Down Expand Up @@ -6877,7 +6877,7 @@ Usage: cardano-cli conway governance action create-hardfork
| --deposit-return-stake-address ADDRESS
)
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--anchor-url TEXT
--anchor-data-hash HASH
--protocol-major-version MAJOR
Expand Down Expand Up @@ -7042,7 +7042,7 @@ Usage: cardano-cli conway governance vote (create | view)

Usage: cardano-cli conway governance vote create (--yes | --no | --abstain)
--governance-action-tx-id TXID
--governance-action-index WORD32
--governance-action-index WORD16
( --drep-verification-key STRING
| --drep-verification-key-file FILE
| --drep-key-hash HASH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage: cardano-cli conway governance action create-constitution
| --deposit-return-stake-address ADDRESS
)
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--anchor-url TEXT
--anchor-data-hash HASH
--constitution-url TEXT
Expand All @@ -37,7 +37,7 @@ Available options:
Target stake address (bech32 format).
--prev-governance-action-tx-id TXID
Txid of the previous governance action.
--prev-governance-action-index WORD32
--prev-governance-action-index WORD16
Action index of the previous governance action.
--anchor-url TEXT Anchor URL
--anchor-data-hash HASH Proposal anchor data hash (obtain it with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage: cardano-cli conway governance action create-hardfork
| --deposit-return-stake-address ADDRESS
)
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--anchor-url TEXT
--anchor-data-hash HASH
--protocol-major-version MAJOR
Expand All @@ -36,7 +36,7 @@ Available options:
Target stake address (bech32 format).
--prev-governance-action-tx-id TXID
Txid of the previous governance action.
--prev-governance-action-index WORD32
--prev-governance-action-index WORD16
Action index of the previous governance action.
--anchor-url TEXT Anchor URL
--anchor-data-hash HASH Proposal anchor data hash (obtain it with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage: cardano-cli conway governance action create-no-confidence
--anchor-url TEXT
--anchor-data-hash HASH
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
--out-file FILE

Create a no confidence proposal.
Expand All @@ -37,7 +37,7 @@ Available options:
"cardano-cli conway governance hash anchor-data ...")
--prev-governance-action-tx-id TXID
Txid of the previous governance action.
--prev-governance-action-index WORD32
--prev-governance-action-index WORD16
Action index of the previous governance action.
--out-file FILE Output filepath of the no confidence proposal.
-h,--help Show this help text
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update
--anchor-url TEXT
--anchor-data-hash HASH
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--prev-governance-action-index WORD16]
[--constitution-script-hash HASH]
[--min-fee-linear LOVELACE]
[--min-fee-constant LOVELACE]
Expand Down Expand Up @@ -82,7 +82,7 @@ Available options:
"cardano-cli conway governance hash anchor-data ...")
--prev-governance-action-tx-id TXID
Txid of the previous governance action.
--prev-governance-action-index WORD32
--prev-governance-action-index WORD16
Action index of the previous governance action.
--constitution-script-hash HASH
Constitution script hash (hex-encoded). Obtain it
Expand Down
Loading

0 comments on commit 090a3f8

Please sign in to comment.