Skip to content

Commit c926ffc

Browse files
Fix and update Etherlink demo (#923)
1 parent 0211401 commit c926ffc

File tree

48 files changed

+483
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+483
-150
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].
66

7-
## [Unreleased]
7+
## [7.3.0] - 2024-01-23
88

99
### Added
1010

@@ -1289,7 +1289,8 @@ This release contains no changes except for the version number.
12891289
[semantic versioning]: https://semver.org/spec/v2.0.0.html
12901290

12911291
<!-- Versions -->
1292-
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/7.2.2...HEAD
1292+
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/7.3.0...HEAD
1293+
[7.3.0]: https://github.com/dipdup-io/dipdup/compare/7.2.2...7.3.0
12931294
[7.2.2]: https://github.com/dipdup-io/dipdup/compare/7.2.1...7.2.2
12941295
[7.2.1]: https://github.com/dipdup-io/dipdup/compare/7.2.0...7.2.1
12951296
[7.2.0]: https://github.com/dipdup-io/dipdup/compare/7.1.1...7.2.0

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
.ONESHELL:
21
.PHONY: $(MAKECMDGOALS)
32
MAKEFLAGS += --no-print-directory
43
##
54
## 🚧 DipDup developer tools
65
##
76
PACKAGE=dipdup
87
TAG=latest
9-
COMPOSE=deploy/compose.yaml
108
SOURCE=src tests scripts
119
DEMO=''
1210
FRONTEND_PATH=../interface

docs/1.getting-started/6.datasources.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Index datasources, ones that can be attached to a specific index, are prefixed w
2222

2323
## Connection settings
2424

25-
All datasources now share the same code under the hood to communicate with underlying APIs via HTTP. Their configs have an optional section `http` to configure connection settings. You can use it to set timeouts, retry policies, and other parameters.
25+
All datasources share the same code under the hood to communicate with underlying APIs via HTTP. Their configs have an optional section `http` to configure connection settings. You can use it to set timeouts, retry policies, and other parameters.
2626

2727
Each datasource kind has its defaults. Usually, there's no reason to alter these settings unless you use self-hosted instances. In the example below, default values are shown:
2828

@@ -38,6 +38,7 @@ datasources:
3838
ratelimit_sleep: 0.0
3939
connection_limit: 100
4040
connection_timeout: 60
41+
request_timeout: 60
4142
batch_size: 10_000
4243
replay_path: None
4344
alias: None

docs/1.getting-started/7.indexes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Index is a primary DipDup entity connecting the inventory and data handling rule
99

1010
Multiple indexes are available for different workloads. Every index is linked to a specific datasource and provides a set of handlers for different kinds of data. Use this table to choose the right index for the task:
1111

12-
| kind | blockchain | datasource | indexed data |
13-
| ------------------------------------------------------------------------- | -------------- | ---------- | --------------------------- |
12+
| kind | blockchain | datasource | indexed data |
13+
| -------------------------------------------------------------------------------------- | -------------- | ---------- | --------------------------- |
1414
| [evm.subsquid.events](../2.indexes/1.evm_subsquid_events.md) | EVM-compatible | Subsquid | event logs |
1515
| [tezos.tzkt.big_maps](../2.indexes/2.tezos_tzkt_big_maps.md) | Tezos | TzKT | big map diffs |
1616
| [tezos.tzkt.events](../2.indexes/3.tezos_tzkt_events.md) | Tezos | TzKT | events |

docs/2.indexes/5.tezos_tzkt_operations.md

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Operation index allows you to query only operations related to you
44
network: "tezos"
55
---
66

7-
<!-- markdownlint-disable first-line-h1 -->
7+
<!-- markdownlint-disable no-inline-html-->
88
<!-- TODO: add images to the side <div class="float-img">
99
<img src="../../assets/operation-bcd.png" alt="Operation group in BCD explorer">
1010
<img src="../../assets/operation-config.png" alt="`operation` index config">
@@ -16,10 +16,10 @@ Operation index allows you to query only operations related to your dapp and mat
1616

1717
## Handlers
1818

19-
Each operation handler contains two required fields:
19+
Each operation handler config item contains two required fields:
2020

21-
* `callback` — a name of async function with a particular signature; DipDup will search for it in `{{ project.package }}.handlers.<callback>` module.
22-
* `pattern` — a non-empty list of items that need to be matched.
21+
- `callback` — a name of async function with a particular signature; DipDup will search for it in `{{ project.package }}.handlers.<callback>` module.
22+
- `pattern` — a non-empty list of items that need to be matched.
2323

