use std::io::Result;
use crate::{ids::Id, rpcchainvm::concensus::snowman};
#[tonic::async_trait]
pub trait ChainVm: crate::rpcchainvm::common::vm::Vm + Getter + Parser {
async fn build_block(&self) -> Result<Box<dyn snowman::Block + Send + Sync>>;
async fn issue_tx(&self) -> Result<Box<dyn snowman::Block + Send + Sync>>;
async fn set_preference(&self, id: Id) -> Result<()>;
async fn last_accepted(&self) -> Result<Id>;
}
#[tonic::async_trait]
pub trait Getter {
async fn get_block(&self, id: Id) -> Result<Box<dyn snowman::Block + Send + Sync>>;
}
#[tonic::async_trait]
pub trait Parser {
async fn parse_block(&self, bytes: &[u8]) -> Result<Box<dyn snowman::Block + Send + Sync>>;
}