diff --git a/crates/avalanche-types/src/lib.rs b/crates/avalanche-types/src/lib.rs index 925fb89..942a748 100644 --- a/crates/avalanche-types/src/lib.rs +++ b/crates/avalanche-types/src/lib.rs @@ -12,10 +12,16 @@ //! ecosystem. //! #![cfg_attr(docsrs, feature(doc_cfg))] +#[cfg(feature = "avalanchego")] +#[cfg_attr(docsrs, doc(cfg(feature = "avalanchego")))] +pub mod avalanchego; pub mod avm; pub mod choices; pub mod codec; pub mod constants; +#[cfg(feature = "coreth")] +#[cfg_attr(docsrs, doc(cfg(feature = "coreth")))] +pub mod coreth; pub mod errors; pub mod formatting; pub mod hash; @@ -30,14 +36,6 @@ pub mod units; pub mod utils; pub mod verify; -#[cfg(feature = "avalanchego")] -#[cfg_attr(docsrs, doc(cfg(feature = "avalanchego")))] -pub mod avalanchego; - -#[cfg(feature = "coreth")] -#[cfg_attr(docsrs, doc(cfg(feature = "coreth")))] -pub mod coreth; - #[cfg(feature = "subnet_evm")] #[cfg_attr(docsrs, doc(cfg(feature = "subnet_evm")))] pub mod subnet_evm; diff --git a/crates/avalanche-types/src/subnet/rpc/context.rs b/crates/avalanche-types/src/subnet/rpc/context.rs index 7a319fe..3d769c2 100644 --- a/crates/avalanche-types/src/subnet/rpc/context.rs +++ b/crates/avalanche-types/src/subnet/rpc/context.rs @@ -7,6 +7,7 @@ use crate::{ keystore::keystore_client::KeystoreClient, sharedmemory::shared_memory_client::SharedMemoryClient, }, + proto::warp::signer_client::SignerClient, }; use tonic::transport::Channel; @@ -25,6 +26,7 @@ pub struct Context { pub keystore: KeystoreClient, pub shared_memory: SharedMemoryClient, pub bc_lookup: AliasReaderClient, + pub singer_client: SignerClient, pub chain_data_dir: String, pub validator_state: S, // TODO metrics diff --git a/crates/avalanche-types/src/subnet/rpc/snow/engine/common/vm.rs b/crates/avalanche-types/src/subnet/rpc/snow/engine/common/vm.rs index cb061dd..94feec8 100644 --- a/crates/avalanche-types/src/subnet/rpc/snow/engine/common/vm.rs +++ b/crates/avalanche-types/src/subnet/rpc/snow/engine/common/vm.rs @@ -18,7 +18,6 @@ use crate::{ }, }; use tokio::sync::mpsc::Sender; - /// Vm describes the trait that all consensus VMs must implement. /// /// ref. @@ -29,7 +28,6 @@ pub trait CommonVm: AppHandler + Connector + Checkable { type ChainHandler: Handle; type StaticHandler: Handle; type ValidatorState: validators::State; - async fn initialize( &mut self, ctx: Option>, diff --git a/crates/avalanche-types/src/subnet/rpc/vm/server.rs b/crates/avalanche-types/src/subnet/rpc/vm/server.rs index ec7e9ee..c3a81de 100644 --- a/crates/avalanche-types/src/subnet/rpc/vm/server.rs +++ b/crates/avalanche-types/src/subnet/rpc/vm/server.rs @@ -16,6 +16,7 @@ use crate::{ sharedmemory::shared_memory_client::SharedMemoryClient, vm, }, + proto::warp::signer_client, subnet::rpc::{ consensus::snowman::{Block, Decidable}, context::Context, @@ -123,7 +124,7 @@ where let keystore = KeystoreClient::new(client_conn.clone()); let shared_memory = SharedMemoryClient::new(client_conn.clone()); let bc_lookup = AliasReaderClient::new(client_conn.clone()); - + let singer_client = signer_client::SignerClient::new(client_conn.clone()); let ctx: Option> = Some(Context { network_id: req.network_id, subnet_id: ids::Id::from_slice(&req.subnet_id), @@ -135,6 +136,7 @@ where keystore, shared_memory, bc_lookup, + singer_client, chain_data_dir: req.chain_data_dir, validator_state: ValidatorStateClient::new(client_conn.clone()), }); @@ -182,7 +184,6 @@ where return tonic::Status::unknown("engine receiver closed unexpectedly"); } }); - let mut inner_vm = self.vm.write().await; inner_vm .initialize( @@ -1009,7 +1010,7 @@ where return Ok(Response::new(vm::GetBlockIdAtHeightResponse { blk_id: height.to_vec().into(), err: 0, - })) + })); } Err(e) => { if error_to_error_code(&e.to_string()) != 0 {