Skip to content

Commit b5111a2

Browse files
akherchaEvolveArt
andauthored
feat: SSE route for get_entry + Lint + Fixed tests + Empty responses for history (#177)
* feat(sse_routes): * feat(sse_routes): SSE route * feat(sse_routes): interval * feat(sse_routes): * feat(sse_routes): Stream entries * feat(sse_routes): 💀 Fixed all clippy errors * feat(sse_routes): * feat(sse_routes): toml * feat(sse_routes): fixed E2E setup * feat(sse_routes): Fixed test * feat(sse_routes): Restrict SSE streams to median + no routing * feat(sse_routes): Added 1s median aggregation * feat(sse_routes): * feat(sse_routes): Return an empty array for empty history * feat(sse_routes): interval error * feat(sse_routes): fixes from review * some refacto * feat(sse_routes): Added 5s interval + Fix 1s --------- Co-authored-by: 0xevolve <Artevolve@yahoo.com>
1 parent 2cb97c5 commit b5111a2

File tree

98 files changed

+1257
-779
lines changed

Some content is hidden

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

98 files changed

+1257
-779
lines changed

Cargo.lock

+73-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+36-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,46 @@ edition = "2021"
1515
repository = "https://github.com/astraly-labs/pragma-node/"
1616
authors = ["Pragma Labs <support@pragma.build>"]
1717

18+
[workspace.lints]
19+
rust.missing_debug_implementations = "allow"
20+
rust.unreachable_pub = "warn"
21+
rust.unused_must_use = "deny"
22+
rust.rust_2018_idioms = { level = "deny", priority = -1 }
23+
rustdoc.all = "warn"
24+
25+
[workspace.lints.clippy]
26+
# all lints that are on by default (correctness, suspicious, style, complexity, perf)
27+
all = { level = "warn", priority = -1 }
28+
29+
# new lints that are still under development
30+
nursery = { level = "warn", priority = -1 }
31+
# avoid lints that are too pedantic
32+
future_not_send = "allow"
33+
fallible_impl_from = "allow"
34+
35+
# lints which are rather strict or have occasional false positives
36+
pedantic = { level = "warn", priority = -1 }
37+
# avoid lints that are too pedantic
38+
must_use_candidate = "allow"
39+
cast_possible_truncation = "allow"
40+
cast_precision_loss = "allow"
41+
cast_sign_loss = "allow"
42+
missing_errors_doc = "allow"
43+
missing_panics_doc = "allow"
44+
default_trait_access = "allow"
45+
module_name_repetitions = "allow"
46+
needless_pass_by_value = "allow"
47+
or_fun_call = "allow"
48+
redundant_pub_crate = "allow"
49+
1850
[workspace.dependencies]
1951
color-eyre = "0.6"
2052
aws-config = { version = "1.5.1", features = ["behavior-version-latest"] }
2153
aws-sdk-secretsmanager = "1.32.0"
2254
axum = { version = "0.8", features = ["macros", "ws", "tokio"] }
23-
axum-extra = { version = "0.9.2" }
55+
axum-extra = { version = "0.10.0", features = ["typed-header"] }
2456
axum-macros = "0.5"
57+
async-trait = "0.1.86"
2558
cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.4.5", features = [
2659
"abigen-rs",
2760
] }
@@ -37,6 +70,8 @@ bigdecimal = { version = "0.4.1", features = ["serde"] }
3770
diesel_migrations = "2"
3871
deadpool-diesel = { version = "0.4", features = ["postgres"] }
3972
futures-util = "0.3.30"
73+
futures = "0.3.31"
74+
tokio-stream = "0.1.17"
4075
governor = { version = "0.6.0" }
4176
dotenvy = "0.15.7"
4277
envy = "0.4.2"

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
21
init-kafka-topics:
32
docker exec -it pragma-kafka "kafka-topics" "--bootstrap-server" "localhost:9092" "--topic" "pragma-data" "--create" "--partitions" "1" "--replication-factor" "1" || true
43
docker exec -it pragma-kafka "kafka-topics" "--bootstrap-server" "localhost:9092" "--topic" "__consumer_offsets" "--create" "--partitions" "1" "--replication-factor" "1" || true
4+
55
format:
66
cargo fmt -- --check
77
cargo clippy --locked --all-targets --all-features -- -D warnings --no-deps
88
cargo clippy --tests --no-deps -- -D warnings
9+
10+
test:
11+
cargo nextest run

infra/pragma-node/postgres_migrations/01-init.sql

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ CREATE TABLE publishers (
118118
name VARCHAR NOT NULL,
119119
website_url VARCHAR NOT NULL,
120120
mainnet_address VARCHAR,
121+
testnet_address VARCHAR,
121122
publisher_type INTEGER NOT NULL CHECK (publisher_type IN (0, 1)) -- 0 = first party, 1 = 3rd party
122123
);
123124

pragma-common/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ description = "Common utilities and types for Pragma SDKs"
99
readme = "README.md"
1010
keywords = ["pragma", "sdk", "consumer", "data", "feeds"]
1111

12-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12+
[lints]
13+
workspace = true
1314

1415
[dependencies]
1516
axum = { workspace = true }

pragma-common/src/signing/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ pub trait Signable {
3939
pub fn sign_data(signer: &SigningKey, data: &impl Signable) -> Result<String, SignerError> {
4040
let hash_to_sign = data.try_get_hash()?;
4141
let signature = signer.sign(&hash_to_sign)?;
42-
Ok(format!("0x{:}", signature))
42+
Ok(format!("0x{signature:}"))
4343
}
4444

4545
/// Assert that a new entries request is correctly signed
4646
/// by the publisher.
4747
/// If it is, we return the signature.
48+
#[allow(clippy::trait_duplication_in_bounds)]
4849
pub fn assert_request_signature_is_valid<R, E>(
4950
new_entries_request: &R,
5051
publisher_account: &Felt,
@@ -65,6 +66,7 @@ where
6566
/// Assert that a request (passed with the request for creating new
6667
/// entries) is correctly signed by the publisher and in a valid format.
6768
/// Returns the signature if it is correct.
69+
#[allow(clippy::trait_duplication_in_bounds)]
6870
fn assert_signature_is_valid<R, E>(
6971
new_entries_request: &R,
7072
account_address: &Felt,

0 commit comments

Comments
 (0)