Skip to content

Commit

Permalink
Merge branch 'master' into v6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Feb 2, 2024
2 parents 155aa4b + 0c16007 commit 523f1cd
Show file tree
Hide file tree
Showing 27 changed files with 245 additions and 95 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ jobs:
substituters = https://cache.iog.io/ https://cache.nixos.org/
nix_path: nixpkgs=channel:nixos-unstable

- uses: cachix/cachix-action@v14
with:
name: cardano-ogmios
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: ❄️ Prepare cache (x86_64)
if: ${{ matrix.arch == 'x86_64' }}
working-directory: server
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ layout: changelog
pre: "<b>5. </b>"
---

### [6.0.3] - 2024-02-02

#### Added

- A new transaction submission / evaluation error (`code: 3161`) returned when a script evaluation goes beyond its allocated budget.

#### Changed

- Mapped some internal errors to actual predicate failures. Before, Ogmios would simply return an `InternalLedgerTypeConversionError` with code `3999` in cases where it should have been returning a more meaningful error resulting from either an excessive script evaluation (see new introduced error 3161) or a failed attempt to create a script context for a given transaction.

- ![TypeScript][] Renamed types regarding Metadatum in the TypeScript client to provide more meaningful names.

#### Removed

- N/A

---
---

### [6.0.2] - 2024-01-30

#### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Finally, [discussions 💡][discussions] contains ongoing discussions regarding
Ogmios provides a language-agnostic API which can be implemented using any WebSocket or HTTP client. If you prefer using a SDK in your favorite language, see below the available clients (_maintained by the community_):

