Skip to content

Commit 9c05f59

Browse files
committed
Release v2.0.0-alpha.1
1 parent 02a181a commit 9c05f59

22 files changed

+142
-92
lines changed

.github/e2e/gcp-pubsub-10-blocks.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: ${TEST_NAME}
6+
data:
7+
daemon.toml: |-
8+
[source]
9+
type = "N2N"
10+
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
11+
magic = "mainnet"
12+
13+
[source.finalize]
14+
max_block_quantity = 10
15+
16+
[source.intersect]
17+
type = "Point"
18+
value = [50030552, "5a091e9831bc0fcd6e6bdb2877036bb260abb4e19195517e4153fb041f956df5"]
19+
20+
[sink]
21+
type = "GcpPubSub"
22+
topic = "oura-e2e"
23+
---
24+
apiVersion: batch/v1
25+
kind: Job
26+
metadata:
27+
name: ${TEST_NAME}
28+
labels:
29+
app: ${TEST_NAME}
30+
spec:
31+
backoffLimit: 1
32+
template:
33+
metadata:
34+
labels:
35+
app: ${TEST_NAME}
36+
spec:
37+
restartPolicy: "Never"
38+
serviceAccount: test
39+
serviceAccountName: test
40+
containers:
41+
- name: main
42+
image: ${TARGET_IMAGE}
43+
env:
44+
- name: "RUST_LOG"
45+
value: "warn"
46+
- name: ""
47+
resources:
48+
requests:
49+
memory: 100Mi
50+
cpu: 50m
51+
limits:
52+
memory: 500Mi
53+
cpu: 200m
54+
args:
55+
- "daemon"
56+
volumeMounts:
57+
- mountPath: /etc/oura
58+
name: oura-config
59+
volumes:
60+
- name: oura-config
61+
configMap:
62+
name: ${TEST_NAME}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"type": "service_account",
3+
"project_id": "teak-perigee-375701",
4+
"private_key_id": "90625f60f360ff18381e6b667fd974bf3ab3045f",
5+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAA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CKfC\nSgLl3D4HNQKBgQCEvtvvbTvK++irbB4+EOz6RNxbwo09fWysR9WcnnawbQ4DbeVo\n3/WEG93u9uZ5S0ehZBKv6xmktRApIOLsdUoDu0gRvNLI8FKTOJTDYSvgYPHeGxoB\ntv6HWcW7cF/ONHb3YUCrpwcHhDLvFB2sjfHjuZ6cIyanUWTBGyaaTiWc+QKBgHjj\n3J/mKeWaovnxlYz5zCaR4rl3ZhCY8ofEDaSTyEB0x2MYGNFZ+9L1JZVJucMt/tGs\nI5ic3VB20+fj5FXkaMf9C6vzwqenwUDIZ/HTPV27JGdWz9inIjPv+0P30s3ZGdec\ndscnd7qbRIX1QkCooPg5hGo9PVhbUb3b6167y0cBAoGBANXIgiDKc3moOJfI73t+\nuqZ55pBfiX8QaaTqSWdX+pNQemIp97UfW6vPG9gpsEZswUkwSNQjH5111ePLE0te\nK7dqqCuEMK7IIHGaMo48wZ8Et3tbWoLxpJu5iCaqCotxQ6ovUJAHPmb0ab42CxIV\n8vW11v5CXVCWa3f9YnMWfdqF\n-----END PRIVATE KEY-----\n",
6+
"client_email": "[email protected]",
7+
"client_id": "105764970135434041671",
8+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
9+
"token_uri": "https://oauth2.googleapis.com/token",
10+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/oura-e2e%40teak-perigee-375701.iam.gserviceaccount.com"
12+
}

.github/workflows/release.yml

+6
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ jobs:
131131
uses: docker/metadata-action@v4
132132
with:
133133
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
134+
tags: |
135+
type=raw,value=latest,enable={{is_default_branch}}
136+
type=semver,pattern=v{{major}}
137+
type=semver,pattern=v{{major}}.{{minor}}
138+
type=semver,pattern=v{{version}}
134139
135140
- name: Login to DockerHub
136141
uses: docker/login-action@v2
@@ -182,3 +187,4 @@ jobs:
182187
with:
183188
files: oura-*/oura-*
184189
body_path: RELEASE.md
190+
draft: true

.github/workflows/validate.yml

+2-19
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
command: test
5656
args: --all-features
5757

