Struct ibc_test_framework::chain::driver::ChainDriver
source · [−]pub struct ChainDriver {
pub command_path: String,
pub chain_id: ChainId,
pub home_path: String,
pub account_prefix: String,
pub rpc_port: u16,
pub grpc_port: u16,
pub grpc_web_port: u16,
pub p2p_port: u16,
pub tx_config: TxConfig,
pub runtime: Arc<Runtime>,
}Expand description
A driver for interacting with a chain full nodes through command line.
The name ChainDriver is inspired by
WebDriver,
which is the term used to describe programs that control spawning of the
web browsers. In our case, the ChainDriver is used to spawn and manage
chain full nodes.
Currently the ChainDriver is hardcoded to support only a single version
of Gaia chain. In the future, we will want to turn this into one or more
ChainDriver traits so that they can be used to spawn multiple chain
implementations other than a single version of Gaia.
Fields
command_path: StringThe filesystem path to the Gaia CLI. Defaults to gaiad.
chain_id: ChainIdThe ID of the chain.
home_path: StringThe home directory for the full node to store data files.
account_prefix: Stringrpc_port: u16The port used for RPC.
grpc_port: u16The port used for GRPC.
grpc_web_port: u16p2p_port: u16The port used for P2P. (Currently unused other than for setup)
tx_config: TxConfigruntime: Arc<Runtime>Implementations
sourceimpl ChainDriver
impl ChainDriver
sourcepub fn create(
command_path: String,
chain_id: ChainId,
home_path: String,
account_prefix: String,
rpc_port: u16,
grpc_port: u16,
grpc_web_port: u16,
p2p_port: u16,
runtime: Arc<Runtime>
) -> Result<Self, Error>
pub fn create(
command_path: String,
chain_id: ChainId,
home_path: String,
account_prefix: String,
rpc_port: u16,
grpc_port: u16,
grpc_web_port: u16,
p2p_port: u16,
runtime: Arc<Runtime>
) -> Result<Self, Error>
Create a new ChainDriver
sourcepub fn rpc_address(&self) -> String
pub fn rpc_address(&self) -> String
Returns the full URL for the RPC address.
sourcepub fn websocket_address(&self) -> String
pub fn websocket_address(&self) -> String
Returns the full URL for the WebSocket address.
sourcepub fn grpc_address(&self) -> String
pub fn grpc_address(&self) -> String
Returns the full URL for the GRPC address.
sourcepub fn rpc_listen_address(&self) -> String
pub fn rpc_listen_address(&self) -> String
Returns the full URL for the RPC address to listen to when starting the full node.
This is somehow different from rpc_address
as it requires the "tcp://" scheme.
sourcepub fn grpc_listen_address(&self) -> String
pub fn grpc_listen_address(&self) -> String
Returns the full URL for the GRPC address to listen to when starting the full node.
This is somehow different from grpc_address
as it requires no scheme to be specified.
sourcepub fn exec(&self, args: &[&str]) -> Result<ExecOutput, Error>
pub fn exec(&self, args: &[&str]) -> Result<ExecOutput, Error>
Execute the gaiad command with the given command line arguments, and returns the STDOUT result as String.
This is not the most efficient way of interacting with the CLI, but
is sufficient for testing purposes of interacting with the gaiad
commmand.
The function also output debug logs that show what command is being executed, so that users can manually re-run the commands by copying from the logs.
sourcepub fn initialize(&self) -> Result<(), Error>
pub fn initialize(&self) -> Result<(), Error>
Initialized the chain data stores.
This is used by
bootstrap_single_node.
sourcepub fn update_genesis_file(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
pub fn update_genesis_file(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
Modify the Gaia genesis file.
sourcepub fn write_file(&self, file_path: &str, content: &str) -> Result<(), Error>
pub fn write_file(&self, file_path: &str, content: &str) -> Result<(), Error>
Write the string content to a file path relative to the chain home directory.
This is not efficient but is sufficient for testing purposes.
sourcepub fn read_file(&self, file_path: &str) -> Result<String, Error>
pub fn read_file(&self, file_path: &str) -> Result<String, Error>
Read the content at a file path relative to the chain home directory, and return the result as a string.
This is not efficient but is sufficient for testing purposes.
sourcepub fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>
pub fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error>
Add a wallet with the given ID to the full node’s keyring.
sourcepub fn add_genesis_account(
&self,
wallet: &WalletAddress,
amounts: &[(&Denom, u64)]
) -> Result<(), Error>
pub fn add_genesis_account(
&self,
wallet: &WalletAddress,
amounts: &[(&Denom, u64)]
) -> Result<(), Error>
Add a wallet address to the genesis account list for an uninitialized full node.
sourcepub fn add_genesis_validator(
&self,
wallet_id: &WalletId,
denom: &Denom,
amount: u64
) -> Result<(), Error>
pub fn add_genesis_validator(
&self,
wallet_id: &WalletId,
denom: &Denom,
amount: u64
) -> Result<(), Error>
Add a wallet ID with the given stake amount to be the genesis validator for an uninitialized chain.
sourcepub fn collect_gen_txs(&self) -> Result<(), Error>
pub fn collect_gen_txs(&self) -> Result<(), Error>
Call gaiad collect-gentxs to generate the genesis transactions.
sourcepub fn update_chain_config(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
pub fn update_chain_config(
&self,
file: &str,
cont: impl FnOnce(&mut Value) -> Result<(), Error>
) -> Result<(), Error>
Modify the Gaia chain config which is saved in toml format.
sourcepub fn start(&self) -> Result<ChildProcess, Error>
pub fn start(&self) -> Result<ChildProcess, Error>
Start a full node by running in the background gaiad start.
Returns a ChildProcess that stops the full node process when the
value is dropped.
sourcepub fn query_balance(
&self,
wallet_id: &WalletAddress,
denom: &Denom
) -> Result<u64, Error>
pub fn query_balance(
&self,
wallet_id: &WalletAddress,
denom: &Denom
) -> Result<u64, Error>
Query for the balances for a given wallet address and denomination
pub fn send_tx(&self, wallet: &Wallet, messages: Vec<Any>) -> Result<(), Error>
sourcepub fn assert_eventual_wallet_amount(
&self,
wallet: &WalletAddress,
target_amount: u64,
denom: &Denom
) -> Result<(), Error>
pub fn assert_eventual_wallet_amount(
&self,
wallet: &WalletAddress,
target_amount: u64,
denom: &Denom
) -> Result<(), Error>
Assert that a wallet should eventually have the expected amount in the given denomination.
Trait Implementations
sourceimpl Clone for ChainDriver
impl Clone for ChainDriver
sourcefn clone(&self) -> ChainDriver
fn clone(&self) -> ChainDriver
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ChainDriver
impl Debug for ChainDriver
sourceimpl ExportEnv for ChainDriver
impl ExportEnv for ChainDriver
sourcefn export_env(&self, writer: &mut impl EnvWriter)
fn export_env(&self, writer: &mut impl EnvWriter)
Auto Trait Implementations
impl !RefUnwindSafe for ChainDriver
impl Send for ChainDriver
impl Sync for ChainDriver
impl Unpin for ChainDriver
impl !UnwindSafe for ChainDriver
Blanket Implementations
impl<T> AsAny for T where
T: Any,
impl<T> AsAny for T where
T: Any,
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Borrow this concrete type as a &mut dyn Any
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T in a tonic::Request
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
Set the foreground color generically Read more
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
Set the background color generically. Read more
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
Change the background color to black
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
Change the background color to red
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
Change the background color to green
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the background color to yellow
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
Change the background color to blue
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to magenta
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to purple
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Change the background color to cyan
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
Change the foreground color to white
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
Change the background color to white
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
Change the foreground color to the terminal default
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
Change the background color to the terminal default
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the background color to bright black
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the background color to bright red
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the background color to bright green
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the background color to bright yellow
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the background color to bright blue
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright magenta
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright purple
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the background color to bright cyan
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the background color to bright white
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
Make the text bold
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
Make the text dim
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
Make the text italicized
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
Make the text italicized
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
Make the text blink
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
Swap the foreground and background colors
Hide the text
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more