Skip to content

Commit c8e95b6

Browse files
authored
Merge branch 'main' into refactor/chain-follower-decoder
2 parents 4fa26f3 + ad71131 commit c8e95b6

File tree

368 files changed

+14981
-2379
lines changed

Some content is hidden

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

368 files changed

+14981
-2379
lines changed

.config/dictionaries/project.dic

+20-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ dbschema
6464
dbsync
6565
Deleg
6666
delegators
67+
devnet
6768
DIND
6869
dockerhub
6970
Dominik
@@ -123,6 +124,7 @@ Jörmungandr
123124
jsonschema
124125
junitreport
125126
junitxml
127+
Justfile
126128
keychains
127129
Keyhash
128130
keyserver
@@ -180,6 +182,7 @@ oneshot
180182
openapi
181183
opentelemetry
182184
overprovisioned
185+
Pbkdf2
183186
pbxproj
184187
Pdart
185188
permissionless
@@ -204,6 +207,7 @@ pubspec
204207
pytest
205208
qrcode
206209
rapidoc
210+
ratelimit
207211
redoc
208212
reloadable
209213
Replayability
@@ -271,6 +275,7 @@ unchunk
271275
Unlogged
272276
unmanaged
273277
Unstaked
278+
upskilling
274279
UTXO
275280
Utxos
276281
varint
@@ -287,6 +292,7 @@ wallclock
287292
wasmtime
288293
Wconditional
289294
Werror
295+
Wireframes
290296
Wmissing
291297
Wnullable
292298
Woverlength
@@ -300,4 +306,17 @@ xctestrun
300306
xcworkspace
301307
xvfb
302308
yoroi
303-
Pbkdf2
309+
Pbkdf2
310+
Embedder
311+
Podspec
312+
podspec
313+
ARCHS
314+
iphonesimulator
315+
cargokit
316+
SRCROOT
317+
libcatalyst
318+
staticlib
319+
addrof
320+
Lifetimeable
321+
cbindgen
322+
mocktail

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ permissions:
1414

1515
jobs:
1616
ci:
17-
uses: input-output-hk/catalyst-forge/.github/workflows/ci.yml@ci/v1.2.1
17+
uses: input-output-hk/catalyst-forge/.github/workflows/ci.yml@ci/v1.2.2
1818
with:
19-
forge_version: 0.4.0
19+
forge_version: 0.5.0
2020

2121
test_reporting:
2222
if: always()

.github/workflows/generate-allure-report.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,40 @@ jobs:
2626
- uses: actions/checkout@v4
2727

2828
- name: Install Forge
29-
uses: input-output-hk/catalyst-forge/actions/install@ci/v1.2.1
29+
uses: input-output-hk/catalyst-forge/actions/install@ci/v1.2.2
3030
with:
31-
version: 0.4.0
31+
version: 0.5.0
3232
if: always()
3333

3434
- name: Setup CI
35-
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.2.1
35+
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.2.2
3636

3737
- name: Get catalyst gateway unit test report
38-
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.1
38+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.2
3939
if: always()
4040
continue-on-error: true
4141
with:
4242
command: run
4343
args: ./catalyst-gateway+build
4444

4545
- name: Get schemathesis test report
46-
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.1
46+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.2
4747
if: always()
4848
continue-on-error: true
4949
with:
5050
command: run
5151
args: ./catalyst-gateway/tests/schemathesis_tests+test-fuzzer-api
5252

5353
- name: Get flutter unit test report
54-
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.1
54+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.2
5555
if: always()
5656
continue-on-error: true
5757
with:
5858
command: run
5959
args: ./catalyst_voices+test-unit
6060

6161
- name: Get python api test report
62-
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.1
62+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.2.2
6363
if: always()
6464
continue-on-error: true
6565
with:

.github/workflows/semantic_pull_request.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
flutter
2525
flutter/catalyst_cardano
2626
flutter/catalyst_compression
27+
flutter/catalyst_key_derivation
2728
utils
2829
docs
2930
general

.markdownlint-cli2.jsonc

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"catalyst-gateway/target/**",
1313
"CHANGELOG.md",
1414
"catalyst_voices_packages/**/CHANGELOG.md",
15+
"catalyst_voices_packages/**/cargokit/**",
1516
"catalyst_voices/macos/Pods/**",
1617
"**/node_modules/**",
1718
"**/.dart_tool/**"