58-
lints-rust:
58+
lints:
5959
name: Lint Rust
6060
runs-on: ubuntu-latest
6161
steps:
@@ -80,21 +80,4 @@ jobs:
8080
uses: actions-rs/cargo@v1
8181
with:
8282
command: clippy
83-
args: --all-features -- -D warnings
84-
85-
lints-others:
86-
name: Lint Support Files
87-
runs-on: ubuntu-latest
88-
steps:
89-
- name: Checkout sources
90-
uses: actions/checkout@v3
91-
92-
- name: Check EditorConfig Compliance
93-
uses: editorconfig-checker/action-editorconfig-checker@v1
94-
95-
lints:
96-
name: Lint Rust & Support Files
97-
runs-on: ubuntu-latest
98-
needs: [lints-rust, lints-others]
99-
steps:
100-
- run: echo "All lints successful"
83+
args: --all-features --all-targets -- -D warnings

Cargo.lock

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

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oura"
33
description = "The tail of Cardano"
4-
version = "1.8.1"
4+
version = "2.0.0-alpha.1"
55
edition = "2021"
66
repository = "https://github.com/txpipe/oura"
77
homepage = "https://github.com/txpipe/oura"
@@ -13,8 +13,8 @@ authors = ["Santiago Carmuega <[email protected]>"]
1313

1414
[dependencies]
1515
# pallas = "0.18.0"
16-
# pallas = { git = "https://github.com/txpipe/pallas" }
17-
pallas = { path = "../pallas/pallas" }
16+
pallas = { git = "https://github.com/txpipe/pallas" }
17+
# pallas = { path = "../pallas/pallas" }
1818
# gasket = { path = "../../construkts/gasket-rs" }
1919
gasket = { git = "https://github.com/construkts/gasket-rs.git" }
2020
hex = "0.4.3"

src/bin/oura/console.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ use gasket::{metrics::Reading, runtime::Tether};
77
use lazy_static::{__Deref, lazy_static};
88
use log::Log;
99

10-
#[derive(clap::ValueEnum, Clone)]
10+
#[derive(clap::ValueEnum, Clone, Default)]
1111
pub enum Mode {
1212
/// shows progress as a plain sequence of logs
13+
#[default]
1314
Plain,
1415
/// shows aggregated progress and metrics
15-
TUI,
16-
}
17-
18-
impl Default for Mode {
19-
fn default() -> Self {
20-
Mode::Plain
21-
}
16+
Tui,
2217
}
2318

