Skip to content

Commit

Permalink
Prepare v2.0.0-beta release.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Aug 7, 2022
1 parent 7a29c0b commit 721f318
Show file tree
Hide file tree
Showing 21 changed files with 2,666 additions and 241 deletions.
20 changes: 11 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### [2.0.0] - UNRELEASED
### [2.0.0] - 2022-08-07

> ⚠️ Breaking-Changes ⚠️
>
Expand All @@ -21,24 +21,24 @@

Consequently, there's also a new (possibly `null`) field `spent_at` returned for each match result. When set, it indicates the slot in which the input was found being spent.

- `GET v1/matches[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getAllMatches)
- `GET v1/matches/{pattern-fragment}[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getMatches1Ary)
- `GET v1/matches/{pattern-fragment}/{pattern-fragment}[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getMatches2Ary)
- `GET /matches[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getAllMatches)
- `GET /matches/{pattern-fragment}[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getMatches1Ary)
- `GET /matches/{pattern-fragment}/{pattern-fragment}[?(spent|unspent)]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getMatches2Ary)

<br/>

- [📌 #21](https://github.com/CardanoSolutions/kupo/issues/21) New HTTP endpoint to retrieve Plutus' datum pre-image from a datum hash digest. Behind the scene, Kupo now track any datum found in transactions' witnesses set or output (inline datums). Note that, datums that aren't associated to any existing pattern matches are eventually garbage-collected.
- `GET v1/datums/{datum-hash}`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getDatumByHash)
- `GET /datums/{datum-hash}`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getDatumByHash)

<br/>

- [📌 #21](https://github.com/CardanoSolutions/kupo/issues/28) New HTTP endpoint to retrieve native & Plutus' script pre-image from a script hash digest. Behind the scene, Kupo now track any script found in transactions' witnesses set, auxiliary data and/or outputs (reference scripts).
- `GET v1/scripts/{script-hash}`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getScriptByHash)
- `GET /scripts/{script-hash}`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getScriptByHash)

<br/>

- [📌 #40](https://github.com/CardanoSolutions/kupo/issues/40) New HTTP endpoint to retrieve patterns that _includes_ a given pattern. Useful to check if an address is matched by a given configuration.
- `GET v1/patterns/{pattern-fragment}[/{pattern-fragment}]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/matchPattern1Ary)
- `GET /patterns/{pattern-fragment}[/{pattern-fragment}]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/matchPattern1Ary)

<br/>