.vscode/settings.recommended.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"flutter",
4444
"flutter/catalyst_cardano",
4545
"flutter/catalyst_compression",
46+
"flutter/catalyst_key_derivation",
4647
"utils",
4748
"docs",
4849
"general"

Earthfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.18 AS mdlint-ci
4-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.18 AS cspell-ci
5-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.18 AS postgresql-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.22 AS mdlint-ci
4+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.22 AS cspell-ci
5+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.22 AS postgresql-ci
66

77
FROM debian:stable-slim
88

catalyst-gateway/.cargo/config.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ lint-vscode = "clippy --message-format=json-diagnostic-rendered-ansi --all-targe
7777

7878
docs = "doc --release --no-deps --document-private-items --bins --lib --examples"
7979
# nightly docs build broken... when they are'nt we can enable these docs... --unit-graph --timings=html,json -Z unstable-options"
80-
testunit = "nextest run --release --bins --lib --tests --benches --no-fail-fast -P ci"
81-
testcov = "llvm-cov nextest --release --bins --lib --tests --benches --no-fail-fast -P ci"
80+
testunit = "nextest run --release --bins --lib --tests --no-fail-fast -P ci"
81+
testcov = "llvm-cov nextest --release --bins --lib --tests --no-fail-fast -P ci"
8282
testdocs = "test --doc --release"
8383

8484
# Rust formatting, MUST be run with +nightly
@@ -90,4 +90,4 @@ quiet = false # whether cargo output is quiet
9090
verbose = false # whether cargo provides verbose output
9191
color = "auto" # whether cargo colorizes output use `CARGO_TERM_COLOR="off"` to disable.
9292
progress.when = "never" # whether cargo shows progress bar
93-
progress.width = 80 # width of progress bar
93+
progress.width = 80 # width of progress bar

catalyst-gateway/Earthfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.18 AS rust-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.22 AS rust-ci
44

55
#cspell: words rustfmt toolsets USERARCH stdcfgs
66

@@ -81,7 +81,7 @@ build:
8181
all-hosts-build:
8282
BUILD --platform=linux/amd64 --platform=linux/arm64 +build
8383

84-
# package-cat-gateway : Create a deployable container for catalyst-gateway
84+
# package : Create a deployable container for catalyst-gateway
8585
package:
8686
FROM debian:12.7-slim
8787
WORKDIR /cat-gateway

catalyst-gateway/Justfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pre-push: sync-cfg code-format code-lint license-check
3434
# Make sure we can actually build inside Earthly which needs to happen in CI.
3535
cd .. && earthly ./catalyst-gateway+check
3636
cd .. && earthly ./catalyst-gateway+build
37-
cd .. && earthly ./catalyst-gateway+package-cat-gateway
37+
cd .. && earthly ./catalyst-gateway+package
3838
cd .. && earthly ./catalyst-gateway/tests+test-lint-openapi
3939

4040
# Build Local release build of catalyst gateway

catalyst-gateway/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ or you can build a docker image and run everything with the `docker-compose`.
4040

4141
To build and run docker images follow these steps:
4242

43-
1. Run `earthly +package-cat-gateway` or `earthly +package-cat-gateway-with-preprod-snapshot`
44-
to build a cat-gateway docker image without `preprod-snapshot` or with it.
43+
1. Run `earthly +package` to build a cat-gateway docker image.
4544
2. Run `earthly ./event-db+build` to build an event-db docker image.
4645
3. Run `docker-compose up cat-gateway` to spin up cat-gateway with event-db from already built images.
4746

4847
Note that every time when you are building an image it obsoletes an old image but does not remove it,
49-
so dont forget to cleanup dangling images of the event-db and cat-gateway in your docker environment.
48+
so don't forget to clean up dangling images of the event-db and cat-gateway in your docker environment.
5049

5150
### Rust binary
5251

catalyst-gateway/bin/src/db/event/config/jsonschema/frontend.json

-30
This file was deleted.

catalyst-gateway/bin/src/db/event/config/key.rs

+68-22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use jsonschema::{BasicOutput, Validator};
66
use serde_json::{json, Value};
77
use tracing::error;
88

9+
use crate::utils::schema::{extract_json_schema_for, SCHEMA_VERSION};
10+
911
/// Configuration key
1012
#[derive(Debug, Clone, PartialEq)]
1113
pub(crate) enum ConfigKey {
@@ -24,9 +26,9 @@ impl Display for ConfigKey {
2426
}
2527
}
2628