2419
struct TuiConsole {
@@ -39,8 +34,7 @@ impl TuiConsole {
3934
indicatif::ProgressBar::new_spinner().with_style(
4035
indicatif::ProgressStyle::default_spinner()
4136
.template(&format!(
42-
"{{spinner}} {:<20} {{msg:<20}} {{pos:>8}} | {{per_sec}}",
43-
name
37+
"{{spinner}} {name:<20} {{msg:<20}} {{pos:>8}} | {{per_sec}}"
4438
))
4539
.unwrap(),
4640
),
@@ -195,7 +189,7 @@ lazy_static! {
195189

196190
pub fn initialize(mode: &Option<Mode>) {
197191
match mode {
198-
Some(Mode::TUI) => log::set_logger(TUI_CONSOLE.deref())
192+
Some(Mode::Tui) => log::set_logger(TUI_CONSOLE.deref())
199193
.map(|_| log::set_max_level(log::LevelFilter::Info))
200194
.unwrap(),
201195
_ => tracing::subscriber::set_global_default(
@@ -209,7 +203,7 @@ pub fn initialize(mode: &Option<Mode>) {
209203

210204
pub fn refresh<'a>(mode: &Option<Mode>, tethers: impl Iterator<Item = &'a Tether>) {
211205
match mode {
212-
Some(Mode::TUI) => TUI_CONSOLE.refresh(tethers),
206+
Some(Mode::Tui) => TUI_CONSOLE.refresh(tethers),
213207
_ => PLAIN_CONSOLE.refresh(tethers),
214208
}
215209
}

src/bin/oura/daemon.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use clap;
21
use gasket::runtime::Tether;
32
use oura::{filters, framework::*, sinks, sources};
43
use pallas::{ledger::traverse::wellknown::GenesisValues, network::upstream::cursor::Cursor};
@@ -56,10 +55,9 @@ impl Runtime {
5655

5756
fn should_stop(&self) -> bool {
5857
self.all_tethers().any(|tether| match tether.check_state() {
59-
gasket::runtime::TetherState::Alive(x) => match x {
60-
gasket::runtime::StageState::StandBy => true,
61-
_ => false,
62-
},
58+
gasket::runtime::TetherState::Alive(x) => {
59+
matches!(x, gasket::runtime::StageState::StandBy)
60+
}
6361
_ => true,
6462
})
6563
}
@@ -134,11 +132,11 @@ fn bootstrap(
134132
pub fn run(args: &Args) -> Result<(), Error> {
135133
console::initialize(&args.console);
136134

137-
let config = ConfigRoot::new(&args.config).map_err(|err| Error::config(err))?;
135+
let config = ConfigRoot::new(&args.config).map_err(Error::config)?;
138136

139-
let chain = config.chain.unwrap_or_default().into();
137+
let chain = config.chain.unwrap_or_default();
140138
let cursor = Cursor::new(config.intersect.into());
141-
let error_policy = config.policy.unwrap_or_default().into();
139+
let error_policy = config.policy.unwrap_or_default();
142140
let finalize = config.finalize;
143141
let current_dir = std::env::current_dir().unwrap();
144142

src/filters/deno/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
//! A mapper with custom logic from using the Deno runtime
22
3-
use deno_core::{op, Extension, ModuleSpecifier, OpState, Snapshot};
3+
use deno_core::{op, Extension, ModuleSpecifier, OpState};
44
use deno_runtime::permissions::PermissionsContainer;
55
use deno_runtime::worker::{MainWorker as DenoWorker, WorkerOptions};
66
use deno_runtime::BootstrapOptions;
77
use gasket::{messaging::*, runtime::Tether};
88
use serde::Deserialize;
99
use serde_json::json;
10-
use std::ops::Deref;
11-
use std::ops::DerefMut;
1210
use std::path::PathBuf;
1311
use tokio::runtime::Runtime as TokioRuntime;
14-
use tracing::{debug, trace};
12+
use tracing::trace;
1513

1614
use crate::framework::*;
1715

@@ -151,7 +149,7 @@ impl gasket::runtime::Worker for Worker {
151149
}
152150
}
153151
}
154-
ChainEvent::Undo(p, r) => todo!(),
152+
ChainEvent::Undo(..) => todo!(),
155153
ChainEvent::Reset(p) => {
156154
self.output.send(ChainEvent::reset(p))?;
157155
}
@@ -189,7 +187,7 @@ pub struct Config {
189187
}
190188

191189
impl Config {
192-
pub fn bootstrapper(self, ctx: &Context) -> Result<Bootstrapper, Error> {
190+
pub fn bootstrapper(self, _ctx: &Context) -> Result<Bootstrapper, Error> {
193191
// let main_module =
194192
// deno_core::resolve_path(&self.main_module,
195193
// &ctx.current_dir).map_err(Error::config)?;

src/filters/dsl.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ impl Predicate {
214214
}
215215
}
216216

217-
#[derive(Default)]
218217
struct Worker {
219218
msg_count: gasket::metrics::Counter,
219+
predicate: Predicate,
220220
input: FilterInputPort,
221221
output: FilterOutputPort,
222222
}
@@ -231,9 +231,14 @@ impl gasket::runtime::Worker for Worker {
231231
fn work(&mut self) -> gasket::runtime::WorkResult {
232232
let msg = self.input.recv_or_idle()?;
233233

234-
todo!();
235-
236-
self.output.send(msg)?;
234+
match &msg.payload {
235+
ChainEvent::Apply(_, Record::OuraV1Event(x)) => {
236+
if self.predicate.event_matches(x) {
237+
self.output.send(msg)?;
238+
}
239+
}
240+
_ => todo!(),
241+
}
237242

238243
Ok(gasket::runtime::WorkOutcome::Partial)
239244
}
@@ -263,12 +268,17 @@ impl Bootstrapper {
263268

264269
#[derive(Debug, Deserialize)]
265270
pub struct Config {
266-
pub check: Predicate,
271+
pub predicate: Predicate,
267272
}
268273

269274
impl Config {
270-
pub fn bootstrapper(self, ctx: &Context) -> Result<Bootstrapper, Error> {
271-
let worker = Worker::default();
275+
pub fn bootstrapper(self, _ctx: &Context) -> Result<Bootstrapper, Error> {
276+
let worker = Worker {
277+
predicate: self.predicate,
278+
msg_count: Default::default(),
279+
input: Default::default(),
280+
output: Default::default(),
281+
};
272282

273283
Ok(Bootstrapper(worker))
274284
}

0 commit comments

Comments
 (0)