Add support for protocol parameters (except cost models)
We can now simulate transactions with protocol parameters voting procedures. Cost models remain to be done, though.
This commit is contained in:
@@ -132,36 +132,36 @@ for convenience.
|
||||
- [ ] SPO
|
||||
|
||||
- ChangedParameters
|
||||
- [ ] 0: coin
|
||||
- [ ] 1 : coin
|
||||
- [ ] 2 : uint .size 4
|
||||
- [ ] 3 : uint .size 4
|
||||
- [ ] 4 : uint .size 2
|
||||
- [ ] 5 : coin
|
||||
- [ ] 6 : coin
|
||||
- [ ] 7 : epoch_interval
|
||||
- [ ] 8 : uint .size 2
|
||||
- [ ] 9 : nonnegative_interval
|
||||
- [ ] 10 : unit_interval
|
||||
- [ ] 11 : unit_interval
|
||||
- [ ] 16 : coin
|
||||
- [ ] 17 : coin
|
||||
- [ ] 18 : costmdls
|
||||
- [ ] 19 : ex_unit_prices
|
||||
- [ ] 20 : ex_units
|
||||
- [ ] 21 : ex_units
|
||||
- [ ] 22 : uint .size 4
|
||||
- [ ] 23 : uint .size 2
|
||||
- [ ] 24 : uint .size 2
|
||||
- [ ] 25 : pool_voting_thresholds
|
||||
- [ ] 26 : drep_voting_thresholds
|
||||
- [ ] 27 : uint .size 2
|
||||
- [ ] 28 : epoch_interval
|
||||
- [ ] 29 : epoch_interval
|
||||
- [ ] 30 : coin
|
||||
- [ ] 31 : coin
|
||||
- [ ] 32 : epoch_interval
|
||||
- [ ] 33 : nonnegative_interval}
|
||||
- [x] txFeePerByte
|
||||
- [x] txFeeFixed
|
||||
- [x] maxBlockBodySize
|
||||
- [x] maxTxSize
|
||||
- [x] maxBlockHeaderSize
|
||||
- [x] stakeAddressDeposit
|
||||
- [x] stakePoolDeposit
|
||||
- [x] poolRetireMaxEpoch
|
||||
- [x] stakePoolTargetNum
|
||||
- [x] poolPledgeInfluence
|
||||
- [x] monetaryExpansion
|
||||
- [x] treasuryCut
|
||||
- [x] minPoolCost
|
||||
- [x] utxoCostPerByte
|
||||
- [ ] costModels
|
||||
- [x] executionUnitPrices
|
||||
- [x] maxTxExecutionUnits
|
||||
- [x] maxBlockExecutionUnits
|
||||
- [x] maxValueSize
|
||||
- [x] collateralPercentage
|
||||
- [x] maxCollateralInputs
|
||||
- [x] poolVotingThresholds
|
||||
- [x] dRepVotingThresholds
|
||||
- [x] committeeMinSize
|
||||
- [x] committeeMaxTermLength
|
||||
- [x] govActionLifetime
|
||||
- [x] govActionDeposit
|
||||
- [x] dRepDeposit
|
||||
- [x] dRepActivity
|
||||
- [x] minFeeRefScriptCostPerByte
|
||||
|
||||
- Constitution
|
||||
- [x] with guardrail script
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
[[requirements]]
|
||||
name = "logicalmechanism/stdlib"
|
||||
version = "plutus-v3"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "logicalmechanism/stdlib"
|
||||
version = "plutus-v3"
|
||||
requirements = []
|
||||
packages = []
|
||||
source = "github"
|
||||
|
||||
[etags]
|
||||
"logicalmechanism/stdlib@plutus-v3" = [{ secs_since_epoch = 1723394635, nanos_since_epoch = 36770000 }, "097396ab7dedd5e38c558f35b2fb34a2d0f058bb0da0635949f5fcbb36f1310e"]
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
name = "script_context/v3"
|
||||
version = "0.0.0"
|
||||
compiler = "v1.0.31-alpha"
|
||||
plutus = "v3"
|
||||
license = "Apache-2.0"
|
||||
description = "Aiken contracts for project 'script_context/v3'"
|
||||
|
||||
[[dependencies]]
|
||||
name = "logicalmechanism/stdlib"
|
||||
version = "plutus-v3"
|
||||
source = "github"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{ 0: h'6000000000000000000000000000000000000000000000000000000000'
|
||||
, 1: 1000000
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,83 @@
|
||||
[
|
||||
{ 0:
|
||||
[ [h'0000000000000000000000000000000000000000000000000000000000000000', 0]
|
||||
]
|
||||
|
||||
, 1:
|
||||
[]
|
||||
|
||||
, 2: 42
|
||||
|
||||
, 20: 258(
|
||||
[
|
||||
[ 2000000
|
||||
, h'F000000000000000000000000000000000000000000000000000000000'
|
||||
, [ 0
|
||||
, null
|
||||
, { 0: 44
|
||||
, 1: 155381
|
||||
, 7: 18
|
||||
, 8: 500
|
||||
, 9: 30([3, 10])
|
||||
, 10: 30([3, 1000])
|
||||
, 11: 30([2, 10])
|
||||
, 2: 90112
|
||||
, 3: 16384
|
||||
, 4: 1100
|
||||
, 5: 2000000
|
||||
, 6: 500000000
|
||||
, 16: 340
|
||||
, 17: 4310
|
||||
, 19: [30([577, 1000]), 30([721, 1000000])]
|
||||
, 20: [14000000, 10000000000]
|
||||
, 21: [62000000, 20000000000]
|
||||
, 22: 5000
|
||||
, 23: 150
|
||||
, 24: 3
|
||||
, 25:
|
||||
[ 30([51, 100])
|
||||
, 30([52, 100])
|
||||
, 30([53, 100])
|
||||
, 30([54, 100])
|
||||
, 30([55, 100])
|
||||
]
|
||||
, 26:
|
||||
[ 30([67, 100])
|
||||
, 30([67, 100])
|
||||
, 30([60, 100])
|
||||
, 30([75, 100])
|
||||
, 30([60, 100])
|
||||
, 30([67, 100])
|
||||
, 30([67, 100])
|
||||
, 30([67, 100])
|
||||
, 30([75, 100])
|
||||
, 30([67, 100])
|
||||
]
|
||||
, 27: 7
|
||||
, 28: 146
|
||||
, 29: 6
|
||||
, 30: 100000000000
|
||||
, 31: 500000000
|
||||
, 32: 20
|
||||
, 33: 30([15, 1])
|
||||
}
|
||||
, h'{{ proposing_pparams.guardrails.hash }}'
|
||||
]
|
||||
, [ "https://aiken-lang.org"
|
||||
, h'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
},
|
||||
|
||||
{ 5: [[5, 0, 121([]), [1000000, 100000000]]]
|
||||
|
||||
, 7: [h'{{ proposing_pparams.guardrails.cbor }}']
|
||||
},
|
||||
|
||||
true,
|
||||
|
||||
null
|
||||
]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../../../stdlib/lib
|
||||
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@ use aiken/math/rational
|
||||
use cardano/credential.{Script, VerificationKey}
|
||||
use cardano/governance.{
|
||||
Constitution, ConstitutionalCommittee, GovernanceAction, GovernanceActionId,
|
||||
HardForkInitiation, NewConstitution, NicePoll, NoConfidence, ProposalProcedure,
|
||||
HardFork, NewConstitution, NicePoll, NoConfidence, ProposalProcedure,
|
||||
ProtocolVersion, TreasuryWithdrawal,
|
||||
}
|
||||
use cardano/transaction.{Propose, Redeemer, ScriptContext, ScriptPurpose}
|
||||
@@ -23,10 +23,7 @@ validator {
|
||||
list.at(procedures, 0),
|
||||
fn(action) {
|
||||
expect
|
||||
HardForkInitiation {
|
||||
ancestor: None,
|
||||
new_version: ProtocolVersion(10, 0),
|
||||
} == action
|
||||
HardFork { ancestor: None, new_version: ProtocolVersion(10, 0) } == action
|
||||
Void
|
||||
},
|
||||
)
|
||||
@@ -35,7 +32,7 @@ validator {
|
||||
list.at(procedures, 1),
|
||||
fn(action) {
|
||||
expect
|
||||
HardForkInitiation {
|
||||
HardFork {
|
||||
ancestor: Some(GovernanceActionId(null32, 0)),
|
||||
new_version: ProtocolVersion(11, 0),
|
||||
} == action
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
use aiken/math/rational.{Rational}
|
||||
use cardano/governance.{ProposalProcedure, ProtocolParameters}
|
||||
use cardano/governance/protocol_parameters.{
|
||||
ConstitutionalCommitteeThresholds, DelegateRepresentativeVotingThresholds,
|
||||
ExecutionUnits, ProtocolParametersThresholds, ScriptExecutionPrices,
|
||||
StakePoolOperatorVotingThresholds, collateral_percentage, cost_models,
|
||||
delegate_representative_deposit, delegate_representative_max_idle_time,
|
||||
delegate_representative_voting_thresholds, desired_number_of_stake_pools,
|
||||
governance_proposal_deposit, governance_proposal_lifetime, max_block_body_size,
|
||||
max_block_execution_units, max_block_header_size, max_collateral_inputs,
|
||||
max_constitutional_committee_mandate, max_transaction_execution_units,
|
||||
max_transaction_size, max_value_size, min_constitutional_committee_size,
|
||||
min_fee_coefficient, min_fee_constant, min_stake_pool_cost,
|
||||
min_utxo_deposit_coefficient, monetary_expansion,
|
||||
reference_scripts_tier_fee_initial_factor, script_execution_prices,
|
||||
stake_credential_deposit, stake_pool_deposit,
|
||||
stake_pool_operator_voting_thresholds, stake_pool_pledge_influence,
|
||||
stake_pool_retirement_horizon, treasury_expansion,
|
||||
}
|
||||
use cardano/transaction.{Proposing, ScriptContext}
|
||||
|
||||
validator {
|
||||
fn guardrails(_tmp1: Void, ctx: ScriptContext) -> Bool {
|
||||
expect Proposing(
|
||||
0,
|
||||
ProposalProcedure {
|
||||
governance_action: ProtocolParameters {
|
||||
ancestor: None,
|
||||
guardrails: Some(..),
|
||||
new_parameters,
|
||||
},
|
||||
..
|
||||
},
|
||||
) = ctx.info
|
||||
|
||||
expect ( new_parameters |> min_fee_coefficient ) == Some(44)
|
||||
|
||||
expect ( new_parameters |> min_fee_constant ) == Some(155_381)
|
||||
|
||||
expect ( new_parameters |> max_block_body_size ) == Some(90_112)
|
||||
|
||||
expect ( new_parameters |> max_transaction_size ) == Some(16_384)
|
||||
|
||||
expect ( new_parameters |> max_block_header_size ) == Some(1_100)
|
||||
|
||||
expect ( new_parameters |> stake_credential_deposit ) == Some(2_000_000)
|
||||
|
||||
expect ( new_parameters |> stake_pool_deposit ) == Some(500_000_000)
|
||||
|
||||
expect ( new_parameters |> stake_pool_retirement_horizon ) == Some(18)
|
||||
|
||||
expect ( new_parameters |> desired_number_of_stake_pools ) == Some(500)
|
||||
|
||||
expect
|
||||
( new_parameters |> stake_pool_pledge_influence ) == Some(
|
||||
expect_rational(3, 10),
|
||||
)
|
||||
|
||||
expect
|
||||
( new_parameters |> monetary_expansion ) == Some(
|
||||
expect_rational(3, 1_000),
|
||||
)
|
||||
|
||||
expect
|
||||
( new_parameters |> treasury_expansion ) == Some(expect_rational(1, 5))
|
||||
|
||||
expect ( new_parameters |> min_stake_pool_cost ) == Some(340)
|
||||
|
||||
expect ( new_parameters |> min_utxo_deposit_coefficient ) == Some(4310)
|
||||
|
||||
expect ( new_parameters |> cost_models ) == None
|
||||
|
||||
expect
|
||||
( new_parameters |> script_execution_prices ) == Some(
|
||||
ScriptExecutionPrices {
|
||||
memory: expect_rational(577, 1_000),
|
||||
cpu: expect_rational(721, 1_000_000),
|
||||
},
|
||||
)
|
||||
|
||||
expect
|
||||
( new_parameters |> max_transaction_execution_units ) == Some(
|
||||
ExecutionUnits { memory: 14000000, cpu: 10000000000 },
|
||||
)
|
||||
|
||||
expect
|
||||
( new_parameters |> max_block_execution_units ) == Some(
|
||||
ExecutionUnits { memory: 62000000, cpu: 20000000000 },
|
||||
)
|
||||
|
||||
expect ( new_parameters |> max_value_size ) == Some(5000)
|
||||
|
||||
expect ( new_parameters |> collateral_percentage ) == Some(150)
|
||||
|
||||
expect ( new_parameters |> max_collateral_inputs ) == Some(3)
|
||||
|
||||
expect
|
||||
( new_parameters |> stake_pool_operator_voting_thresholds ) == Some(
|
||||
spo_thresholds(),
|
||||
)
|
||||
|
||||
expect
|
||||
( new_parameters |> delegate_representative_voting_thresholds ) == Some(
|
||||
drep_thresholds(),
|
||||
)
|
||||
|
||||
expect ( new_parameters |> min_constitutional_committee_size ) == Some(7)
|
||||
|
||||
expect
|
||||
( new_parameters |> max_constitutional_committee_mandate ) == Some(146)
|
||||
|
||||
expect ( new_parameters |> governance_proposal_lifetime ) == Some(6)
|
||||
|
||||
expect
|
||||
( new_parameters |> governance_proposal_deposit ) == Some(100_000_000_000)
|
||||
|
||||
expect
|
||||
( new_parameters |> delegate_representative_deposit ) == Some(500_000_000)
|
||||
|
||||
expect
|
||||
( new_parameters |> delegate_representative_max_idle_time ) == Some(20)
|
||||
|
||||
expect
|
||||
( new_parameters |> reference_scripts_tier_fee_initial_factor ) == Some(
|
||||
expect_rational(15, 1),
|
||||
)
|
||||
|
||||
True
|
||||
}
|
||||
}
|
||||
|
||||
fn expect_rational(numerator: Int, denominator: Int) -> Rational {
|
||||
expect Some(r) = rational.new(numerator, denominator)
|
||||
r
|
||||
}
|
||||
|
||||
fn spo_thresholds() -> StakePoolOperatorVotingThresholds {
|
||||
StakePoolOperatorVotingThresholds {
|
||||
motion_of_no_confidence: expect_rational(51, 100),
|
||||
constitutional_committee: ConstitutionalCommitteeThresholds {
|
||||
default: expect_rational(13, 25),
|
||||
under_no_confidence: expect_rational(53, 100),
|
||||
},
|
||||
hard_fork: expect_rational(27, 50),
|
||||
protocol_parameters: ProtocolParametersThresholds {
|
||||
security_group: expect_rational(11, 20),
|
||||
network_group: Void,
|
||||
economic_group: Void,
|
||||
technical_group: Void,
|
||||
governance_group: Void,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn drep_thresholds() -> DelegateRepresentativeVotingThresholds {
|
||||
DelegateRepresentativeVotingThresholds {
|
||||
motion_of_no_confidence: expect_rational(67, 100),
|
||||
constitutional_committee: ConstitutionalCommitteeThresholds {
|
||||
default: expect_rational(67, 100),
|
||||
under_no_confidence: expect_rational(3, 5),
|
||||
},
|
||||
constitution: expect_rational(3, 4),
|
||||
hard_fork: expect_rational(3, 5),
|
||||
protocol_parameters: ProtocolParametersThresholds {
|
||||
security_group: Void,
|
||||
network_group: expect_rational(67, 100),
|
||||
economic_group: expect_rational(67, 100),
|
||||
technical_group: expect_rational(67, 100),
|
||||
governance_group: expect_rational(3, 4),
|
||||
},
|
||||
treasury_withdrawal: expect_rational(67, 100),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user