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
11 changes: 6 additions & 5 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ spl-associated-token-account = "6.0.0"
spl-token = "6.0.0"
txtx-addon-kit = { version = "0.4.4", features = ["wasm"] }
txtx-core = { version = "0.4.7" }
txtx-addon-network-svm = { version = "0.2.2" }
txtx-addon-network-svm-types = { version = "0.2.2" }
txtx-addon-network-svm = { version = "0.2.7" }
txtx-addon-network-svm-types = { version = "0.2.5" }
txtx-gql = { version = "0.3.2" }
txtx-supervisor-ui = { version = "0.2.3", default-features = false, features = ["crates_build"]}
txtx-cloud = "0.1.9"
Expand Down
1 change: 0 additions & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ zstd = "0.13.2"
libloading = "0.7.4"
json5 = "0.4.1"
txtx-addon-network-svm-types = { workspace = true }
txtx-addon-network-svm = { workspace = true }
uuid = "1.7.0"
blake3 = "1.8.2"
anyhow = "1.0.98"
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct SurfpoolRpc;

#[derive(Clone)]
pub struct RunloopContext {
pub id: Option<Hash>,
pub id: Option<(Hash, String)>,
pub svm_locker: SurfnetSvmLocker,
pub simnet_commands_tx: Sender<SimnetCommand>,
pub plugin_manager_commands_tx: Sender<PluginManagerCommand>,
Expand Down
19 changes: 14 additions & 5 deletions crates/core/src/runloops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub async fn start_local_surfnet_runloop(
};

let (clock_event_rx, clock_command_tx) =
start_clock_runloop(simnet_config.slot_time, simnet_events_tx_cc.clone());
start_clock_runloop(simnet_config.slot_time, Some(simnet_events_tx_cc.clone()));

let _ = simnet_events_tx_cc.send(SimnetEvent::Ready);

Expand Down Expand Up @@ -223,7 +223,7 @@ pub async fn start_block_production_runloop(

pub fn start_clock_runloop(
mut slot_time: u64,
simnet_events_tx: Sender<SimnetEvent>,
simnet_events_tx: Option<Sender<SimnetEvent>>,
) -> (Receiver<ClockEvent>, Sender<ClockCommand>) {
let (clock_event_tx, clock_event_rx) = unbounded::<ClockEvent>();
let (clock_command_tx, clock_command_rx) = unbounded::<ClockCommand>();
Expand All @@ -236,15 +236,24 @@ pub fn start_clock_runloop(
match clock_command_rx.try_recv() {
Ok(ClockCommand::Pause) => {
enabled = false;
let _ = simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Pause));
if let Some(ref simnet_events_tx) = simnet_events_tx {
let _ =
simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Pause));
}
}
Ok(ClockCommand::Resume) => {
enabled = true;
let _ = simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Resume));
if let Some(ref simnet_events_tx) = simnet_events_tx {
let _ =
simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Resume));
}
}
Ok(ClockCommand::Toggle) => {
enabled = !enabled;
let _ = simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Toggle));
if let Some(ref simnet_events_tx) = simnet_events_tx {
let _ =
simnet_events_tx.send(SimnetEvent::ClockUpdate(ClockCommand::Toggle));
}
}
Ok(ClockCommand::UpdateSlotInterval(updated_slot_time)) => {
slot_time = updated_slot_time;
Expand Down
12 changes: 11 additions & 1 deletion crates/core/src/surfnet/svm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use surfpool_types::{
},
};
use txtx_addon_kit::{indexmap::IndexMap, types::types::AddonJsonConverter};
use txtx_addon_network_svm::codec::idl::parse_bytes_to_value_with_expected_idl_type_def_ty;
use txtx_addon_network_svm_types::subgraph::idl::parse_bytes_to_value_with_expected_idl_type_def_ty;
use uuid::Uuid;

use super::{
Expand Down Expand Up @@ -1516,12 +1516,22 @@ impl SurfnetSvm {
if let Some(account_type) =
idl.types.iter().find(|t| t.name == matching_account.name)
{
let empty_vec = vec![];
let idl_type_def_generics = idl
.types
.iter()
.find(|t| t.name == account_type.name)
.map(|t| &t.generics);

// If we found a matching account type, we can use it to parse the account data
let rest = data[8..].as_ref();
if let Ok(parsed_value) =
parse_bytes_to_value_with_expected_idl_type_def_ty(
&rest,
&account_type.ty,
&idl.types,
&vec![],
idl_type_def_generics.unwrap_or(&empty_vec),
)
{
return UiAccount {
Expand Down
1 change: 1 addition & 0 deletions crates/gql/src/types/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct CollectionMetadata {

impl CollectionMetadata {
pub fn from_request(uuid: &Uuid, request: &SubgraphRequest) -> Self {
let SubgraphRequest::V0(request) = request;
let name = request.subgraph_name.to_case(Case::Pascal);
let mut fields: Vec<_> = request
.intrinsic_fields
Expand Down
6 changes: 4 additions & 2 deletions crates/gql/src/types/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ mod tests {
anchor::types::{Idl, IdlEvent, IdlMetadata, IdlSerialization, IdlTypeDef, IdlTypeDefTy},
subgraph::{
EventSubgraphSource, IndexedSubgraphField, IndexedSubgraphSourceType, SubgraphRequest,
SubgraphRequestV0,
},
};
use uuid::Uuid;
Expand Down Expand Up @@ -425,7 +426,7 @@ mod tests {
}],
errors: vec![],
};
SubgraphRequest {
SubgraphRequest::V0(SubgraphRequestV0 {
program_id: program_id.clone(),
slot: 0,
subgraph_name: "TestSubgraph".to_string(),
Expand All @@ -443,7 +444,8 @@ mod tests {
is_indexed: false,
}],
intrinsic_fields: vec![],
}
idl_types: vec![],
})
}

fn test_entry(_schema: &CollectionMetadata) -> Vec<u8> {
Expand Down
Loading