2424
```yaml [dipdup.yaml]
2525
indexes:
@@ -37,26 +37,47 @@ indexes:
3737
3838
You can think of the operation pattern as a regular expression on a sequence of operations (both external and internal) with a global flag enabled (there can be multiple matches). Multiple operation parameters can be used for matching (source, destination, etc.).
3939
40-
You will get slightly different callback argument types depending on whether pattern item is typed or not. If so, DipDup will generate the dataclass for a particular entrypoint/storage, otherwise you will have to handle untyped parameters/storage updates stored in `TzktOperationData` model.
40+
When the operation group matches the pattern, DipDup creates arguments for the callback function and invokes it.
4141
42-
## Matching originations
42+
## Typed and untyped arguments
4343
44-
| name | description | supported | typed |
45-
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |:---------:|:-----:|
46-
| `originated_contract.address` | Origination of exact contract. | ✅ | ✅ |
47-
| `originated_contract.code_hash` | Originations of all contracts having the same code. | ✅ | ✅ |
48-
| `source.address` | Special cases only. This filter is very slow and doesn't support strict typing. Usually, `originated_contract.code_hash` suits better. | ⚠ | ❌ |
49-
| `source.code_hash` | Currently not supported. | ❌ | ❌ |
44+
You will get slightly different callback argument types depending on whether the pattern item is typed or not. If so, DipDup will generate the dataclass for a particular entrypoint/storage, otherwise, you will have to handle untyped parameters/storage updates stored in `TzktOperationData` model.
5045

51-
## Matching transactions
46+
## Applying filters
47+
48+
In pattern items, you can specify filters to narrow down the search. For example, you can match only operations sent to a particular address. Each operation type has its own set of filters.
49+
50+
### Originations
51+
52+
| name | description | supported | typed |
53+
| ------------------------------- | ------------------------------------------------------------ |:---------:|:-----:|
54+
| `originated_contract.address` | Origination of exact contract. | 🟢 | 🟢 |
55+
| `originated_contract.code_hash` | Originations of all contracts having the same code. | 🟢 | 🟢 |
56+
| `source.address` | Originations sent by address. Special cases only, see below. | 🟡 | 🔴 |
57+
| `source.code_hash` | Not supported. | 🔴 | 🔴 |
58+
59+
Filtering originations by `source.address` is very slow and strict typing is not supported. For most cases `originated_contract.code_hash` suits better.
60+
61+
### Transactions
5262

5363
| name | description | supported | typed |
5464
| ------------------------ | ------------------------------------------ |:---------:|:-----:|
55-
| `source.address` | Sent by exact address. | ✅ | N/A |
56-
| `source.code_hash` | Sent by any contract having this code hash | ✅ | N/A |
57-
| `destination.address` | Invoked contract address | ✅ | ✅ |
58-
| `destination.code_hash` | Invoked contract code hash | ✅ | ✅ |
59-
| `destination.entrypoint` | Entrypoint called | ✅ | ✅ |
65+
| `source.address` | Sent by exact address | 🟢 | 🔴 |
66+
| `source.code_hash` | Sent by any contract having this code hash | 🟢 | 🔴 |
67+
| `destination.address` | Invoked contract address | 🟢 | 🟢¹ |
68+
| `destination.code_hash` | Invoked contract code hash | 🟢 | 🟢¹ |
69+
| `destination.entrypoint` | Entrypoint called | 🟢 | 🟢 |
70+
71+
<sup>¹ when entrypoint is specified too</sup>
72+
73+
### Smart rollup calls
74+
75+
| name | description | supported | typed |
76+
| ----------------------- | ------------------------ |:---------:|:-----:|
77+
| `source.address` | Sent by exact address. | 🟢 | 🔴 |
78+
| `source.code_hash` | Not supported | 🔴 | 🔴 |
79+
| `destination.address` | Invoked contract address | 🟢 | 🔴 |
80+
| `destination.code_hash` | Not supported | 🔴 | 🔴 |
6081

6182
## Optional items
6283

@@ -65,15 +86,15 @@ Pattern items have `optional` field to continue matching even if this item is no
6586
```yaml [dipdup.yaml]
6687
pattern:
6788
# Implicit transaction
68-
- destination: some_contract
89+
- type: transaction
90+
destination: some_contract
6991
entrypoint: mint
70-
71-
# Internal transactions below
72-
- destination: another_contract
92+
# Internal transactions
93+
- type: transaction
94+
destination: another_contract
7395
entrypoint: transfer
74-
75-
- source: some_contract
76-
type: transaction
96+
- type: transaction
97+
source: some_contract
7798
```
7899

79100
## Specifying contracts to index

docs/9.release-notes/1.v7.3.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,83 @@ description: DipDup 7.3 release notes
55

66
# Release Notes: 7.3
77

8-
We're glad to announce DipDup 7.2! This release brings better support for Etherlink smart rollups and a bunch of minor improvements.
8+
We're glad to announce DipDup 7.3! This release brings better support for Etherlink smart rollups and a bunch of minor improvements.
99

1010
## Indexing `sr_execute` operations on Tezos
1111

12+
We continue to improve support for Etherlink smart rollups introduced in 7.2. In case you've missed it, Etherlink is an EVM-compatible smart rollup on Tezos, which prioritizes fair ordering of transactions, low latency and security. They are WASM applications, providing versatility in what language you write them in.
13+
14+
Now you can index `sr_execute` operations with DipDup. This is a special operation created when rollup outbox messages are executed. You can filter them by `sr1` source/destination address. `demo_etherlink` demo project was updated to reflect these changes. It's an indexer for a bridge contract having two handlers, for depositing tokens to the rollup address (L1 -> L2) and for withdrawing them (L2 -> L1).
15+
16+
```yaml [dipdup.yaml]
17+
spec_version: 2.0
18+
package: demo_etherlink
19+
20+
datasources:
21+
tzkt:
22+
kind: tezos.tzkt
23+
url: ${TZKT_URL:-https://api.nairobinet.tzkt.io}
24+
25+
contracts:
26+
ticketer:
27+
kind: tezos
28+
address: KT1PmYUomF3HDxsGWYQUCbLi2X8WvT7ZHv8o
29+
typename: ticketer
30+
ticket_helper:
31+
kind: tezos
32+
address: KT1TZg9EwGHKbfWvsHGsqBjm3J5NhJBtHPKX
33+
typename: ticket_helper
34+
rollup:
35+
kind: tezos
36+
address: sr1QgYF6ARMSLcWyAX4wFDrWFaZTyy4twbqe
37+
typename: rollup
38+
39+
indexes:
40+
rollup_operations:
41+
kind: tezos.tzkt.operations
42+
datasource: tzkt
43+
contracts:
44+
- ticketer
45+
- ticket_helper
46+
- rollup
47+
types:
48+
- transaction
49+
- sr_execute
50+
handlers:
51+
- callback: on_deposit
52+
pattern:
53+
- type: transaction
54+
destination: ticketer
55+
entrypoint: deposit
56+
- type: transaction
57+
destination: ticket_helper
58+
entrypoint: default
59+
- type: transaction
60+
destination: rollup
61+
entrypoint: default
62+
alias: rollup_default
63+
- callback: on_withdraw
64+
pattern:
65+
- type: sr_execute
66+
destination: rollup
67+
- type: transaction
68+
destination: ticketer
69+
entrypoint: withdraw
70+
- type: transaction
71+
source: ticketer
72+
entrypoint: transfer
73+
```
74+
75+
To use this demo as a template for your own Etherlink project, run `dipdup new` and choose `demo_etherlink` template.
76+
77+
Read more about Etherlink and DipDup support for it:
78+
79+
- [`tezos.tzkt.operations` index](../2.indexes/5.tezos_tzkt_operations.md)
80+
- [Etherlink docs](https://docs.etherlink.com/)
81+
- [Etherlink: Building The Most Decentralized EVM Layer 2 (On Tezos)](https://news.tezoscommons.org/etherlink-building-the-most-decentralized-evm-layer-2-on-tezos-1c749fb78d34).
82+
1283
## Fixes and improvements
84+
85+
- abi.etherscan: Fixed handling "rate limit reached" errors.
86+
- cli: Fixed setting logger levels based on config and env variables.
87+
- http: Fixed incorrect number of retries performed on failed requests.

docs/9.release-notes/2.v7.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We're glad to announce DipDup 7.2! This release brings Etherlink smart rollup co
1111

1212
Etherlink is an EVM-compatible smart rollup, which prioritizes fair ordering of transactions, low latency and security.
1313

14-
Smart rollups are Tezos’ permissionless L2 scaling solution. They are WASM applications, providing versatility in what language you write them in. You can learn more in [Etherlink docs](https://docs.etherlink.com/welcome/what-is-etherlink)
14+
Smart rollups are Tezos’ permissionless L2 scaling solution. They are WASM applications, providing versatility in what language you write them in. You can learn more in [Etherlink docs](https://docs.etherlink.com/)
1515

1616
Since version 7.2 you can index Etherlink smart rollups like regular Tezos contracts. Choose `demo_etherlink` template when creating a new project:
1717

pdm.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pytest-aiohttp==1.0.5
7777
pytest-asyncio==0.23.3
7878
pytest-cov==4.1.0
7979
pytest-xdist==3.5.0
80-
python-dotenv==1.0.0
80+
python-dotenv==1.0.1
8181
pytz==2023.3.post1
8282
pyunormalize==15.1.0
8383
pywin32==306; platform_system == "Windows" or sys_platform == "win32"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pydantic==1.10.14
6060
pyhumps==3.8.0
6161
pypika-tortoise==0.1.6
6262
pysignalr==0.2.0
63-
python-dotenv==1.0.0
63+
python-dotenv==1.0.1
6464
pytz==2023.3.post1
6565
pyunormalize==15.1.0
6666
pywin32==306; platform_system == "Windows"

0 commit comments

Comments
 (0)