Skip to content

Commit bc897dc

Browse files
committed
chore: initial taqueria-2 changes
1 parent 8b11ebf commit bc897dc

File tree

191 files changed

+17590
-1541
lines changed

Some content is hidden

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

191 files changed

+17590
-1541
lines changed

.github/workflows/dockerhub.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Dockerhub
33
on:
44
push:
55
branches:
6-
- 'taqueria'
6+
- 'taqueria-2'
77

88
jobs:
99
push_to_registry:

.github/workflows/ghcr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Build
22
on:
33
push:
44
branches:
5-
- 'taqueria'
5+
- 'taqueria-2'
66
tags:
77
- 'v*.*.*'
88
pull_request:
99
branches:
10-
- 'taqueria'
10+
- 'taqueria-2'
1111

1212
jobs:
1313
build:

Makefile

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ init:
55
docker-compose exec -T db createdb -U tzkt -T template0 tzkt_db
66
docker-compose exec -T db apt update
77
docker-compose exec -T db apt install -y wget
8-
docker-compose exec -T db wget "https://snapshots.tzkt.io/tzkt_v1.10_mainnet.backup" -O tzkt_db.backup
8+
docker-compose exec -T db wget "https://snapshots.tzkt.io/tzkt_v1.11_mainnet.backup" -O tzkt_db.backup
99
docker-compose exec -T db pg_restore -U tzkt -O -x -v -d tzkt_db -e -j 4 tzkt_db.backup
1010
docker-compose exec -T db rm tzkt_db.backup
1111
docker-compose exec -T db apt autoremove --purge -y wget
@@ -52,7 +52,7 @@ ghost-init:
5252
docker-compose -f docker-compose.ghost.yml exec -T ghost-db createdb -U tzkt -T template0 tzkt_db
5353
docker-compose -f docker-compose.ghost.yml exec -T ghost-db apt update
5454
docker-compose -f docker-compose.ghost.yml exec -T ghost-db apt install -y wget
55-
docker-compose -f docker-compose.ghost.yml exec -T ghost-db wget "https://snapshots.tzkt.io/tzkt_v1.10_ghostnet.backup" -O tzkt_db.backup
55+
docker-compose -f docker-compose.ghost.yml exec -T ghost-db wget "https://snapshots.tzkt.io/tzkt_v1.11_ghostnet.backup" -O tzkt_db.backup
5656
docker-compose -f docker-compose.ghost.yml exec -T ghost-db pg_restore -U tzkt -O -x -v -d tzkt_db -e -j 4 tzkt_db.backup
5757
docker-compose -f docker-compose.ghost.yml exec -T ghost-db rm tzkt_db.backup
5858
docker-compose -f docker-compose.ghost.yml exec -T ghost-db apt autoremove --purge -y wget
@@ -67,27 +67,27 @@ ghost-stop:
6767
ghost-db-start:
6868
docker-compose -f docker-compose.ghost.yml up -d ghost-db
6969

70-
jakarta-init:
71-
docker-compose -f docker-compose.jakarta.yml up -d jakarta-db
72-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db psql -U tzkt postgres -c '\l'
73-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db dropdb -U tzkt --if-exists tzkt_db
74-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db createdb -U tzkt -T template0 tzkt_db
75-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db apt update
76-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db apt install -y wget
77-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db wget "https://snapshots.tzkt.io/tzkt_v1.10_jakartanet.backup" -O tzkt_db.backup
78-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db pg_restore -U tzkt -O -x -v -d tzkt_db -e -j 4 tzkt_db.backup
79-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db rm tzkt_db.backup
80-
docker-compose -f docker-compose.jakarta.yml exec -T jakarta-db apt autoremove --purge -y wget
70+
lima-init:
71+
docker-compose -f docker-compose.lima.yml up -d lima-db
72+
docker-compose -f docker-compose.lima.yml exec -T lima-db psql -U tzkt postgres -c '\l'
73+
docker-compose -f docker-compose.lima.yml exec -T lima-db dropdb -U tzkt --if-exists tzkt_db
74+
docker-compose -f docker-compose.lima.yml exec -T lima-db createdb -U tzkt -T template0 tzkt_db
75+
docker-compose -f docker-compose.lima.yml exec -T lima-db apt update
76+
docker-compose -f docker-compose.lima.yml exec -T lima-db apt install -y wget
77+
docker-compose -f docker-compose.lima.yml exec -T lima-db wget "https://snapshots.tzkt.io/tzkt_v1.11_limanet.backup" -O tzkt_db.backup
78+
docker-compose -f docker-compose.lima.yml exec -T lima-db pg_restore -U tzkt -O -x -v -d tzkt_db -e -j 4 tzkt_db.backup
79+
docker-compose -f docker-compose.lima.yml exec -T lima-db rm tzkt_db.backup
80+
docker-compose -f docker-compose.lima.yml exec -T lima-db apt autoremove --purge -y wget
8181
docker-compose pull
8282

