Skip to content

Commit

Permalink
fix: subgraph plugin management
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Feb 17, 2025
1 parent e131bb0 commit 60c168c
Show file tree
Hide file tree
Showing 25 changed files with 524 additions and 189 deletions.
77 changes: 75 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ members = [
"crates/cli",
"crates/core",
"crates/gql",
"crates/subgraph"
"crates/subgraph",
"crates/types"
]
default-members = ["crates/cli"]
resolver = "2"

[workspace.dependencies]
surfpool-core = { path = "crates/core", default-features = false }
surfpool-gql = { path = "crates/gql", default-features = false }
surfpool-subgraph = { path = "crates/subgraph", default-features = false }
surfpool-types = { path = "crates/types", default-features = false }
agave-geyser-plugin-interface = "2.1.10"
solana-sdk = "=2.1.10"
solana-program = "2.1.10"
Expand Down
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ path = "src/main.rs"

[dependencies]
surfpool-core = { workspace = true }
surfpool-types = { workspace = true }
surfpool-gql = { workspace = true }
# surfpool-core = { version = "0.1" }
txtx-core = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions crates/cli/src/cli/simnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ use surfpool_core::{
signer::{EncodableKey, Signer},
},
start_simnet,
types::{
RpcConfig, RunloopTriggerMode, SimnetConfig, SimnetEvent, SubgraphConfig, SubgraphEvent,
SurfpoolConfig,
},
};
use surfpool_types::{
RpcConfig, RunloopTriggerMode, SimnetConfig, SimnetEvent, SubgraphConfig, SubgraphEvent,
SurfpoolConfig,
};
use txtx_core::kit::{
channel::Receiver, futures::future::join_all, helpers::fs::FileLocation,
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use std::collections::HashMap;
use std::error::Error as StdError;
use std::sync::RwLock;
use std::time::Duration;
use surfpool_core::types::{
Entry, SchemaDatasourceingEvent, SubgraphCommand, SubgraphEvent, SurfpoolConfig,
};
use surfpool_gql::query::{SchemaDatasource, SchemaDatasourceEntry};
use surfpool_gql::subscription::EntryData;
use surfpool_gql::{new_dynamic_schema, Context as GqlContext, GqlDynamicSchema as GqlSchema};
use surfpool_types::{
Entry, SchemaDatasourceingEvent, SubgraphCommand, SubgraphEvent, SurfpoolConfig,
};
use txtx_core::kit::uuid::Uuid;

#[cfg(feature = "explorer")]
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/tui/simnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use surfpool_core::{
pubkey::Pubkey, signature::Keypair, signer::Signer, system_instruction,
transaction::Transaction,
},
types::{ClockCommand, RunloopTriggerMode, SimnetCommand, SimnetEvent},
};
use surfpool_types::{ClockCommand, RunloopTriggerMode, SimnetCommand, SimnetEvent};
use txtx_core::kit::types::frontend::BlockEvent;
use txtx_core::kit::{channel::Receiver, types::frontend::ProgressBarStatusColor};

Expand Down
5 changes: 4 additions & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ keywords = { workspace = true }
categories = { workspace = true }

[lib]
name = "surfpool_core"
path = "src/lib.rs"

[dependencies]
surfpool-types = { workspace = true }
base64 = "0.22.1"
bincode = { workspace = true }
crossbeam-channel = "0.5.14"
Expand Down Expand Up @@ -80,3 +80,6 @@ ipc-channel = { workspace = true }

[dev-dependencies]
test-case = "^3.3.1"

[build-dependencies]
surfpool-subgraph = { workspace = true }
5 changes: 2 additions & 3 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ extern crate serde_json;

pub mod rpc;
pub mod simnet;
pub mod types;

use crossbeam_channel::{Receiver, Sender};
pub use jsonrpc_core;
pub use jsonrpc_http_server;
pub use litesvm;
pub use solana_rpc_client;
pub use solana_sdk;
use types::{SimnetCommand, SimnetEvent, SubgraphCommand, SurfpoolConfig};
use surfpool_types::{SimnetCommand, SimnetEvent, SubgraphCommand, SurfpoolConfig};

pub async fn start_simnet(
config: SurfpoolConfig,
Expand All @@ -40,4 +39,4 @@ pub async fn start_simnet(
}

#[cfg(test)]
mod test_helpers;
mod tests;
2 changes: 1 addition & 1 deletion crates/core/src/rpc/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use std::collections::HashMap;
use std::net::SocketAddr;
use std::time::Duration;
use std::time::SystemTime;
use surfpool_types::PluginManagerCommand;
use txtx_addon_network_svm::codec::subgraph::PluginConfig;
use uuid::Uuid;

use super::RunloopContext;
use crate::types::PluginManagerCommand;

#[rpc]
pub trait AdminRpc {
Expand Down
5 changes: 3 additions & 2 deletions crates/core/src/rpc/full.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::utils::{decode_and_deserialize, transform_tx_metadata_to_ui_accounts};
use crate::simnet::{EntryStatus, TransactionWithStatusMeta};
use crate::types::TransactionStatusEvent;
use itertools::Itertools;
use jsonrpc_core::futures::future::{self, join_all};
use jsonrpc_core::BoxFuture;
Expand Down Expand Up @@ -37,6 +36,7 @@ use solana_transaction_status::{
};
use solana_transaction_status::{TransactionBinaryEncoding, UiTransactionEncoding};
use std::str::FromStr;
use surfpool_types::TransactionStatusEvent;

use super::*;

Expand Down Expand Up @@ -750,8 +750,9 @@ impl Full for SurfpoolFullRpc {

#[cfg(test)]
mod tests {
use crate::tests::helpers::TestSetup;

use super::*;
use crate::test_helpers::TestSetup;
use base64::{prelude::BASE64_STANDARD, Engine};
use solana_account_decoder::{UiAccount, UiAccountData};
use solana_client::rpc_config::RpcSimulateTransactionAccountsConfig;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/rpc/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl Minimal for SurfpoolMinimalRpc {
#[cfg(test)]
mod tests {
use super::*;
use crate::test_helpers::TestSetup;
use crate::tests::helpers::TestSetup;

#[test]
fn test_get_health() {
Expand Down
9 changes: 5 additions & 4 deletions crates/core/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ impl State for Option<RunloopContext> {

impl Metadata for RunloopContext {}

use crate::{
simnet::GlobalState,
types::{PluginManagerCommand, RpcConfig, SimnetCommand},
};
use crate::simnet::GlobalState;
use jsonrpc_core::futures::FutureExt;
use std::future::Future;
use surfpool_types::{
types::{PluginManagerCommand, RpcConfig},
SimnetCommand,
};

#[derive(Clone)]
pub struct SurfpoolMiddleware {
Expand Down
Loading

0 comments on commit 60c168c

Please sign in to comment.