27-
/// Frontend schema.
28-
static FRONTEND_SCHEMA: LazyLock<Value> =
29-
LazyLock::new(|| load_json_lazy(include_str!("jsonschema/frontend.json")));
29+
/// Frontend schema from API specification.
30+
pub(crate) static FRONTEND_SCHEMA: LazyLock<Value> =
31+
LazyLock::new(|| extract_json_schema_for("FrontendConfig"));
3032

3133
/// Frontend schema validator.
3234
static FRONTEND_SCHEMA_VALIDATOR: LazyLock<Validator> =
@@ -43,28 +45,35 @@ static FRONTEND_IP_DEFAULT: LazyLock<Value> =
4345
/// Helper function to create a JSON validator from a JSON schema.
4446
/// If the schema is invalid, a default JSON validator is created.
4547
fn schema_validator(schema: &Value) -> Validator {
46-
jsonschema::validator_for(schema).unwrap_or_else(|err| {
47-
error!(
48-
id = "schema_validator",
49-
error=?err,
50-
"Error creating JSON validator"
51-
);
52-
53-
// Create a default JSON validator as a fallback
54-
// This should not fail since it is hard coded
55-
#[allow(clippy::expect_used)]
56-
Validator::new(&json!({
57-
"$schema": "http://json-schema.org/draft-07/schema#",
58-
"type": "object"
59-
}))
60-
.expect("Failed to create default JSON validator")
61-
})
48+
Validator::options()
49+
.with_draft(jsonschema::Draft::Draft202012)
50+
.build(schema)
51+
.unwrap_or_else(|err| {
52+
error!(
53+
id="schema_validator",
54+
error=?err,
55+
"Error creating JSON validator"
56+
);
57+
58+
default_validator()
59+
})
60+
}
61+
62+
/// Create a default JSON validator as a fallback
63+
/// This should not fail since it is hard coded
64+
fn default_validator() -> Validator {
65+
#[allow(clippy::expect_used)]
66+
Validator::new(&json!({
67+
"$schema": SCHEMA_VERSION,
68+
"type": "object"
69+
}))
70+
.expect("Failed to create default JSON validator")
6271
}
6372

6473
/// Helper function to convert a JSON string to a JSON value.
6574
fn load_json_lazy(data: &str) -> Value {
6675
serde_json::from_str(data).unwrap_or_else(|err| {
67-
error!(id = "load_json_lazy", error=?err, "Error parsing JSON");
76+
error!(id="load_json_lazy", error=?err, "Error parsing JSON");
6877
json!({})
6978
})
7079
}
@@ -115,15 +124,43 @@ mod tests {
115124
use super::*;
116125

117126
#[test]
118-
fn test_valid_validate() {
127+
fn test_schema_for_schema() {
128+
// Invalid schema
129+
let invalid_schema = json!({
130+
"title": "Invalid Example Schema",
131+
"type": "object",
132+
133+
"properties": {
134+
"invalidProperty": {
135+
"type": "unknownType"
136+
}
137+
},
138+
139+
});
140+
// This should not fail
141+
schema_validator(&invalid_schema);
142+
}
143+
144+
#[test]
145+
fn test_valid_validate_1() {
119146
let value = json!({
120-
"test": "test"
147+
"sentry": {
148+
"dsn": "https://test.com"
149+
}
121150
});
122151
let result = ConfigKey::Frontend.validate(&value);
123152
assert!(result.is_valid());
124153
println!("{:?}", serde_json::to_value(result).unwrap());
125154
}
126155

156+
#[test]
157+
fn test_valid_validate_2() {
158+
let value = json!({});
159+
let result = ConfigKey::Frontend.validate(&value);
160+
assert!(result.is_valid());
161+
println!("{:?}", serde_json::to_value(result).unwrap());
162+
}
163+
127164
#[test]
128165
fn test_invalid_validate() {
129166
let value = json!([]);
@@ -137,4 +174,13 @@ mod tests {
137174
let result = ConfigKey::Frontend.default();
138175
assert!(result.is_object());
139176
}
177+
178+
#[test]
179+
fn test_default_validator() {
180+
let result = std::panic::catch_unwind(|| {
181+
default_validator();
182+
});
183+
// Assert that no panic occurred
184+
assert!(result.is_ok(), "default_validator panicked");
185+
}
140186
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT chain_root
2+
FROM chain_root_for_stake_addr
3+
WHERE stake_addr = :stake_address
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT transaction_id
2+
FROM RBAC509_registration
3+
WHERE chain_root = :chain_root

0 commit comments

Comments
 (0)