83-
jakarta-start:
84-
docker-compose -f docker-compose.jakarta.yml up -d
83+
lima-start:
84+
docker-compose -f docker-compose.lima.yml up -d
8585

86-
jakarta-stop:
87-
docker-compose -f docker-compose.jakarta.yml down
86+
lima-stop:
87+
docker-compose -f docker-compose.lima.yml down
8888

89-
jakarta-db-start:
90-
docker-compose -f docker-compose.jakarta.yml up -d jakarta-db
89+
lima-db-start:
90+
docker-compose -f docker-compose.lima.yml up -d lima-db
9191

9292
kathmandu-init:
9393
docker-compose -f docker-compose.kathmandu.yml up -d kathmandu-db
@@ -96,7 +96,7 @@ kathmandu-init:
9696
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db createdb -U tzkt -T template0 tzkt_db
9797
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db apt update
9898
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db apt install -y wget
99-
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db wget "https://snapshots.tzkt.io/tzkt_v1.10_kathmandunet.backup" -O tzkt_db.backup
99+
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db wget "https://snapshots.tzkt.io/tzkt_v1.11_kathmandunet.backup" -O tzkt_db.backup
100100
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db pg_restore -U tzkt -O -x -v -d tzkt_db -e -j 4 tzkt_db.backup
101101
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db rm tzkt_db.backup
102102
docker-compose -f docker-compose.kathmandu.yml exec -T kathmandu-db apt autoremove --purge -y wget

README.md

+24-25
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ make stop
3939

4040
## Installation (from source)
4141

42-
This is the preferred way, because you have more control over each TzKT component (database, indexer, API). This guide is for Ubuntu 20.04, but if you are using a different OS, the installation process will probably differ only in the "Install packages" step.
42+
This is the preferred way, because you have more control over each TzKT component (database, indexer, API). This guide is for Ubuntu 22.04, but if you are using a different OS, the installation process will probably differ only in the "Install packages" step.
4343

4444
### Install packages
4545

@@ -50,25 +50,22 @@ sudo apt update
5050
sudo apt install git
5151
````
5252

53-
#### Install .NET 5.0 SDK
53+
#### Install .NET
5454

5555
````
56-
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
56+
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
5757
sudo dpkg -i packages-microsoft-prod.deb
58+
rm packages-microsoft-prod.deb
5859
5960
sudo apt update
60-
sudo apt install -y apt-transport-https
61-
sudo apt update
62-
sudo apt install -y dotnet-sdk-5.0
61+
sudo apt install -y dotnet-sdk-7.0
6362
````
6463

65-
#### Install Postgresql 13
64+
#### Install Postgresql
6665

6766
````
68-
wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
69-
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
7067
sudo apt update
71-
sudo apt -y install postgresql-13 postgresql-client-13
68+
sudo apt -y install postgresql postgresql-contrib
7269
````
7370

7471
## Install Tzkt Indexer and API for mainnet
@@ -89,7 +86,7 @@ postgres=# \q
8986
#### Download fresh snapshot
9087

