Skip to content
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ math: true

- Bump dependencies to the latest cardano-ledger, ouroboros-consensus and ouroboros-network releases.

- **⚠️ BREAKING-CHANGE ⚠️**: In the Dijkstra era, the `minFeeReferenceScripts` of a governance proposal only has the parts that the proposal changes: `base`, `range` or `multiplier`. The JSON schema of `ProposedProtocolParameters` no longer requires all three parts in any era, so in the TypeScript client they are now optional for Conway proposals too.

#### Fixed

- A failure while encoding the response of `submitTransaction` or `nextTransaction` now returns a JSON-RPC internal error to the client. Before, the websocket connection was closed with no reply.
Expand Down Expand Up @@ -74,6 +76,12 @@ math: true

- `queryLedgerState/rewardAccountSummaries` now returns registered reward accounts that are not delegated to a stake pool, without a `stakePool` field. Before, it left them out.

- `queryLedgerState/protocolParameters` now returns the protocol parameters in the Dijkstra era. Before, it failed there with error `2002` (query unavailable in the current era). In the Dijkstra era, the result has `maxReferenceScriptsSizePerBlock` and `maxReferenceScriptsSizePerTransaction` instead of `maxReferenceScriptsSize`. In the Dijkstra era, `minFeeReferenceScripts.range` and `minFeeReferenceScripts.multiplier` are protocol parameters, so they can change. Before Dijkstra, they are always 25600 and 1.2. The result also has the new protocol parameters of the Dijkstra era, which governance proposals can change too:
- `maxStakePoolPledgeLeverage` (`null` when there is no limit) and `minStakePoolMargin`.
- `referenceInputsCostPerMultiAssetPolicy` and `referenceInputsCostPerDatumByte`, the costs of reference inputs.
- Leios: `leiosAnnouncementPeriodLength`, `leiosVotePeriodLength`, `leiosDiffusionPeriodLength`, `leiosCommitteeSize`, `leiosQuorumStakeThreshold`, `maxEndorserBlockReferencesSize`, `maxEndorserBlockTransactionsSize`, `maxExecutionUnitsPerEndorserBlock` and `maxReferenceScriptsSizePerEndorserBlock`.
- Peras: `perasMinCandidateBlockAge` (in slots), `perasHealingFactor`, `perasCertificateBoost`, `perasTargetCommitteeSize`, `perasBootstrapRound` (`null` when not set) and `perasQuorumThresholdSafetyMargin`.

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

#### Added
Expand Down
127 changes: 125 additions & 2 deletions clients/TypeScript/packages/client/test/DijkstraDevnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { dummyInteractionContext } from './helpers'
import { createChainSynchronizationClient } from '../src/ChainSynchronization'
import { networkTip } from '../src/LedgerStateQuery'
import { networkTip, protocolParameters } from '../src/LedgerStateQuery'
import { createMempoolMonitoringClient, MempoolMonitoringClient } from '../src/MempoolMonitoring'
import { submitTransaction } from '../src/TransactionSubmission'
import { Transaction } from '@cardano-ogmios/schema'
import { ProtocolParameters, Transaction } from '@cardano-ogmios/schema'
import { execFileSync } from 'child_process'
import { readFileSync } from 'fs'
import { inspect } from 'util'

// Set by scripts/dijkstra-devnet-test.sh. Without DIJKSTRA_TX_ID, these tests are skipped.
const transactionCbor = process.env.DIJKSTRA_TX_CBOR
const transactionId = process.env.DIJKSTRA_TX_ID
const subTransactionId = process.env.DIJKSTRA_SUB_TX_ID
const producerPid = process.env.DIJKSTRA_PRODUCER_PID
const protocolParametersFile = process.env.DIJKSTRA_PROTOCOL_PARAMETERS

// Pause a process with SIGSTOP, and wait until it is stopped.
const pause = async (pid: number) => {
Expand All @@ -21,6 +23,101 @@ const pause = async (pid: number) => {
}
}

// Each protocol parameter of cardano-cli, and where Ogmios puts it.
const fromOgmios: { [cliName: string]: (p: ProtocolParameters) => unknown } = {
txFeePerByte: p => p.minFeeCoefficient,
txFeeFixed: p => p.minFeeConstant.ada.lovelace,
minFeeRefScriptCostPerByte: p => p.minFeeReferenceScripts.base,
refScriptCostStride: p => p.minFeeReferenceScripts.range,
refScriptCostMultiplier: p => p.minFeeReferenceScripts.multiplier,
maxBlockBodySize: p => p.maxBlockBodySize.bytes,
maxBlockHeaderSize: p => p.maxBlockHeaderSize.bytes,
maxTxSize: p => p.maxTransactionSize.bytes,
stakeAddressDeposit: p => p.stakeCredentialDeposit.ada.lovelace,
stakePoolDeposit: p => p.stakePoolDeposit.ada.lovelace,
poolRetireMaxEpoch: p => p.stakePoolRetirementEpochBound,
stakePoolTargetNum: p => p.desiredNumberOfStakePools,
poolPledgeInfluence: p => p.stakePoolPledgeInfluence,
monetaryExpansion: p => p.monetaryExpansion,
treasuryCut: p => p.treasuryExpansion,
minPoolCost: p => p.minStakePoolCost.ada.lovelace,
utxoCostPerByte: p => p.minUtxoDepositCoefficient,
costModels: p => Object.fromEntries(
Object.entries(p.plutusCostModels).map(([language, model]) => [language.replace('plutus:v', 'PlutusV'), model])
),
executionUnitPrices: p => ({ priceMemory: p.scriptExecutionPrices.memory, priceSteps: p.scriptExecutionPrices.cpu }),
maxTxExecutionUnits: p => ({ memory: p.maxExecutionUnitsPerTransaction.memory, steps: p.maxExecutionUnitsPerTransaction.cpu }),
maxBlockExecutionUnits: p => ({ memory: p.maxExecutionUnitsPerBlock.memory, steps: p.maxExecutionUnitsPerBlock.cpu }),
maxValueSize: p => p.maxValueSize.bytes,
collateralPercentage: p => p.collateralPercentage,
maxCollateralInputs: p => p.maxCollateralInputs,
protocolVersion: p => p.version,
poolVotingThresholds: p => ({
motionNoConfidence: p.stakePoolVotingThresholds.noConfidence,
committeeNormal: p.stakePoolVotingThresholds.constitutionalCommittee.default,
committeeNoConfidence: p.stakePoolVotingThresholds.constitutionalCommittee.stateOfNoConfidence,
hardForkInitiation: p.stakePoolVotingThresholds.hardForkInitiation,
ppSecurityGroup: p.stakePoolVotingThresholds.protocolParametersUpdate.security
}),
dRepVotingThresholds: p => ({
motionNoConfidence: p.delegateRepresentativeVotingThresholds.noConfidence,
committeeNormal: p.delegateRepresentativeVotingThresholds.constitutionalCommittee.default,
committeeNoConfidence: p.delegateRepresentativeVotingThresholds.constitutionalCommittee.stateOfNoConfidence,
updateToConstitution: p.delegateRepresentativeVotingThresholds.constitution,
hardForkInitiation: p.delegateRepresentativeVotingThresholds.hardForkInitiation,
ppNetworkGroup: p.delegateRepresentativeVotingThresholds.protocolParametersUpdate.network,
ppEconomicGroup: p.delegateRepresentativeVotingThresholds.protocolParametersUpdate.economic,
ppTechnicalGroup: p.delegateRepresentativeVotingThresholds.protocolParametersUpdate.technical,
ppGovGroup: p.delegateRepresentativeVotingThresholds.protocolParametersUpdate.governance,
treasuryWithdrawal: p.delegateRepresentativeVotingThresholds.treasuryWithdrawals
}),
committeeMinSize: p => p.constitutionalCommitteeMinSize,
committeeMaxTermLength: p => p.constitutionalCommitteeMaxTermLength,
govActionLifetime: p => p.governanceActionLifetime,
govActionDeposit: p => p.governanceActionDeposit.ada.lovelace,
dRepDeposit: p => p.delegateRepresentativeDeposit.ada.lovelace,
dRepActivity: p => p.delegateRepresentativeMaxIdleTime,
maxRefScriptSizePerBlock: p => p.maxReferenceScriptsSizePerBlock.bytes,
maxRefScriptSizePerTx: p => p.maxReferenceScriptsSizePerTransaction.bytes,
maxPledgeLeverage: p => p.maxStakePoolPledgeLeverage,
minPoolMargin: p => p.minStakePoolMargin,
leiosAnnouncementPeriodLength: p => p.leiosAnnouncementPeriodLength.milliseconds,
leiosVotePeriodLength: p => p.leiosVotePeriodLength.milliseconds,
leiosDiffusionPeriodLength: p => p.leiosDiffusionPeriodLength.milliseconds,
leiosCommitteeSize: p => p.leiosCommitteeSize,
leiosQuorumStakeThreshold: p => p.leiosQuorumStakeThreshold,
maxEndorserBlockReferencesSize: p => p.maxEndorserBlockReferencesSize.bytes,
maxEndorserBlockTxsSize: p => p.maxEndorserBlockTransactionsSize.bytes,
maxEndorserBlockExecutionUnits: p => ({ memory: p.maxExecutionUnitsPerEndorserBlock.memory, steps: p.maxExecutionUnitsPerEndorserBlock.cpu }),
maxRefScriptSizePerEndorserBlock: p => p.maxReferenceScriptsSizePerEndorserBlock.bytes,
perasMinCandidateBlockAge: p => p.perasMinCandidateBlockAge,
perasHealingFactor: p => p.perasHealingFactor,
perasCertBoost: p => p.perasCertificateBoost,
perasTargetCommitteeSize: p => p.perasTargetCommitteeSize,
perasBootstrapRound: p => p.perasBootstrapRound,
perasQuorumThresholdSafetyMargin: p => p.perasQuorumThresholdSafetyMargin,
refInputsCostPerMultiAssetPolicy: p => p.referenceInputsCostPerMultiAssetPolicy.ada.lovelace,
refInputsCostPerDatumByte: p => p.referenceInputsCostPerDatumByte
}

// cardano-cli writes plain numbers. Ogmios writes ratios such as "3/4", and the client may give big integers.
const asNumbers = (value: unknown): unknown => {
if (typeof value === 'bigint') {
return Number(value)
}
if (typeof value === 'string' && /^-?\d+\/\d+$/.test(value)) {
const [numerator, denominator] = value.split('/')
return Number(numerator) / Number(denominator)
}
if (Array.isArray(value)) {
return value.map(asNumbers)
}
if (value !== null && typeof value === 'object') {
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, asNumbers(item)]))
}
return value
}

const describeOnDevnet = transactionId === undefined ? describe.skip : describe

describeOnDevnet('Dijkstra devnet', () => {
Expand Down Expand Up @@ -120,4 +217,30 @@ describeOnDevnet('Dijkstra devnet', () => {
await client.shutdown()
}
})

it('reads the protocol parameters', async () => {
const context = await dummyInteractionContext()
try {
// Only the Dijkstra era has maxReferenceScriptsSizePerTransaction.
await expect(protocolParameters(context)).resolves.toHaveProperty('maxReferenceScriptsSizePerTransaction')
} finally {
context.socket.close()
}
})

it('reads the same protocol parameters as cardano-cli', async () => {
if (protocolParametersFile === undefined) {
throw new Error('DIJKSTRA_PROTOCOL_PARAMETERS is not set: run this test through scripts/dijkstra-devnet-test.sh')
}
const fromCli = JSON.parse(readFileSync(protocolParametersFile, 'utf8'))
const context = await dummyInteractionContext()
try {
const parameters = await protocolParameters(context)
const read = Object.fromEntries(Object.entries(fromOgmios).map(([name, from]) => [name, from(parameters)]))
// A parameter that cardano-cli has, and that is not in fromOgmios, makes this fail too.
expect(asNumbers(read)).toEqual(asNumbers(fromCli))
} finally {
context.socket.close()
}
})
})
78 changes: 70 additions & 8 deletions clients/TypeScript/packages/schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ export type None = null;
*/
export type Network = "mainnet" | "testnet";
export type UInt32 = number;
export type UInt16 = number;
export type Nonce = Neutral | DigestBlake2B256;
export type Neutral = "neutral";
export type Int64 = number;
export type CostModel = Int64[];
export type UInt16 = number;
export type Metadatum = MetadatumNoSchema | MetadatumDetailedSchema;
export type MetadatumNoSchema = IntegerNoSchema | StringNoSchema | ArrayNoSchema | ObjectNoSchema;
export type IntegerNoSchema = bigint;
Expand Down Expand Up @@ -957,9 +957,9 @@ export interface ProposedProtocolParameters {
minFeeCoefficient?: UInt64;
minFeeConstant?: ValueAdaOnly;
minFeeReferenceScripts?: {
range: UInt32;
base: number;
multiplier: number;
range?: UInt32;
base?: number;
multiplier?: number;
};
minUtxoDepositCoefficient?: UInt64;
minUtxoDepositConstant?: ValueAdaOnly;
Expand All @@ -981,6 +981,37 @@ export interface ProposedProtocolParameters {
maxReferenceScriptsSizePerTransaction?: {
bytes: UInt64;
};
maxStakePoolPledgeLeverage?: Ratio | null;
minStakePoolMargin?: Ratio;
leiosAnnouncementPeriodLength?: {
milliseconds: UInt64;
};
leiosVotePeriodLength?: {
milliseconds: UInt64;
};
leiosDiffusionPeriodLength?: {
milliseconds: UInt64;
};
leiosCommitteeSize?: UInt16;
leiosQuorumStakeThreshold?: Ratio;
maxEndorserBlockReferencesSize?: {
bytes: UInt64;
};
maxEndorserBlockTransactionsSize?: {
bytes: UInt64;
};
maxExecutionUnitsPerEndorserBlock?: ExecutionUnits;
maxReferenceScriptsSizePerEndorserBlock?: {
bytes: UInt64;
};
perasMinCandidateBlockAge?: UInt32;
perasHealingFactor?: Ratio;
perasCertificateBoost?: UInt16;
perasTargetCommitteeSize?: UInt16;
perasBootstrapRound?: UInt32 | null;
perasQuorumThresholdSafetyMargin?: Ratio;
referenceInputsCostPerMultiAssetPolicy?: ValueAdaOnly;
referenceInputsCostPerDatumByte?: UInt64;
maxValueSize?: {
bytes: UInt64;
};
Expand Down Expand Up @@ -1010,17 +1041,17 @@ export interface ProposedProtocolParameters {
delegateRepresentativeMaxIdleTime?: Epoch;
version?: ProtocolVersion;
}
export interface ExecutionUnits {
memory: UInt64;
cpu: UInt64;
}
export interface CostModels {
[k: string]: CostModel;
}
export interface ScriptExecutionPrices {
memory: Ratio;
cpu: Ratio;
}
export interface ExecutionUnits {
memory: UInt64;
cpu: UInt64;
}
export interface StakePoolVotingThresholds {
noConfidence: Ratio;
constitutionalCommittee: {
Expand Down Expand Up @@ -3062,6 +3093,37 @@ export interface ProtocolParameters {
maxReferenceScriptsSizePerTransaction?: {
bytes: UInt64;
};
maxStakePoolPledgeLeverage?: Ratio | null;
minStakePoolMargin?: Ratio;
leiosAnnouncementPeriodLength?: {
milliseconds: UInt64;
};
leiosVotePeriodLength?: {
milliseconds: UInt64;
};
leiosDiffusionPeriodLength?: {
milliseconds: UInt64;
};
leiosCommitteeSize?: UInt16;
leiosQuorumStakeThreshold?: Ratio;
maxEndorserBlockReferencesSize?: {
bytes: UInt64;
};
maxEndorserBlockTransactionsSize?: {
bytes: UInt64;
};
maxExecutionUnitsPerEndorserBlock?: ExecutionUnits;
maxReferenceScriptsSizePerEndorserBlock?: {
bytes: UInt64;
};
perasMinCandidateBlockAge?: UInt32;
perasHealingFactor?: Ratio;
perasCertificateBoost?: UInt16;
perasTargetCommitteeSize?: UInt16;
perasBootstrapRound?: UInt32 | null;
perasQuorumThresholdSafetyMargin?: Ratio;
referenceInputsCostPerMultiAssetPolicy?: ValueAdaOnly;
referenceInputsCostPerDatumByte?: UInt64;
stakePoolVotingThresholds?: StakePoolVotingThresholds;
constitutionalCommitteeMinSize?: UInt16;
constitutionalCommitteeMaxTermLength?: UInt64;
Expand Down
68 changes: 67 additions & 1 deletion docs/static/cardano.json
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,15 @@
}
}

, "NumberOfMilliseconds":
{ "type": "object"
, "additionalProperties": false
, "required": [ "milliseconds" ]
, "properties":
{ "milliseconds": { "$ref": "cardano.json#/definitions/UInt64" }
}
}

, "OperationalCertificate":
{ "title": "OperationalCertificate"
, "type": "object"
Expand Down Expand Up @@ -2240,7 +2249,6 @@
, "minFeeReferenceScripts":
{ "type": "object"
, "additionalProperties": false
, "required": [ "range", "base", "multiplier" ]
, "properties":
{ "range": { "$ref": "cardano.json#/definitions/UInt32" }
, "base": { "type": "number" }
Expand All @@ -2255,6 +2263,35 @@
, "maxReferenceScriptsSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxReferenceScriptsSizePerBlock": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxReferenceScriptsSizePerTransaction": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxStakePoolPledgeLeverage":
{ "oneOf":
[ { "$ref": "cardano.json#/definitions/Ratio" }
, { "type": "null" }
]
}
, "minStakePoolMargin": { "$ref": "cardano.json#/definitions/Ratio" }
, "leiosAnnouncementPeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosVotePeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosDiffusionPeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosCommitteeSize": { "$ref": "cardano.json#/definitions/UInt16" }
, "leiosQuorumStakeThreshold": { "$ref": "cardano.json#/definitions/Ratio" }
, "maxEndorserBlockReferencesSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxEndorserBlockTransactionsSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxExecutionUnitsPerEndorserBlock": { "$ref": "cardano.json#/definitions/ExecutionUnits" }
, "maxReferenceScriptsSizePerEndorserBlock": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "perasMinCandidateBlockAge": { "$ref": "cardano.json#/definitions/UInt32" }
, "perasHealingFactor": { "$ref": "cardano.json#/definitions/Ratio" }
, "perasCertificateBoost": { "$ref": "cardano.json#/definitions/UInt16" }
, "perasTargetCommitteeSize": { "$ref": "cardano.json#/definitions/UInt16" }
, "perasBootstrapRound":
{ "oneOf":
[ { "$ref": "cardano.json#/definitions/UInt32" }
, { "type": "null" }
]
}
, "perasQuorumThresholdSafetyMargin": { "$ref": "cardano.json#/definitions/Ratio" }
, "referenceInputsCostPerMultiAssetPolicy": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
, "referenceInputsCostPerDatumByte": { "$ref": "cardano.json#/definitions/UInt64" }
, "maxValueSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "extraEntropy": { "$ref": "cardano.json#/definitions/Nonce" }
, "stakeCredentialDeposit": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
Expand Down Expand Up @@ -2334,6 +2371,35 @@
, "maxReferenceScriptsSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxReferenceScriptsSizePerBlock": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxReferenceScriptsSizePerTransaction": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxStakePoolPledgeLeverage":
{ "oneOf":
[ { "$ref": "cardano.json#/definitions/Ratio" }
, { "type": "null" }
]
}
, "minStakePoolMargin": { "$ref": "cardano.json#/definitions/Ratio" }
, "leiosAnnouncementPeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosVotePeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosDiffusionPeriodLength": { "$ref": "cardano.json#/definitions/NumberOfMilliseconds" }
, "leiosCommitteeSize": { "$ref": "cardano.json#/definitions/UInt16" }
, "leiosQuorumStakeThreshold": { "$ref": "cardano.json#/definitions/Ratio" }
, "maxEndorserBlockReferencesSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxEndorserBlockTransactionsSize": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "maxExecutionUnitsPerEndorserBlock": { "$ref": "cardano.json#/definitions/ExecutionUnits" }
, "maxReferenceScriptsSizePerEndorserBlock": { "$ref": "cardano.json#/definitions/NumberOfBytes" }
, "perasMinCandidateBlockAge": { "$ref": "cardano.json#/definitions/UInt32" }
, "perasHealingFactor": { "$ref": "cardano.json#/definitions/Ratio" }
, "perasCertificateBoost": { "$ref": "cardano.json#/definitions/UInt16" }
, "perasTargetCommitteeSize": { "$ref": "cardano.json#/definitions/UInt16" }
, "perasBootstrapRound":
{ "oneOf":
[ { "$ref": "cardano.json#/definitions/UInt32" }
, { "type": "null" }
]
}
, "perasQuorumThresholdSafetyMargin": { "$ref": "cardano.json#/definitions/Ratio" }
, "referenceInputsCostPerMultiAssetPolicy": { "$ref": "cardano.json#/definitions/Value<AdaOnly>" }
, "referenceInputsCostPerDatumByte": { "$ref": "cardano.json#/definitions/UInt64" }
, "stakePoolVotingThresholds": { "$ref": "cardano.json#/definitions/StakePoolVotingThresholds" }
, "constitutionalCommitteeMinSize": { "$ref": "cardano.json#/definitions/UInt16" }
, "constitutionalCommitteeMaxTermLength": { "$ref": "cardano.json#/definitions/UInt64" }
Expand Down
Loading
Loading