Skip to content
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install build requirements
run: |
sudo apt-get update
sudo apt-get install -y \
libcurl4-openssl-dev \
gnupg \
libudev-dev \
libsasl2-dev \
libssl-dev \
libzstd-dev
sudo apt-get satisfy -f -y "protobuf-compiler (>=3.15)"

- uses: Swatinem/rust-cache@v2

- name: cargo fmt
run: cargo fmt --all -- --check

- name: cargo clippy
run: cargo clippy --workspace --all-targets --no-deps -- -D warnings

- name: cargo build
run: cargo build --workspace

- name: cargo test
run: cargo test --workspace -- --test-threads=16
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CLIENT_REST ?= http://127.0.0.1:3030
help:
@echo "Available targets:"
@echo " build - Build all Rust workspace packages"
@echo " check - Build the whole workspace"
@echo " check - Run workspace fmt, clippy, build, and test"
@echo " kafka-up - Start the Kafka/ksqlDB stack"
@echo " kafka-down - Stop and remove the Kafka/ksqlDB stack"
@echo " kafka-ready - Start the stack and initialize stream/table/schema"
Expand All @@ -41,7 +41,10 @@ build:
cargo build -p solana-accountsdb-plugin-kafka

check:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --no-deps -- -D warnings
cargo build --workspace
cargo test --workspace -- --test-threads=16

kafka-up:
$(MAKE) -C kafka-setup up
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ This repo contains the MagicBlock account update pipeline:
- `kafka-setup/`: minimal Kafka/ksqlDB local environment
- `Makefile`: top-level operator entrypoint

## CI Contract

The repository-level CI in `.github/workflows/test.yml` runs the
same workspace checks on every push and pull request:

```sh
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --no-deps -- -D warnings
cargo build --workspace
cargo test --workspace -- --test-threads=16
```
Comment thread
coderabbitai[bot] marked this conversation as resolved.

## Common Root Workflows

- `make build`
Expand Down
4 changes: 3 additions & 1 deletion event-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ fn main() {
println!("cargo:rerun-if-changed=proto/event.proto");

let mut config = prost_build::Config::new();
config.boxed(".blockdaemon.solana.accountsdb_plugin_kafka.types.MessageWrapper");
config.boxed(
".blockdaemon.solana.accountsdb_plugin_kafka.types.MessageWrapper",
);
config.protoc_arg("--experimental_allow_proto3_optional");
config
.compile_protos(&["proto/event.proto"], &["proto/"])
Expand Down
66 changes: 0 additions & 66 deletions geyser-plugin/.github/dependabot.yml

This file was deleted.

62 changes: 0 additions & 62 deletions geyser-plugin/.github/workflows/release.yml

This file was deleted.

55 changes: 0 additions & 55 deletions geyser-plugin/.github/workflows/test.yml

This file was deleted.

28 changes: 21 additions & 7 deletions geyser-plugin/src/account_update_publisher.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use {
crate::{
initial_account_backfill::InitialAccountBackfillHandle, publisher::Publisher,
server::subscriptions::AccountSubscriptions, wire::UpdateAccountEvent,
initial_account_backfill::InitialAccountBackfillHandle,
publisher::Publisher, server::subscriptions::AccountSubscriptions,
wire::UpdateAccountEvent,
},
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError as PluginError, Result as PluginResult,
Expand Down Expand Up @@ -50,7 +51,8 @@ pub fn publish_backfill_account_update(
live_update_seen: bool,
event: UpdateAccountEvent,
) -> PluginResult<AccountUpdatePublishOutcome> {
let decision = should_publish_backfill_account(subs, pubkey, live_update_seen);
let decision =
should_publish_backfill_account(subs, pubkey, live_update_seen);
match decision {
AccountUpdatePublishOutcome::Published => {
publish_raw_account_update(publisher, topic, event)?;
Expand Down Expand Up @@ -117,7 +119,10 @@ fn should_publish_backfill_account(
AccountUpdatePublishOutcome::Published
}

fn should_publish_subscribed_account(subs: &AccountSubscriptions, pubkey: &[u8]) -> bool {
fn should_publish_subscribed_account(
subs: &AccountSubscriptions,
pubkey: &[u8],
) -> bool {
match <&[u8; 32]>::try_from(pubkey) {
Ok(key) => subs.contains_sync(key),
Err(_) => false,
Expand Down Expand Up @@ -145,7 +150,9 @@ mod tests {
AccountUpdatePublishOutcome, should_publish_backfill_account,
should_publish_confirmed_account,
};
use crate::{server::subscriptions::AccountSubscriptions, wire::UpdateAccountEvent};
use crate::{
server::subscriptions::AccountSubscriptions, wire::UpdateAccountEvent,
};

fn sample_event(is_startup: bool) -> UpdateAccountEvent {
UpdateAccountEvent {
Expand All @@ -167,15 +174,22 @@ mod tests {
#[test]
fn test_confirmed_startup_replay_updates_are_suppressed() {
assert!(matches!(
should_publish_confirmed_account(&AccountSubscriptions::new(), &sample_event(true)),
should_publish_confirmed_account(
&AccountSubscriptions::new(),
&sample_event(true)
),
AccountUpdatePublishOutcome::SkippedStartupReplay
));
}

#[test]
fn test_backfill_snapshots_are_suppressed_after_live_updates() {
assert!(matches!(
should_publish_backfill_account(&AccountSubscriptions::new(), [7; 32], true),
should_publish_backfill_account(
&AccountSubscriptions::new(),
[7; 32],
true
),
AccountUpdatePublishOutcome::SkippedLiveUpdateWon
));
}
Expand Down
Loading