Skip to content

Commit

Permalink
Merge branch 'cardano-node-9.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Jul 11, 2024
2 parents f5499a5 + 4f5a3a3 commit 1be8fec
Show file tree
Hide file tree
Showing 207 changed files with 848 additions and 284 deletions.
92 changes: 92 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,102 @@ pre: "<b>5. </b>"

### [6.5.0] - UNRELEASED

### Added

- Integrated with `cardano-node==9.0.0`.

- New ledger-state query: `queryLedgerState/treasuryAndReserves` to retrieve the current Ada values of the treasury and reserves.

- New protocol parameters in Conway:
- `maximumReferenceScriptsSize` which indicates the maximum total number of bytes of scripts referenced by a transaction.
- `minFeeReferenceScripts` with three sub fields: `range`, `base` and `multiplier` that now intervenes in the minimum fee calculation. Note that, starting in the Conway era, the min fee calculation is given by the following formula:

$$
minFee = A + B + C
$$

$$
\begin{array}{lll}
A & = & sizeOf(transaction) \times minFeeCoefficient \\
B & = & minFeeConstant \\
C & = & referenceScriptsTierPrice \\
\end{array}
$$

Where $referenceScriptsTierPrice$ is a tier-price depending on the total size of the serialized reference scripts. The total size (in bytes) of reference scripts is priced according to a different, growing tier, given by the following table:

