Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ math: true

- `evaluateTransaction` now uses the outputs given in `additionalUtxo` over the outputs that transactions in the mempool create, when both have the same output reference. Before, the mempool outputs won.

- `queryNetwork/genesisConfiguration` for the Conway era now returns `plutusCostModels` (the Plutus V3 cost model) and `minFeeReferenceScripts` in `updatableParameters`. Before, both were missing.

### [6.14.0] - 2025-10-16

#### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ describe('Local state queries', () => {
it('fetches the config used to bootstrap the Conway era', async () => {
const config = await LedgerStateQuery.genesisConfiguration(context, 'conway')
expect((config as GenesisConway).constitution).toBeDefined()
expect(config.updatableParameters.plutusCostModels['plutus:v3'])
.toEqual([ 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32, 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 955506, 213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10, 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1, 52538055, 3756, 18, 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36, 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318, 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1])
})
})
describe('ledgerTip', () => {
Expand Down
25 changes: 14 additions & 11 deletions clients/TypeScript/packages/schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3022,17 +3022,7 @@ export interface QueryLedgerStateProtocolParametersResponse {
export interface ProtocolParameters {
minFeeCoefficient: UInt64;
minFeeConstant: ValueAdaOnly;
minFeeReferenceScripts?: {
range: UInt32;
/**
* The base cost for the tier-price calculation.
*/
base: number;
/**
* The multiplier increasing the cost of each tier.
*/
multiplier: number;
};
minFeeReferenceScripts?: MinFeeReferenceScripts;
minUtxoDepositCoefficient: UInt64;
minUtxoDepositConstant: ValueAdaOnly;
maxBlockBodySize: {
Expand Down Expand Up @@ -3082,6 +3072,17 @@ export interface ProtocolParameters {
delegateRepresentativeMaxIdleTime?: Epoch;
version: ProtocolVersion;
}
export interface MinFeeReferenceScripts {
range: UInt32;
/**
* The base cost for the tier-price calculation.
*/
base: number;
/**
* The multiplier increasing the cost of each tier.
*/
multiplier: number;
}
/**
* Query current delegation settings and rewards of some given reward accounts.
*/
Expand Down Expand Up @@ -3426,6 +3427,8 @@ export interface GenesisConway {
delegateRepresentativeVotingThresholds: DelegateRepresentativeVotingThresholds;
delegateRepresentativeDeposit: ValueAdaOnly;
delegateRepresentativeMaxIdleTime: Epoch;
plutusCostModels: CostModels;
minFeeReferenceScripts: MinFeeReferenceScripts;
};
}
/**
Expand Down
43 changes: 25 additions & 18 deletions docs/static/cardano.json
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,8 @@
, "delegateRepresentativeVotingThresholds"
, "delegateRepresentativeDeposit"
, "delegateRepresentativeMaxIdleTime"
, "plutusCostModels"
, "minFeeReferenceScripts"
]
, "properties":
{ "stakePoolVotingThresholds": { "$ref": "cardano.json#/definitions/StakePoolVotingThresholds" }
Expand All @@ -1374,6 +1376,8 @@
, "delegateRepresentativeVotingThresholds": { "$ref": "cardano.json#/definitions/DelegateRepresentativeVotingThresholds" }
, "delegateRepresentativeDeposit": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
, "delegateRepresentativeMaxIdleTime": { "$ref": "cardano.json#/definitions/Epoch" }
, "plutusCostModels": { "$ref": "cardano.json#/definitions/CostModels" }
, "minFeeReferenceScripts": { "$ref": "cardano.json#/definitions/MinFeeReferenceScripts" }
}
}
}
Expand Down Expand Up @@ -1985,6 +1989,26 @@
}
}

, "MinFeeReferenceScripts":
{ "title": "MinFeeReferenceScripts"
, "type": "object"
, "additionalProperties": false
, "required": [ "range", "base", "multiplier" ]
, "properties":
{ "range":
{ "$ref": "cardano.json#/definitions/UInt32"
}
, "base":
{ "type": "number"
, "description": "The base cost for the tier-price calculation."
}
, "multiplier":
{ "type": "number"
, "description": "The multiplier increasing the cost of each tier."
}
}
}

, "Network":
{ "title": "Network"
, "type": "string"
Expand Down Expand Up @@ -2284,24 +2308,7 @@
, "properties":
{ "minFeeCoefficient": { "$ref": "cardano.json#/definitions/UInt64" }
, "minFeeConstant": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
, "minFeeReferenceScripts":
{ "type": "object"
, "additionalProperties": false
, "required": [ "range", "base", "multiplier" ]
, "properties":
{ "range":
{ "$ref": "cardano.json#/definitions/UInt32"
}
, "base":
{ "type": "number"
, "description": "The base cost for the tier-price calculation."
}
, "multiplier":
{ "type": "number"
, "description": "The multiplier increasing the cost of each tier."
}
}
}
, "minFeeReferenceScripts": { "$ref": "cardano.json#/definitions/MinFeeReferenceScripts" }
, "minUtxoDepositCoefficient": { "$ref": "cardano.json#/definitions/UInt64" }
, "minUtxoDepositConstant": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
, "maxBlockBodySize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
Expand Down
64 changes: 35 additions & 29 deletions server/src/Ogmios/Data/Json/Conway.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Ogmios.Data.Json.Prelude
import Cardano.Ledger.Api
( AsItem (..)
, AsIx (..)
, Language (..)
, PlutusPurpose
)
import Cardano.Ledger.BaseTypes
Expand Down Expand Up @@ -74,6 +75,7 @@ import qualified Cardano.Ledger.Conway.Scripts as Cn
import qualified Cardano.Ledger.Conway.TxInfo as Cn
import Cardano.Ledger.Plutus
( TxOutSource (..)
, mkCostModels
)
import qualified Data.Aeson as Json

Expand Down Expand Up @@ -410,23 +412,28 @@ encodeGenesis x =
<> "constitutionalCommittee" .= encodeCommittee (Cn.cgCommittee x)
<> "updatableParameters" .= encodeObject
( "stakePoolVotingThresholds" .=
encodePoolVotingThresholds (Cn.ucppPoolVotingThresholds (Cn.cgUpgradePParams x))
encodePoolVotingThresholds (Cn.ucppPoolVotingThresholds pparams)
<> "delegateRepresentativeVotingThresholds" .=
encodeDRepVotingThresholds (Cn.ucppDRepVotingThresholds (Cn.cgUpgradePParams x))
encodeDRepVotingThresholds (Cn.ucppDRepVotingThresholds pparams)
<> "constitutionalCommitteeMinSize" .=
encodeWord16 (Cn.ucppCommitteeMinSize (Cn.cgUpgradePParams x))
encodeWord16 (Cn.ucppCommitteeMinSize pparams)
<> "constitutionalCommitteeMaxTermLength" .=
encodeEpochInterval (Cn.ucppCommitteeMaxTermLength (Cn.cgUpgradePParams x))
encodeEpochInterval (Cn.ucppCommitteeMaxTermLength pparams)
<> "governanceActionLifetime" .=
encodeEpochInterval (Cn.ucppGovActionLifetime (Cn.cgUpgradePParams x))
encodeEpochInterval (Cn.ucppGovActionLifetime pparams)
<> "governanceActionDeposit" .=
encodeCoin (Cn.ucppGovActionDeposit (Cn.cgUpgradePParams x))
encodeCoin (Cn.ucppGovActionDeposit pparams)
<> "delegateRepresentativeDeposit" .=
encodeCoin (Cn.ucppDRepDeposit (Cn.cgUpgradePParams x))
encodeCoin (Cn.ucppDRepDeposit pparams)
<> "delegateRepresentativeMaxIdleTime" .=
encodeEpochInterval (Cn.ucppDRepActivity (Cn.cgUpgradePParams x))
encodeEpochInterval (Cn.ucppDRepActivity pparams)
<> "plutusCostModels" .=
Alonzo.encodeCostModels (mkCostModels $ Map.singleton PlutusV3 (Cn.ucppPlutusV3CostModel pparams))
<> "minFeeReferenceScripts" .= encodeMinFeeReferenceScripts (Cn.ucppMinFeeRefScriptCostPerByte pparams)
)
)
where
pparams = Cn.cgUpgradePParams x

encodeGovAction
:: Cn.GovAction ConwayEra
Expand Down Expand Up @@ -527,6 +534,25 @@ encodeGovActionPurpose = \case
Cn.ConstitutionPurpose ->
encodeText "constitution"

encodeMinFeeReferenceScripts
:: NonNegativeInterval
-> Json
encodeMinFeeReferenceScripts base = encodeObject $
-- NOTE: This will very likely always be an integer. The ledger
-- represent this as a 'NonNegativeInterval', which technically
-- allow any _Rational_ value between 0 and +INFINITY, but it is
-- highly impractical to manipulate a Rationale here from an API
-- standpoint.
--
-- So this is a debatable choice, but I believe it's better for
-- users to convert to a Double so that it is directly a number in
-- JSON, and we can still accomodate decimal representation so long
-- as they don't get _too precise_ (which should be a fair
-- assumption in this context).
"base" .= encodeDouble (fromRational (unboundRational base)) <>
"range" .= encodeWord32 25600 <>
"multiplier" .= encodeDouble 1.2

encodePParams
:: (Ledger.PParamsHKD Identity era ~ Cn.ConwayPParams Identity era)
=> Ledger.PParams era
Expand Down Expand Up @@ -568,27 +594,7 @@ encodePParamsHKD encode pure_ x =
encode "minFeeConstant"
(encodeCoin . fromCompact) (unTHKD (Cn.cppTxFeeFixed x)) <>
encode "minFeeReferenceScripts"
(\(base :: NonNegativeInterval) -> encodeObject
-- NOTE: This will very likely always be an integer. The ledger
-- represent this as a 'NonNegativeInterval', which technically
-- allow any _Rational_ value between 0 and +INFINITY, but it is
-- highly impractical to manipulate a Rationale here from an API
-- standpoint.
--
-- So this is a debatable choice, but I believe it's better for
-- users to convert to a Double so that it is directly a number in
-- JSON, and we can still accomodate decimal representation so long
-- as they don't get _too precise_ (which should be a fair
-- assumption in this context).
( "base" .= encodeDouble (fromRational (unboundRational base))
<>
"range" .= encodeWord32 25600
<>
"multiplier" .= encodeDouble 1.2
)
)
(unTHKD (Cn.cppMinFeeRefScriptCostPerByte x))
<>
encodeMinFeeReferenceScripts (unTHKD (Cn.cppMinFeeRefScriptCostPerByte x)) <>
encode "maxBlockBodySize"
(encodeSingleton "bytes" . encodeWord32) (unTHKD (Cn.cppMaxBBSize x)) <>
encode "maxBlockHeaderSize"
Expand Down
7 changes: 7 additions & 0 deletions server/test/unit/Ogmios/Data/JsonSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,13 @@ spec = do
(Just [aesonQQ|{ "era": "alonzo" }|])
(parseQueryNetworkGenesisConfiguration genGenesisConfig)

validateNetworkQueryTagged
10
"genesisConfiguration"
(Just "Conway")
(Just [aesonQQ|{ "era": "conway" }|])
(parseQueryNetworkGenesisConfiguration genGenesisConfig)

validateNetworkQuery
5
"startTime"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading