Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(sentinel): v2 architecture proposal #2500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 257 additions & 54 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ members = [
"near/near-ibc-tests",

"drip",
"sentinel",
]

[workspace.package]
Expand Down Expand Up @@ -153,7 +154,7 @@ bitvec = { version = "1.0.1", default-features = false }
borsh = { version = "1.5.0", default-features = false }
bytes = { version = "1.2.1", default-features = false }
chrono = { version = "0.4.26", default-features = false }
clap = { version = "4.3.0", default-features = false, features = ["std"] } # clap has a fake std feature that is required to be enabled by default
clap = { version = "4.5.9", default-features = false, features = ["std"] } # clap has a fake std feature that is required to be enabled by default
color-eyre = { version = "0.6.2", default-features = false }
cosmwasm-schema = { version = "1.5", default-features = false }
cosmwasm-std = { version = "1.5", default-features = false }
Expand Down
30 changes: 30 additions & 0 deletions sentinel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
edition.workspace = true
license-file.workspace = true
name = "sentinel"
repository.workspace = true
version = "0.1.0"

[dependencies]
anyhow = "1.0.86"
async-trait = "0.1.81"
chrono = { workspace = true, features = ["serde", "std", "now"] }
clap = { workspace = true, features = ["derive", "usage", "help", "std"] }
either = { workspace = true, features = ["serde"] }
erased-serde = "0.4.5"
futures = { workspace = true, features = ["std"] }
graphql_client = { version = "0.14.0", features = ["reqwest"] }
json_value_merge = "2.0.0"
regex = "1.10.5"
reqwest.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-timer = "0.2.13"
tracing-subscriber = { workspace = true, features = ["env-filter"] }
tracing.workspace = true
typetag = "0.2.16"
url = { version = "2.5.2", features = ["serde"] }

[lints]
workspace = true
15 changes: 15 additions & 0 deletions sentinel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Sentinel

Sentinels are e2e tests which can continiously run against production environments to ensure that
Union is fully functional.

## Usage

Each sentinel has a sane default configuration, as well as that their configuration can be (partially) overridden by
passing a JSON object to the run command

```bash
cargo run -- run --overrides '{"check_ibc_trace_latency": {"limit": 10}}' # change the limit config of check_ibc_trace_latency, but leave everything else identical.
```

Individual tests can be run by passing a regex to filter, which cause only the matches to be run.
60 changes: 60 additions & 0 deletions sentinel/queries.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
query LastTransfersLimit($limit: Int!) {
v0_transfers(limit: $limit, order_by: {source_timestamp: desc}) {
assets
destination_block_hash
destination_chain_id
destination_channel_id
destination_connection_id
destination_data
destination_height
destination_id
destination_json
destination_port
destination_sequence
destination_timeout_timestamp
destination_timestamp
destination_transaction_hash
destination_transaction_index
is_initiating
normalized_receiver
normalized_sender
packet_data_jsonb
pfm_destination_channel
pfm_destination_port
pfm_recv_sequence
pfm_sent_sequence
pfm_source_channel
pfm_source_port
receiver
sender
source_block_hash
source_chain_id
source_channel_id
source_connection_id
source_data
source_height
source_id
source_json
source_port
source_sequence
source_timeout_timestamp
source_timestamp
source_transaction_hash
source_transaction_index
status
transaction_hash
}
}

query LastTransfersWithTraces($limit: Int!, $source_time: timestamptz!) {
v0_transfers(limit: $limit, order_by: {source_timestamp: desc}, where: {source_timestamp: {_lte: $source_time}}) {
source_timestamp
traces(order_by: {timestamp: asc}) {
chain_id
initiating_transaction_hash
timestamp
transaction_hash
type
}
}
}
Loading