<table align="center"><thead><tr>
<td align="center"><img height=72 width=72 src=".github/clients/typescript.png" alt="Logo:TypeScript"><br/><a href="https://ogmios.dev/typescript-client/overview"><strong>TypeScript</strong></a></td>
<td align="center"><img height=72 width=72 src=".github/clients/typescript.png" alt="Logo:TypeScript"><br/><a href="https://ogmios.dev/typescript/api/modules/_cardano_ogmios_client.html"><strong>TypeScript</strong></a></td>
<td align="center"><img height=72 width=72 src=".github/clients/go.png" alt="Logo:Go"><br/><a href="https://github.com/savaki/ogmigo/#readme"><strong>Go</strong></a></td>
<td align="center"><img height=72 width=72 src=".github/clients/kotlin.png" alt="Logo:Kotlin"><br/><a href="https://github.com/projectNEWM/kogmios#readme"><strong>Kotlin</strong></a></td>
<td align="center"><img height=72 width=72 src=".github/clients/java.png" alt="Logo:Java"><br/><a href="https://github.com/adabox-aio/ogmios-java-client.git#readme"><strong>Java</strong></a></td>
Expand Down
2 changes: 1 addition & 1 deletion clients/TypeScript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cardano-ogmios",
"version": "6.0.2",
"version": "6.0.3",
"private": true,
"description": "TypeScript monorepo with client libraries for Cardano Ogmios",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions clients/TypeScript/packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cardano-ogmios/client",
"version": "6.0.2",
"version": "6.0.3",
"description": "TypeScript client library for Cardano Ogmios",
"engines": {
"node": ">=14"
Expand Down Expand Up @@ -47,7 +47,7 @@
"typescript": "^4.2.3"
},
"dependencies": {
"@cardano-ogmios/schema": "6.0.2",
"@cardano-ogmios/schema": "6.0.3",
"@cardanosolutions/json-bigint": "^1.0.1",
"@types/json-bigint": "^1.0.1",
"bech32": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions clients/TypeScript/packages/repl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cardano-ogmios/repl",
"version": "6.0.2",
"version": "6.0.3",
"description": "REPL for Cardano Ogmios",
"engines": {
"node": ">=14"
Expand Down Expand Up @@ -39,7 +39,7 @@
"typescript": "^4.2.3"
},
"dependencies": {
"@cardano-ogmios/client": "6.0.2",
"@cardano-ogmios/client": "6.0.3",
"yargs-parser": "^20.2.7"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion clients/TypeScript/packages/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cardano-ogmios/schema",
"version": "6.0.2",
"version": "6.0.3",
"description": "Generated TypeScript from the Cardano Ogmios schema",
"engines": {
"node": ">=14"
Expand Down
38 changes: 27 additions & 11 deletions clients/TypeScript/packages/schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ export type Neutral = "neutral";
export type Int64 = number;
export type CostModel = Int64[];
export type Metadatum = MetadatumNoSchema | MetadatumDetailedSchema;
export type MetadatumNoSchema = Integer | String | ArrayMetadatum | ObjectMetadatum;
export type Integer = bigint;
export type String = string;
export type ArrayMetadatum = MetadatumNoSchema[];
export type MetadatumDetailedSchema = Int | String1 | Bytes | List | Map;
export type MetadatumNoSchema = IntegerNoSchema | StringNoSchema | ArrayNoSchema | ObjectNoSchema;
export type IntegerNoSchema = bigint;
export type StringNoSchema = string;
export type ArrayNoSchema = MetadatumNoSchema[];
export type MetadatumDetailedSchema =
| IntegerDetailedSchema
| StringDetailedSchema
| BytesDetailedSchema
| ArrayDetailedSchema
| ObjectDetailedSchema;
/**
* An Ed25519 verification key.
*/
Expand Down Expand Up @@ -192,6 +197,7 @@ export type SubmitTransactionFailure =
| SubmitTransactionFailureTreasuryWithdrawalMismatch
| SubmitTransactionFailureInvalidOrMissingPreviousProposals
| SubmitTransactionFailureVotingOnExpiredActions
| SubmitTransactionFailureExecutionBudgetOutOfBounds
| SubmitTransactionFailureUnrecognizedCertificateType
| SubmitTransactionFailureInternalLedgerTypeConversionError;
export type Era = "byron" | "shelley" | "allegra" | "mary" | "alonzo" | "babbage" | "conway";
Expand Down Expand Up @@ -953,22 +959,22 @@ export interface MetadataLabels {
json?: Metadatum;
};
}
export interface ObjectMetadatum {
export interface ObjectNoSchema {
[k: string]: MetadatumNoSchema;
}
export interface Int {
export interface IntegerDetailedSchema {
int: bigint;
}
export interface String1 {
export interface StringDetailedSchema {
string: string;
}
export interface Bytes {
export interface BytesDetailedSchema {
bytes: string;
}
export interface List {
export interface ArrayDetailedSchema {
list: MetadatumDetailedSchema[];
}
export interface Map {
export interface ObjectDetailedSchema {
map: MetadatumMap[];
}
export interface MetadatumMap {
Expand Down Expand Up @@ -1815,6 +1821,16 @@ export interface SubmitTransactionFailureVotingOnExpiredActions {
}[];
};
}
/**
* The transaction ran out of execution budget! This means that the budget granted for the execution of a particular script was too small or exceeding the maximum value allowed by the protocol. The field 'data.budgetUsed' indicates the actual execution units used by the validator before it was interrupted.
*/
export interface SubmitTransactionFailureExecutionBudgetOutOfBounds {
code: 3161;
message: string;
data: {
budgetUsed: ExecutionUnits;
};
}
/**
* 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
12 changes: 6 additions & 6 deletions docs/content/clients/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ pre = "<b>3. </b>"

There exists a variety of clients for Ogmios. Initially, the TypeScript client was developed alongside the server as a proof-of-concept. Over time, amazing community members have developed new clients in their favorite languages:

<table align="center"><thead><tr>
<td align="center"><img height=72 width=72 src="/images/clients/typescript.png" alt="Logo:TypeScript"><br/><a href="https://ogmios.dev/typescript/api/modules/_cardano_ogmios_client.html"><strong>TypeScript</strong></a></td>
<td align="center"><img height=72 width=72 src="/images/clients/go.png" alt="Logo:Go"><br/><a href="https://github.com/SundaeSwap-finance/ogmigo#readme"><strong>Go</strong></a></td>
<td align="center"><img height=72 width=72 src="/images/clients/kotlin.png" alt="Logo:Kotlin"><br/><a href="https://github.com/projectNEWM/kogmios#readme"><strong>Kotlin</strong></a></td>
<td align="center"><img height=72 width=72 src="/images/clients/java.png" alt="Logo:Java"><br/><a href="https://github.com/adabox-aio/ogmios-java-client.git#readme"><strong>Java</strong></a></td>
<td align="center"><img height=72 width=72 src="/images/clients/python.png" alt="Logo:Python"><br/><a href="https://ogmios-python.readthedocs.io/en/latest/examples/index.html"><strong>Python</Strong></a></td>
<table class="clients" align="center"><thead><tr>
<td align="center"><img src="/images/clients/typescript.png" alt="Logo:TypeScript"><br/><a href="https://ogmios.dev/typescript/api/modules/_cardano_ogmios_client.html"><strong>TypeScript</strong></a></td>
<td align="center"><img src="/images/clients/go.png" alt="Logo:Go"><br/><a href="https://github.com/SundaeSwap-finance/ogmigo#readme"><strong>Go</strong></a></td>
<td align="center"><img src="/images/clients/kotlin.png" alt="Logo:Kotlin"><br/><a href="https://github.com/projectNEWM/kogmios#readme"><strong>Kotlin</strong></a></td>
<td align="center"><img src="/images/clients/java.png" alt="Logo:Java"><br/><a href="https://github.com/adabox-aio/ogmios-java-client.git#readme"><strong>Java</strong></a></td>
<td align="center"><img src="/images/clients/python.png" alt="Logo:Python"><br/><a href="https://ogmios-python.readthedocs.io/en/latest/examples/index.html"><strong>Python</Strong></a></td>
</tr><thead></table>

In this manual, we cover some usage of the TypeScript client. For other clients, please refer to their respective projects and maintainers.
17 changes: 17 additions & 0 deletions docs/layouts/partials/custom-header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
<style type="text/css">
table.clients img {
width: 96px !important;
height: 96px !important;
}

@media(max-width: 900px) {
table.clients tr {
display: flex;
flex-direction: column;
}

table.clients img {
width: 128px !important;
height: 128px !important;
}
}

table.users {
text-align: center;
table-layout: fixed;
Expand Down
18 changes: 9 additions & 9 deletions docs/static/cardano.json
Original file line number Diff line number Diff line change
Expand Up @@ -1436,16 +1436,16 @@
, "anyOf":
[ { "title": "Metadatum<NoSchema>"
, "oneOf":
[ { "title": "Integer", "type": "integer" }
, { "title": "String", "type": "string" }
, { "title": "Array<Metadatum>", "type": "array", "items": { "$ref": "cardano.json#/definitions/Metadatum/anyOf/0" } }
, { "title": "Object<Metadatum>", "type": "object", "additionalProperties": { "$ref": "cardano.json#/definitions/Metadatum/anyOf/0" } }
[ { "title": "IntegerNoSchema", "type": "integer" }
, { "title": "StringNoSchema", "type": "string" }
, { "title": "Array<NoSchema>", "type": "array", "items": { "$ref": "cardano.json#/definitions/Metadatum/anyOf/0" } }
, { "title": "Object<NoSchema>", "type": "object", "additionalProperties": { "$ref": "cardano.json#/definitions/Metadatum/anyOf/0" } }
]
}
, { "title": "Metadatum<DetailedSchema>"
, "oneOf":
[ { "type": "object"
, "title": "int"
, "title": "IntegerDetailedSchema"
, "additionalProperties": false
, "required": ["int"]
, "properties":
Expand All @@ -1455,7 +1455,7 @@
}
}
, { "type": "object"
, "title": "string"
, "title": "StringDetailedSchema"
, "additionalProperties": false
, "required": ["string"]
, "properties":
Expand All @@ -1465,7 +1465,7 @@
}
}
, { "type": "object"
, "title": "bytes"
, "title": "BytesDetailedSchema"
, "additionalProperties": false
, "required": ["bytes"]
, "properties":
Expand All @@ -1477,7 +1477,7 @@
}
}
, { "type": "object"
, "title": "list"
, "title": "Array<DetailedSchema>"
, "additionalProperties": false
, "required": ["list"]
, "properties":
Expand All @@ -1488,7 +1488,7 @@
}
}
, { "type": "object"
, "title": "map"
, "title": "Object<DetailedSchema>"
, "additionalProperties": false
, "required": ["map"]
, "properties":
Expand Down
20 changes: 20 additions & 0 deletions docs/static/ogmios.json
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,26 @@
}
}
}
, { "title": "SubmitTransactionFailure<ExecutionBudgetOutOfBounds>"
, "description": "The transaction ran out of execution budget! This means that the budget granted for the execution of a particular script was too small or exceeding the maximum value allowed by the protocol. The field 'data.budgetUsed' indicates the actual execution units used by the validator before it was interrupted."
, "type": "object"
, "required": [ "code", "message", "data" ]
, "additionalProperties": false
, "properties":
{ "code": { "type": "integer", "enum": [ 3161 ] }
, "message": { "type": "string" }
, "data":
{ "type": "object"
, "additionalProperties": false
, "required": [ "budgetUsed" ]
, "properties":
{ "budgetUsed":
{ "$ref": "cardano.json#/definitions/ExecutionUnits"
}
}
}
}
}
, { "title": "SubmitTransactionFailure<UnrecognizedCertificateType>"
, "description": "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..."
, "type": "object"
Expand Down
3 changes: 2 additions & 1 deletion server/ogmios.cabal

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

3 changes: 2 additions & 1 deletion server/package.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_config: !include ".hpack.config.yaml"

name: ogmios
version: 6.0.2
version: 6.0.3
stability: stable
github: "cardanosolutions/ogmios"
license: MPL-2.0
Expand Down Expand Up @@ -94,6 +94,7 @@ library:
- ouroboros-network-framework
- ouroboros-network-ogmios
- ouroboros-network-protocols
- plutus-core
- plutus-ledger-api
- prettyprinter
- profunctors
Expand Down
18 changes: 18 additions & 0 deletions server/src/Ogmios/Data/Json/Alonzo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Data.Maybe.Strict
( fromSMaybe
, strictMaybe
)
import Data.SatInt
( fromSatInt
)
import Ouroboros.Consensus.Protocol.TPraos
( TPraos
)
Expand Down Expand Up @@ -57,6 +60,8 @@ import qualified Cardano.Ledger.Alonzo.TxWits as Al
import qualified Ogmios.Data.Json.Allegra as Allegra
import qualified Ogmios.Data.Json.Mary as Mary
import qualified Ogmios.Data.Json.Shelley as Shelley
import qualified PlutusLedgerApi.Common as Plutus
import qualified PlutusLedgerApi.V1 as Plutus


type AuxiliaryScripts era =
Expand Down Expand Up @@ -157,6 +162,19 @@ encodeExUnits units =
encodeNatural (Al.exUnitsSteps units)
& encodeObject

encodeExBudget
:: Plutus.ExBudget
-> Json
encodeExBudget budget =
"memory" .=
encodeInteger (fromSatInt mem) <>
"cpu" .=
encodeInteger (fromSatInt cpu)
& encodeObject
where
Plutus.ExMemory mem = Plutus.exBudgetMemory budget
Plutus.ExCPU cpu = Plutus.exBudgetCPU budget

encodeGenesis
:: Al.AlonzoGenesis
-> Json
Expand Down
Loading

0 comments on commit 523f1cd

Please sign in to comment.