| Size range | Cost |
| --- | --- |
| $[ 0; range[$ | $\rfloor sizeOf(referenceScripts) \times base\lfloor$ |
| $[range; 2 \times range[$ | $\rfloor sizeOf(referenceScripts) \times multiplier \times base\lfloor$ |
| $[2 \times range; 3 \times range[$ | $\rfloor sizeOf(referenceScripts) \times {multiplier}^2 \times base\lfloor$ |
| $[3 \times range; 4 \times range[$ | $\rfloor sizeOf(referenceScripts) \times {multiplier}^3 \times base\lfloor$ |
| ... | ... |
| $[n \times range; (n + 1) \times range [$ | $\rfloor sizeOf(referenceScripts) \times {multiplier}^n \times base\lfloor$ |

Considering $range = 25600$, $multiplier = 1.2$ and $base = 44$, we get:

<table>
<thead>
<tr>
<th>Size range</th>
<th>Price per byte</th>
<th>Plot</th>
</tr>
</thead>
<tbody>
<tr>
<td>$[ 0; 25600[$</td>
<td>$44.000$</td>
<td rowspan=6><a href="https://www.geogebra.org/graphing/x2aa47uu"><img src="./docs/static/referenceScriptsTierFee.png"></a></td>
</tr>
<tr>
<td>$[25600; 51200[$</td>
<td>$52.800$</td>
</tr>
<tr>
<td>$[51200; 76800[$</td>
<td>$63.360$</td>
</tr>
<tr>
<td>$[76800; 102400[$</td>
<td>$76.032$</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
</tr>
<tr>
<td>$[179200; 204800[$</td>
<td>$157.66$</td>
</tr>
</tbody>
</table>

> [!NOTE]
>
> In Conway, the maximum size of reference scripts is limited to **200KiB**.
Hence, a transaction that carries reference scripts adding up to 80KiB of data would be priced:

$$
referenceScriptTierPrice_{80KiB} = 25600 \times (44 + 52.8 + 63.36) + 5120 \times 76.032 = 4489379
$$

- New transaction submission / evaluation errors:
- [`ReferenceScriptsTooLarge`](https://ogmios.dev/mini-protocols/local-tx-submission#schema-3166/ReferenceScriptsTooLarge) (`code=3166`) now raised when trying to submit a transaction that contains reference scripts whose total size is above 200KB (will become a protocol parameter in the next era).
- [`UnknownVoters`](https://ogmios.dev/mini-protocols/local-tx-submission#schema-3167/UnknownVoters) (`code=3167`) returned when submitting votes from unregistered pools or credentials.

#### Changed

- Roll back down to GHC-9.4.8 in an attempt to fix [#399](https://github.com/CardanoSolutions/ogmios/issues/399) possibly caused by a bug in GHC runtime system (possibly patched on 9.4.x).

- Fixed the reported `activeStakeInEpoch` on the `queryLedgerState/rewardsProvenance`, which was mistakenly reporting the `totalStakeInEpoch`. A new value `totalStakeInEpoch` also now correctly reports that information.

#### Removed

- N/A

### [6.4.0] - 2024-06-06

#### Added
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

| Ogmios | Cardano-node (mainnet, preview, preprod) | Cardano-node (sanchonet) |
| --- | --- | --- |
| **`v6.4.0`** | **`8.9.3`** | **`8.11.0-pre`** |
| **`v6.5.0`** | **`9.0.0`** | **`9.0.0`** |
| `v6.4.0` | `8.9.3` | `8.11.0-pre` |
| `v6.3.0` | `8.9.2` | `8.10.1-pre` |
| `v6.2.0` | `8.9.0` | `8.9.0` |
| `v6.1.0` | `8.7.3` | `8.8.0-pre` |
Expand Down Expand Up @@ -63,6 +64,7 @@ See our [Ogmios client starter kit](https://github.com/CardanoSolutions/ogmios-t
`rewardsProvenance` | Get details about rewards calculation for the ongoing epoch.
`stakePools` | The list of all pool identifiers currently registered and active.
`tip` | The current tip the ledger is at. Said differently, the slot number and header hash of the last block that has been processed by the ledger.
`treasuryAndReserves` | The Ada value of the treasury and reserves of the protocol.
`utxo` | Current UTXO, possibly filtered by output reference.
</details>
</td>
Expand Down
93 changes: 86 additions & 7 deletions clients/TypeScript/packages/schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ export type None = null;
* A network target, as defined since the Shelley era.
*/
export type Network = "mainnet" | "testnet";
export type UInt32 = number;
export type Nonce = Neutral | DigestBlake2B256;
export type Neutral = "neutral";
export type Int64 = number;
export type CostModel = Int64[];
export type UInt32 = number;
export type UInt16 = number;
export type Metadatum = MetadatumNoSchema | MetadatumDetailedSchema;
export type MetadatumNoSchema = IntegerNoSchema | StringNoSchema | ArrayNoSchema | ObjectNoSchema;
export type IntegerNoSchema = bigint;
Expand Down Expand Up @@ -214,6 +215,8 @@ export type SubmitTransactionFailure =
| SubmitTransactionFailureConstitutionGuardrailsHashMismatch
| SubmitTransactionFailureConflictingInputsAndReferences
| SubmitTransactionFailureUnauthorizedGovernanceAction
| SubmitTransactionFailureReferenceScriptsTooLarge
| SubmitTransactionFailureUnknownVoters
| SubmitTransactionFailureUnrecognizedCertificateType;
export type Era = "byron" | "shelley" | "allegra" | "mary" | "alonzo" | "babbage" | "conway";
export type ScriptPurpose =
Expand Down Expand Up @@ -383,6 +386,12 @@ export interface Ogmios {
| QueryLedgerStateEraMismatch
| QueryLedgerStateUnavailableInCurrentEra
| QueryLedgerStateAcquiredExpired;
QueryLedgerStateTreasuryAndReserves: QueryLedgerStateTreasuryAndReserves;
QueryLedgerStateTreasuryAndReservesResponse:
| QueryLedgerStateTreasuryAndReservesResponse
| QueryLedgerStateEraMismatch
| QueryLedgerStateUnavailableInCurrentEra
| QueryLedgerStateAcquiredExpired;
QueryLedgerStateUtxo: QueryLedgerStateUtxo;
QueryLedgerStateUtxoResponse:
| QueryLedgerStateUtxoResponse
Expand Down Expand Up @@ -802,6 +811,11 @@ export interface GovernanceActionProtocolParametersUpdate {
export interface ProposedProtocolParameters {
minFeeCoefficient?: UInt64;
minFeeConstant?: ValueAdaOnly;
minFeeReferenceScripts?: {
range: UInt32;
base: number;
multiplier: number;
};
minUtxoDepositCoefficient?: UInt64;
minUtxoDepositConstant?: ValueAdaOnly;
maxBlockBodySize?: {
Expand All @@ -813,6 +827,9 @@ export interface ProposedProtocolParameters {
maxTransactionSize?: {
bytes: UInt64;
};
maxReferenceScriptsSize?: {
bytes: UInt64;
};
maxValueSize?: {
bytes: UInt64;
};
Expand All @@ -833,7 +850,7 @@ export interface ProposedProtocolParameters {
maxExecutionUnitsPerTransaction?: ExecutionUnits;
maxExecutionUnitsPerBlock?: ExecutionUnits;
stakePoolVotingThresholds?: StakePoolVotingThresholds;
constitutionalCommitteeMinSize?: UInt64;
constitutionalCommitteeMinSize?: UInt16;
constitutionalCommitteeMaxTermLength?: UInt64;
governanceActionLifetime?: Epoch;
governanceActionDeposit?: ValueAdaOnly;
Expand Down Expand Up @@ -1918,8 +1935,35 @@ export interface SubmitTransactionFailureConflictingInputsAndReferences {
* The ledger is still in a bootstrapping phase. During that phase, only protocol parameters changes, hard fork initiations and info actions are authorized. The transaction contains other types of governance action and was therefore rejected
*/
export interface SubmitTransactionFailureUnauthorizedGovernanceAction {
code: 3164;
code: 3165;
message: string;
}
export interface SubmitTransactionFailureReferenceScriptsTooLarge {
code: 3166;
message: string;
data: {
measuredReferenceScriptsSize: {
bytes: UInt64;
};
maximumReferenceScriptsSize: {
bytes: UInt64;
};
};
}
/**
* Some voters in the transaction are unknown. Voters must correspond to registered credentials present in the ledger. They can possibly be registered in the same block, but it must imperatively happens before they are used for voting. The field 'data.unknownVoters' indicates the credentials that couldn't be mapped to any known voter.
*/
export interface SubmitTransactionFailureUnknownVoters {
code: 3167;
message: string;
data: {
unknownVoters: (
| VoterGenesisDelegate
| VoterConstitutionalCommittee
| VoterDelegateRepresentative
| VoterStakePoolOperator
)[];
};
}
/**
* Unrecognized certificate type. This error is a placeholder due to how internal data-types are modeled. If you ever run into this, please report the issue as you've likely discoverd a critical bug...
Expand Down Expand Up @@ -2163,7 +2207,8 @@ export interface QueryLedgerStateEraMismatch {
| "queryLedgerState/rewardsProvenance"
| "queryLedgerState/stakePools"
| "queryLedgerState/utxo"
| "queryLedgerState/tip";
| "queryLedgerState/tip"
| "queryLedgerState/treasuryAndReserves";
/**
* An era mismatch between a client request and the era the ledger is in. This may occur when running queries on a syncing node and/or when the node is crossing an era.
*/
Expand All @@ -2190,7 +2235,8 @@ export interface QueryLedgerStateUnavailableInCurrentEra {
| "queryLedgerState/rewardsProvenance"
| "queryLedgerState/stakePools"
| "queryLedgerState/utxo"
| "queryLedgerState/tip";
| "queryLedgerState/tip"
| "queryLedgerState/treasuryAndReserves";
/**
* Some query is not available for the requested ledger era.
*/
Expand All @@ -2216,7 +2262,8 @@ export interface QueryLedgerStateAcquiredExpired {
| "queryLedgerState/rewardsProvenance"
| "queryLedgerState/stakePools"
| "queryLedgerState/utxo"
| "queryLedgerState/tip";
| "queryLedgerState/tip"
| "queryLedgerState/treasuryAndReserves";
/**
* Previously acquired ledger state is no longer available.
*/
Expand Down Expand Up @@ -2452,6 +2499,17 @@ 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;
};
minUtxoDepositCoefficient: UInt64;
minUtxoDepositConstant: ValueAdaOnly;
maxBlockBodySize: {
Expand Down Expand Up @@ -2482,8 +2540,11 @@ export interface ProtocolParameters {
scriptExecutionPrices?: ScriptExecutionPrices;
maxExecutionUnitsPerTransaction?: ExecutionUnits;
maxExecutionUnitsPerBlock?: ExecutionUnits;
maxReferenceScriptsSize?: {
bytes: UInt64;
};
stakePoolVotingThresholds?: StakePoolVotingThresholds;
constitutionalCommitteeMinSize?: UInt64;
constitutionalCommitteeMinSize?: UInt16;
constitutionalCommitteeMaxTermLength?: UInt64;
governanceActionLifetime?: Epoch;
governanceActionDeposit?: ValueAdaOnly;
Expand Down Expand Up @@ -2547,6 +2608,7 @@ export interface RewardsProvenance {
*/
stakePoolPledgeInfluence: string;
totalRewardsInEpoch: ValueAdaOnly;
totalStakeInEpoch: ValueAdaOnly;
activeStakeInEpoch: ValueAdaOnly;
stakePools: {
[k: string]: StakePoolSummary;
Expand Down Expand Up @@ -2604,6 +2666,23 @@ export interface QueryLedgerStateTipResponse {
result: PointOrOrigin;
id?: unknown;
}
/**
* Query the Ada value of the treasury and reserves accounts.
*/
export interface QueryLedgerStateTreasuryAndReserves {
jsonrpc: "2.0";
method: "queryLedgerState/treasuryAndReserves";
id?: unknown;
}
export interface QueryLedgerStateTreasuryAndReservesResponse {
jsonrpc: "2.0";
method: "queryLedgerState/treasuryAndReserves";
result: {
treasury: ValueAdaOnly;
reserves: ValueAdaOnly;
};
id?: unknown;
}
/**
* Query the current Utxo set, restricted to some output references or addresses.
*/
Expand Down
11 changes: 11 additions & 0 deletions docs/content/mini-protocols/local-state-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ queryLedgerState | Information
`rewardsProvenance` | Get details about rewards calculation for the ongoing epoch.
`stakePools` | The list of all currently registered and active stake pools with their current parameters.
`tip` | The current tip the ledger is at. Said differently, the slot number and header hash of the last block that has been processed by the ledger.
`treasuryAndReserves` | The Ada value of the treasury and reserves of the protocol.
`utxo` | Current UTXO, possibly filtered by output reference.

{{% notice tip %}}
Expand Down Expand Up @@ -614,6 +615,16 @@ Be aware that it is possible for an acquire request to fail even if (and in part
}
```

#### treasuryAndReserves

```json
{
"jsonrpc": "2.0",
"method": "queryLedgerState/treasuryAndReserves"
}
```


#### ledger tip

```json
Expand Down
4 changes: 4 additions & 0 deletions docs/content/mini-protocols/local-tx-submission.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ components:
$ref: "/ogmios.json#/definitions/SubmitTransactionFailure/oneOf/65"
3165/UnauthorizedGovernanceAction:
$ref: "/ogmios.json#/definitions/SubmitTransactionFailure/oneOf/66"
3166/ReferenceScriptsTooLarge:
$ref: "/ogmios.json#/definitions/SubmitTransactionFailure/oneOf/67"
3167/UnknownVoters:
$ref: "/ogmios.json#/definitions/SubmitTransactionFailure/oneOf/68"
3998/UnrecognizedCertificateType:
$ref: "/ogmios.json#/definitions/SubmitTransactionFailure/oneOf/62"
{{% /embed-async-api %}}
Expand Down
Loading

0 comments on commit 1be8fec

Please sign in to comment.