Expand All @@ -49,7 +49,7 @@
- [📌 #24](https://github.com/CardanoSolutions/kupo/issues/24) - New HTTP endpoint to retrieve a point on-chain from a given slot. The endpoint is flexible and allows for retrieving the ancestor
of a known point very easily. This is handy in combination with other protocols that leverage on-chain points and intersections (like [Ogmios' chain-sync](https://ogmios.dev/mini-protocols/local-chain-sync/)).

- `GET v1/checkpoints/{slot-no}[?strict]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getCheckpointBySlot)
- `GET /checkpoints/{slot-no}[?strict]`[📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/getCheckpointBySlot)

<br/>

Expand All @@ -61,10 +61,12 @@

- [📌 #24](https://github.com/CardanoSolutions/kupo/issues/24) - Fixed a bug where listing checkpoints would sometimes return duplicate entries.

- [📌 #39](https://github.com/CardanoSolutions/kupo/issues/39) - Inserting a new pattern (i.e. `PUT v1/patterns/{pattern-fragment}`) now requires to provide a rollback point, to which the server will rollback and start synchronizing again. The old behavior can be recovered by simply passing the most recent checkpoint as a rollback point. Note that, you may add an already existing pattern if you only need, for some reason, to rollback the indexer to some previous point in time. See the [📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/putPattern1Ary) for details.
- [📌 #39](https://github.com/CardanoSolutions/kupo/issues/39) - Inserting a new pattern (i.e. `PUT /patterns/{pattern-fragment}`) now requires to provide a rollback point, to which the server will rollback and start synchronizing again. The old behavior can be recovered by simply passing the most recent checkpoint as a rollback point. Note that, you may add an already existing pattern if you only need, for some reason, to rollback the indexer to some previous point in time. See the [📖 API Reference](https://cardanosolutions.github.io/kupo/#operation/putPattern1Ary) for details.

- [📌 #48](https://github.com/CardanoSolutions/kupo/discussions/48) - (Massively) improved performance of query by stake credential. This used to be in linear time in the size of the UTxO set, and is now performed in logarithmic time, same as query by address. Querying by payment credentials is still performed in linear times though so this is probably something you want to avoid doing on permissive patterns (e.g. `*` or `*/*`).

- API endpoints are no longer versioned (i.e. prefixed with `v1`). However, providing `v1` will still work and route requests all-the-same to ensure backward-compatibility. The rationale being that, since kupo is a local service (and thus, clients decide when they want to upgrade), there's no particular need to version the API in the request path.

- Fixed a bug where the server would systematically reject any request to dynamically remove a pattern (because deemed overlapping with existing patterns).

#### Removed
Expand Down
65 changes: 28 additions & 37 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Benchmarks

> Exact numbers, especially time, on those benchmarks may not be of extreme relevance as they depend on the machine hardware specifications they were executed on. What is however interesting is the difference between versions and the measured impact of features additions to the base software.
## Hardware Bench Specifications
## Hardware Specifications

- AMD Ryzen 9 4900HS (4007MHz, 512KiB L1, 4MiB L2, 8MiB L3)
- 2 x 8GiB SODIMM DDR4 Synchronous Unbuffered 3200 MHz (0.3 ns)
Expand All @@ -12,33 +10,30 @@

### Synchronization

| version | options | duration |
| --- | --- | --- |
| `v1.0.1` | N/A | ~12h |
| `v2.0.0` | `--prune-utxo` | 18h |
| version | options | duration |
| --- | --- | --- |
| `v1.0.1` | N/A | ~10-14h<sup>\*</sup> |
| `v2.0.0-beta` | `--prune-utxo` | 16h 45min |

> TODO: re-run mainnet synchronization benchmark with recent fixes w.r.t garbage collection.
> <sup>(\*)</sup>Exact time is unknown as it wasn't properly tracked at the time and was done through multiple runs. So this is therefore a gross bracket.
![](./plots/v2.0.0-beta-mainnet.png)

<p align="center">
<small><code>Fig. Memory Usage (MiB) over time</code></small>
</p>
![](./plots/v2.0.0-beta-mainnet.png)

<p align="right">
See also <a href="./synchronize.js">synchronize.js</a>
</p>

### Query

#### `v2.0.0`
#### `v2.0.0-beta`

Name | Value
--- | ---
`fragment` | `stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6`

```console
$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
$ curl -s "http://$hostname/matches/$fragment" > /dev/null

real 0m2.557s
user 0m0.082s
Expand All @@ -48,7 +43,7 @@ sys 0m0.136s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null

real 0m2.086s
user 0m0.038s
Expand All @@ -65,7 +60,7 @@ Name | Value
`asset_name` | `55676c7942726f546865446566696e697469766536393439`

```console
$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
$ curl -s "http://$hostname/matches/$fragment" > /dev/null

real 0m2.659s
user 0m0.116s
Expand All @@ -75,7 +70,7 @@ sys 0m0.123s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null

real 0m1.856s
user 0m0.127s
Expand All @@ -85,7 +80,7 @@ sys 0m0.070s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null

real 0m0.601s
user 0m0.000s
Expand All @@ -102,32 +97,28 @@ sys 0m0.007s

### Synchronization

| version | options | duration |
| --- | --- | --- |
| `v1.0.1` | N/A | 55min |
| `v2.0.0` | `--prune-utxo` | 50min |
| `v2.0.0` | \- | 65min |
| version | options | duration |
| --- | --- | --- |
| `v1.0.1` | N/A | 55min |
| `v2.0.0-beta` | `--prune-utxo` | 50min |
| `v2.0.0-beta` | \- | 65min |

![](./plots/v2.0.0-beta-testnet.png)

<p align="center">
<small><code>Fig. Memory Usage (MiB) over time</code></small>
</p>

<p align="right">
See also <a href="./synchronize.js">synchronize.js</a>
</p>

### Query

#### `v2.0.0`
#### `v2.0.0-beta`

Name | Value
--- | ---
`fragment` | `addr_test1wrsexavz37208qda7mwwu4k7hcpg26cz0ce86f5e9kul3hqzlh22t`

```console
$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
$ curl -s "http://$hostname/matches/$fragment" > /dev/null

real 0m1.611s
user 0m0.079s
Expand All @@ -137,7 +128,7 @@ sys 0m0.069s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null

real 0m1.665s
user 0m0.059s
Expand All @@ -147,7 +138,7 @@ sys 0m0.090s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?spent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?spent" > /dev/null

real 0m0.004s
user 0m0.000s
Expand All @@ -162,7 +153,7 @@ Name | Value
`fragment` | `stake_test1uzdlw6rjechunh4u03p3eersp6sxpfdwlhkq59ea3mttgfsag8smr`

```console
$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
$ curl -s "http://$hostname/matches/$fragment" > /dev/null

real 0m0.006s
user 0m0.000s
Expand All @@ -172,7 +163,7 @@ sys 0m0.004s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null

real 0m0.010s
user 0m0.004s
Expand All @@ -182,7 +173,7 @@ sys 0m0.004s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?spent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?spent" > /dev/null

real 0m0.008s
user 0m0.002s
Expand All @@ -197,7 +188,7 @@ Name | Value
`fragment` | `6058ae2ba01b03504e0e2c418b44dd431dffe4105172332c518a94b3fe`

```console
$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
$ curl -s "http://$hostname/matches/$fragment" > /dev/null

real 0m0.010s
user 0m0.007s
Expand All @@ -207,7 +198,7 @@ sys 0m0.000s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null

real 0m0.006s
user 0m0.000s
Expand All @@ -217,7 +208,7 @@ sys 0m0.004s
```

```console
$ curl -s "http://$hostname/v1/matches/$fragment?spent" > /dev/null
$ curl -s "http://$hostname/matches/$fragment?spent" > /dev/null

real 0m0.008s
user 0m0.003s
Expand Down
32 changes: 16 additions & 16 deletions benchmarks/jpeg-store-mainnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

hostname=localhost:1442

echo '#### `v2.0.0`'
echo '#### `v2.0.0-beta`'
echo ""

fragment=stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6
Expand All @@ -12,18 +12,18 @@ echo -n '`fragment` | `'; echo -n $fragment; echo '`'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/matches/$fragment" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment" | jq length) matches."
echo '```'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment?unspent" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment?unspent" | jq length) matches."
echo '```'
echo ""

Expand All @@ -41,25 +41,25 @@ echo -n '`asset_name` | `'; echo -n $asset_name; echo '`'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/matches/$fragment" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment" | jq length) matches."
echo '```'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment" | jq length) matches."
echo '```'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null'
time curl -s "http://$hostname/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment?unspent&policy_id=$policy_id&asset_name=$asset_name" | jq length) matches."
echo '```'
echo ""
2 changes: 1 addition & 1 deletion benchmarks/plot-memory-usage
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

nix-shell -p gnuplot --run "gnuplot -e 'plot \"$1\" using (\$1):(\$2/1048576) with lines;' -p"
nix-shell -p gnuplot --run "gnuplot -e 'set ylabel \"Memory Usage (MB)\"; set xlabel \"Time (s)\"; set linetype 1 lc rgb \"#0033ad\"; plot \"$1\" using (\$1):(\$2/1048576) with lines;' -p"
Binary file modified benchmarks/plots/v2.0.0-beta-mainnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions benchmarks/queries-testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

hostname=localhost:1442

echo '#### `v2.0.0`'
echo '#### `v2.0.0-beta`'

fragments="addr_test1wrsexavz37208qda7mwwu4k7hcpg26cz0ce86f5e9kul3hqzlh22t stake_test1uzdlw6rjechunh4u03p3eersp6sxpfdwlhkq59ea3mttgfsag8smr 6058ae2ba01b03504e0e2c418b44dd431dffe4105172332c518a94b3fe"

Expand All @@ -14,26 +14,26 @@ for fragment in $fragments; do
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment" > /dev/null'
time curl -s "http://$hostname/matches/$fragment" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment" | jq length) matches."
echo '```'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment?unspent" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null'
time curl -s "http://$hostname/matches/$fragment?unspent" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment?unspent" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment?unspent" | jq length) matches."
echo '```'
echo ""

echo '```console'
echo '$ curl -s "http://$hostname/v1/matches/$fragment?spent" > /dev/null'
time curl -s "http://$hostname/v1/matches/$fragment?spent" > /dev/null
echo '$ curl -s "http://$hostname/matches/$fragment?spent" > /dev/null'
time curl -s "http://$hostname/matches/$fragment?spent" > /dev/null
echo ""
echo "$(curl -s "http://$hostname/v1/matches/$fragment?spent" | jq length) matches."
echo "$(curl -s "http://$hostname/matches/$fragment?spent" | jq length) matches."
echo '```'
echo ""
done
Loading

0 comments on commit 721f318

Please sign in to comment.