9188
````c
92-
wget "https://snapshots.tzkt.io/tzkt_v1.10_mainnet.backup" -O /tmp/tzkt_db.backup
89+
wget "https://snapshots.tzkt.io/tzkt_v1.11_mainnet.backup" -O /tmp/tzkt_db.backup
9390
````
9491

9592
#### Restore database from the snapshot
@@ -131,30 +128,30 @@ Like this:
131128
"Diagnostics": false,
132129
"Validation": true
133130
},
134-
135131
"TezosNode": {
136132
"Endpoint": "https://rpc.tzkt.io/mainnet/",
137133
"Timeout": 60
138134
},
139-
140135
"Quotes": {
141136
"Async": true,
142137
"Provider": {
143138
"Name": "TzktQuotes"
144139
}
145140
},
146-
147141
"ConnectionStrings": {
148142
"DefaultConnection": "host=localhost;port=5432;database=tzkt_db;username=tzkt;password=qwerty;command timeout=600;"
149143
},
150-
151144
"HealthChecks": {
152145
"Enabled": true,
153146
"Delay": 10,
154147
"Period": 10,
155148
"FilePath": "sync.health"
156149
},
157-
150+
"Domains": {
151+
"Enabled": false,
152+
"NameRegistry": "KT1GBZmSxmnKJXGMdMLbugPfLyUPmuLSMwKS",
153+
"PeriodSec": 30
154+
},
158155
"TokenMetadata": {
159156
"Enabled": false,
160157
"BatchSize": 100,
@@ -177,7 +174,6 @@ Like this:
177174
}
178175
]
179176
},
180-
181177
"Logging": {
182178
"LogLevel": {
183179
"Default": "Information",
@@ -221,7 +217,7 @@ dotnet Tzkt.Sync.dll
221217
// ....
222218
````
223219

224-
That's it. If you want to run the indexer as a daemon, take a look at this guide: https://docs.microsoft.com/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.1#create-the-service-file.
220+
That's it. If you want to run the indexer as a daemon, take a look at this guide: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-7.0#create-the-service-file.
225221

226222
### Build, configure and run Tzkt API for the mainnet indexer
227223

@@ -245,17 +241,20 @@ Like this:
245241
"Cache": {
246242
"LoadRate": 0.75,
247243
"MaxAccounts": 32000
244+
},
245+
"ResponseCache": {
246+
"CacheSize": 256
248247
},
249-
250248
"Websocket": {
251249
"Enabled": true,
252250
"MaxConnections": 1000,
253251
"MaxOperationSubscriptions": 50,
254252
"MaxBigMapSubscriptions": 50,
253+
"MaxEventSubscriptions": 50,
255254
"MaxAccountsSubscriptions": 50,
255+
"MaxTokenBalancesSubscriptions": 50,
256256
"MaxTokenTransfersSubscriptions": 50
257257
},
258-
259258
"ConnectionStrings": {
260259
"DefaultConnection": "host=localhost;port=5432;database=tzkt_db;username=tzkt;password=qwerty;command timeout=600;"
261260
},
@@ -321,14 +320,14 @@ That's it. By default API is available on ports 5000 (HTTP) and 5001 (HTTPS). If
321320

322321
In general the steps are the same as for the mainnet, you just need to use different RPC endpoint and DB snapshot. Here are some presets for testnets:
323322
- Ghostnet:
324-
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.10_ghostnet.backup
323+
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.11_ghostnet.backup
325324
- RPC node: https://rpc.tzkt.io/ghostnet/
326-
- Jakartanet:
327-
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.10_jakartanet.backup
328-
- RPC node: https://rpc.tzkt.io/jakartanet/
329325
- Kathmandunet:
330-
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.10_kathmandunet.backup
326+
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.11_kathmandunet.backup
331327
- RPC node: https://rpc.tzkt.io/kathmandunet/
328+
- Limanet:
329+
- Snapshot: https://snapshots.tzkt.io/tzkt_v1.11_limanet.backup
330+
- RPC node: https://rpc.tzkt.io/limanet/
332331

333332
### Testnet installation using docker containers
334333

Tzkt.Api.Tests/Auth/AuthServiceTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System;
1+
using System;
22
using System.Linq;
3-
using System.Threading.Tasks;
4-
using Microsoft.Extensions.Configuration;
3+
using System.Threading.Tasks;
4+
using Microsoft.Extensions.Configuration;
55
using Netezos.Encoding;
66
using Netezos.Keys;
77
using Netezos.Utils;

Tzkt.Api.Tests/Tzkt.Api.Tests.csproj

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
6-
76
<IsPackable>false</IsPackable>
8-
97
<LangVersion>10</LangVersion>
8+
<AssemblyVersion>1.11.0</AssemblyVersion>
109
</PropertyGroup>
1110

1211
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
12+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
1514
<PackageReference Include="xunit" Version="2.4.2" />
1615
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1716
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1817
<PrivateAssets>all</PrivateAssets>
1918
</PackageReference>
20-
<PackageReference Include="coverlet.collector" Version="3.1.2">
19+
<PackageReference Include="coverlet.collector" Version="3.2.0">
2120
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2221
<PrivateAssets>all</PrivateAssets>
2322
</PackageReference>

Tzkt.Api/Controllers/AccountsController.cs

+14-12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public AccountsController(AccountRepository accounts, BalanceHistoryRepository h
3939
/// Returns a list of accounts.
4040
/// </remarks>
4141
/// <param name="id">Filters by internal id.</param>
42+
/// <param name="address">Filters by address.</param>
4243
/// <param name="type">Filters accounts by type (`user`, `delegate`, `contract`, `ghost`).</param>
4344
/// <param name="kind">Filters accounts by contract kind (`delegator_contract` or `smart_contract`)</param>
4445
/// <param name="delegate">Filters accounts by delegate. Allowed fields for `.eqx` mode: none.</param>
@@ -53,6 +54,7 @@ public AccountsController(AccountRepository accounts, BalanceHistoryRepository h
5354
[HttpGet]
5455
public async Task<ActionResult<IEnumerable<Account>>> Get(
5556
Int32Parameter id,
57+
AddressParameter address,
5658
AccountTypeParameter type,
5759
ContractKindParameter kind,
5860
AccountParameter @delegate,
@@ -87,7 +89,7 @@ public async Task<ActionResult<IEnumerable<Account>>> Get(
8789
#endregion
8890

8991
var query = ResponseCacheService.BuildKey(Request.Path.Value,
90-
("id", id), ("type", type), ("kind", kind), ("delegate", @delegate), ("balance", balance), ("staked", staked),
92+
("id", id), ("address", address), ("type", type), ("kind", kind), ("delegate", @delegate), ("balance", balance), ("staked", staked),
9193
("lastActivity", lastActivity), ("select", select), ("sort", sort), ("offset", offset), ("limit", limit));
9294

9395
if (ResponseCache.TryGet(query, out var cached))
@@ -96,25 +98,25 @@ public async Task<ActionResult<IEnumerable<Account>>> Get(
9698
object res;
9799
if (select == null)
98100
{
99-
res = await Accounts.Get(id, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit);
101+
res = await Accounts.Get(id, address, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit);
100102
}
101103
else if (select.Values != null)
102104
{
103105
if (select.Values.Length == 1)
104-
res = await Accounts.Get(id, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Values[0]);
106+
res = await Accounts.Get(id, address, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Values[0]);
105107
else
106-
res = await Accounts.Get(id, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Values);
108+
res = await Accounts.Get(id, address, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Values);
107109
}
108110
else
109111
{
110112
if (select.Fields.Length == 1)
111-
res = await Accounts.Get(id, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Fields[0]);
113+
res = await Accounts.Get(id, address, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Fields[0]);
112114
else
113115
{
114116
res = new SelectionResponse
115117
{
116118
Cols = select.Fields,
117-
Rows = await Accounts.Get(id, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Fields)
119+
Rows = await Accounts.Get(id, address, type, kind, @delegate, balance, staked, lastActivity, sort, offset, limit, select.Fields)
118120
};
119121
}
120122
}
@@ -276,9 +278,9 @@ public async Task<ActionResult<IEnumerable<Delegator>>> GetDelegators(
276278
/// <param name="address">Account address (starting with tz or KT)</param>
277279
/// <param name="type">Comma separated list of operation types to return (`endorsement`, `preendorsement`, `ballot`, `proposal`, `activation`, `double_baking`,
278280
/// `double_endorsing`, `double_preendorsing`, `nonce_revelation`, `vdf_revelation`, `delegation`, `origination`, `transaction`, `reveal`, `register_constant`,
279-
/// `set_deposits_limit`, `increase_paid_storage`, 'tx_rollup_origination', 'tx_rollup_submit_batch', 'tx_rollup_commit', 'tx_rollup_return_bond',
280-
/// 'tx_rollup_finalize_commitment', 'tx_rollup_remove_commitment', 'tx_rollup_rejection', 'tx_rollup_dispatch_tickets', 'transfer_ticket', `migration`,
281-
/// `revelation_penalty`, `baking`, `endorsing_reward`). If not specified then the default set will be returned.</param>
281+
/// `set_deposits_limit`, `increase_paid_storage`, `tx_rollup_origination`, `tx_rollup_submit_batch`, `tx_rollup_commit`, `tx_rollup_return_bond`,
282+
/// `tx_rollup_finalize_commitment`, `tx_rollup_remove_commitment`, `tx_rollup_rejection`, `tx_rollup_dispatch_tickets`, `transfer_ticket`, `migration`,
283+
/// `update_consensus_key`, `drain_delegate`, `revelation_penalty`, `baking`, `endorsing_reward`). If not specified then the default set will be returned.</param>
282284
/// <param name="initiator">Filters transactions, delegations and originations by initiator. Allowed fields for `.eqx` mode: none.</param>
283285
/// <param name="sender">Filters transactions, delegations, originations, reveals and seed nonce revelations by sender. Allowed fields for `.eqx` mode: none.</param>
284286
/// <param name="target">Filters transactions by target. Allowed fields for `.eqx` mode: none.</param>
@@ -566,7 +568,7 @@ public async Task<ActionResult<long>> GetBalanceAtDate(
566568
if (ResponseCache.TryGet(query, out var cached))
567569
return this.Bytes(cached);
568570

569-
var res = await History.Get(address, datetime.DateTime);
571+
var res = await History.Get(address, datetime.UtcDateTime);
570572
cached = ResponseCache.Set(query, res);
571573
return this.Bytes(cached);
572574
}
@@ -704,8 +706,8 @@ public async Task<ActionResult> GetBalanceReport(
704706
};
705707
#endregion
706708

707-
var _from = from?.DateTime ?? DateTime.MinValue;
708-
var _to = to?.DateTime ?? DateTime.MaxValue;
709+
var _from = (from ?? DateTimeOffset.MinValue).UtcDateTime;
710+
var _to = (to ?? DateTimeOffset.MaxValue).UtcDateTime;
709711

710712
var stream = new MemoryStream();
711713
var csv = new StreamWriter(stream);

Tzkt.Api/Controllers/BlocksController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public Task<Block> GetByDate(
218218
MichelineFormat micheline = MichelineFormat.Json,
219219
Symbols quote = Symbols.None)
220220
{
221-
var level = Time.FindLevel(timestamp.DateTime, SearchMode.ExactOrLower);
221+
var level = Time.FindLevel(timestamp.UtcDateTime, SearchMode.ExactOrLower);
222222
return Blocks.Get(level, operations, micheline, quote);
223223
}
224224

@@ -233,7 +233,7 @@ public Task<Block> GetByDate(
233233
[HttpGet("{timestamp:DateTime}/level")]
234234
public int GetByDate(DateTimeOffset timestamp)
235235
{
236-
return Time.FindLevel(timestamp.DateTime, SearchMode.ExactOrLower);
236+
return Time.FindLevel(timestamp.UtcDateTime, SearchMode.ExactOrLower);
237237
}
238238

239239
// BCD bootstrap

0 commit comments

Comments
 (0)