Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactor environment rename #1636

Merged
merged 2 commits into from
May 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl CrowdfundingESDTTestState {
}

fn set_block_timestamp(&mut self, block_timestamp_expr: u64) {
self.world.current_block().block_timestamp(block_timestamp_expr);
self.world
.current_block()
.block_timestamp(block_timestamp_expr);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
call_tree::CallState, comp_interact_controller::ComposabilityInteract, forwarder_queue_proxy, vault_proxy
call_tree::CallState, comp_interact_controller::ComposabilityInteract, forwarder_queue_proxy,
vault_proxy,
};

use multiversx_sc_snippets::imports::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod comp_interact_config;
mod comp_interact_controller;
mod comp_interact_state;

mod vault_proxy;
mod forwarder_queue_proxy;
mod vault_proxy;

use clap::Parser;
use comp_interact_controller::ComposabilityInteract;
Expand Down
10 changes: 8 additions & 2 deletions framework/snippets/src/interactor_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ mod interactor_query_call;
mod interactor_query_env;
mod interactor_query_step;

pub use interactor_exec_env::InteractorExecEnv;
pub use interactor_exec_env::InteractorEnvExec;
pub use interactor_exec_step::InteractorExecStep;
pub use interactor_prepare_async::InteractorPrepareAsync;
pub use interactor_query_env::InteractorQueryEnv;
pub use interactor_query_env::InteractorEnvQuery;
pub use interactor_query_step::InteractorQueryStep;

#[deprecated(since = "0.50.2", note = "Renamed to InteractorExecEnv")]
pub type InteractorExecEnv<'a> = InteractorEnvExec<'a>;

#[deprecated(since = "0.50.2", note = "Renamed to InteractorEnvQuery")]
pub type InteractorQueryEnv<'a> = InteractorEnvQuery<'a>;
16 changes: 8 additions & 8 deletions framework/snippets/src/interactor_tx/interactor_exec_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ use multiversx_sc_scenario::{

use crate::Interactor;

use super::{InteractorExecEnv, InteractorExecStep, InteractorPrepareAsync};
use super::{InteractorEnvExec, InteractorExecStep, InteractorPrepareAsync};

impl<'w, From, To, Payment, Gas, RH> InteractorPrepareAsync
for Tx<InteractorExecEnv<'w>, From, To, Payment, Gas, FunctionCall<StaticApi>, RH>
for Tx<InteractorEnvExec<'w>, From, To, Payment, Gas, FunctionCall<StaticApi>, RH>
where
From: TxFromSpecified<InteractorExecEnv<'w>>,
To: TxToSpecified<InteractorExecEnv<'w>>,
Payment: TxPayment<InteractorExecEnv<'w>>,
Gas: TxGas<InteractorExecEnv<'w>>,
RH: RHListExec<TxResponse, InteractorExecEnv<'w>>,
From: TxFromSpecified<InteractorEnvExec<'w>>,
To: TxToSpecified<InteractorEnvExec<'w>>,
Payment: TxPayment<InteractorEnvExec<'w>>,
Gas: TxGas<InteractorEnvExec<'w>>,
RH: RHListExec<TxResponse, InteractorEnvExec<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
type Exec = InteractorExecStep<'w, ScCallStep, RH>;
Expand All @@ -37,7 +37,7 @@ where

impl<'w, RH> InteractorExecStep<'w, ScCallStep, RH>
where
RH: RHListExec<TxResponse, InteractorExecEnv<'w>>,
RH: RHListExec<TxResponse, InteractorEnvExec<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
pub async fn run(mut self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked {
Expand Down
18 changes: 9 additions & 9 deletions framework/snippets/src/interactor_tx/interactor_exec_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ use multiversx_sc_scenario::{

use crate::Interactor;

use super::{InteractorExecEnv, InteractorExecStep, InteractorPrepareAsync};
use super::{InteractorEnvExec, InteractorExecStep, InteractorPrepareAsync};

impl<'w, From, Payment, Gas, CodeValue, RH> InteractorPrepareAsync
for Tx<
InteractorExecEnv<'w>,
InteractorEnvExec<'w>,
From,
(),
Payment,
Gas,
DeployCall<InteractorExecEnv<'w>, Code<CodeValue>>,
DeployCall<InteractorEnvExec<'w>, Code<CodeValue>>,
RH,
>
where
From: TxFromSpecified<InteractorExecEnv<'w>>,
Payment: TxPayment<InteractorExecEnv<'w>>,
Gas: TxGas<InteractorExecEnv<'w>>,
CodeValue: TxCodeValue<InteractorExecEnv<'w>>,
RH: RHListExec<TxResponse, InteractorExecEnv<'w>>,
From: TxFromSpecified<InteractorEnvExec<'w>>,
Payment: TxPayment<InteractorEnvExec<'w>>,
Gas: TxGas<InteractorEnvExec<'w>>,
CodeValue: TxCodeValue<InteractorEnvExec<'w>>,
RH: RHListExec<TxResponse, InteractorEnvExec<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
type Exec = InteractorExecStep<'w, ScDeployStep, RH>;
Expand All @@ -44,7 +44,7 @@ where

impl<'w, RH> InteractorExecStep<'w, ScDeployStep, RH>
where
RH: RHListExec<TxResponse, InteractorExecEnv<'w>>,
RH: RHListExec<TxResponse, InteractorEnvExec<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
pub async fn run(mut self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked {
Expand Down
10 changes: 5 additions & 5 deletions framework/snippets/src/interactor_tx/interactor_exec_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ use multiversx_sc_scenario::{
use crate::Interactor;

impl Interactor {
pub fn tx(&mut self) -> TxBaseWithEnv<InteractorExecEnv<'_>> {
pub fn tx(&mut self) -> TxBaseWithEnv<InteractorEnvExec<'_>> {
let data = self.new_env_data();
let env = InteractorExecEnv { world: self, data };
let env = InteractorEnvExec { world: self, data };
Tx::new_with_env(env)
}
}

/// Environment for executing transactions.
pub struct InteractorExecEnv<'w> {
pub struct InteractorEnvExec<'w> {
pub world: &'w mut Interactor,
pub data: ScenarioTxEnvData,
}

impl<'w> TxEnv for InteractorExecEnv<'w> {
impl<'w> TxEnv for InteractorEnvExec<'w> {
type Api = StaticApi;

type RHExpect = TxExpect;
Expand All @@ -39,7 +39,7 @@ impl<'w> TxEnv for InteractorExecEnv<'w> {
}
}

impl<'w> ScenarioTxEnv for InteractorExecEnv<'w> {
impl<'w> ScenarioTxEnv for InteractorEnvExec<'w> {
fn env_data(&self) -> &ScenarioTxEnvData {
&self.data
}
Expand Down
6 changes: 3 additions & 3 deletions framework/snippets/src/interactor_tx/interactor_exec_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use multiversx_sc_scenario::{
scenario_model::TxResponse,
};

use super::InteractorExecEnv;
use super::InteractorEnvExec;

pub struct InteractorExecStep<'w, Step, RH>
where
RH: RHListExec<TxResponse, InteractorExecEnv<'w>>,
RH: RHListExec<TxResponse, InteractorEnvExec<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
pub(crate) step_wrapper: StepWrapper<InteractorExecEnv<'w>, Step, RH>,
pub(crate) step_wrapper: StepWrapper<InteractorEnvExec<'w>, Step, RH>,
}
12 changes: 6 additions & 6 deletions framework/snippets/src/interactor_tx/interactor_exec_transf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use multiversx_sc_scenario::{
scenario_model::TransferStep,
};

use super::{InteractorExecEnv, InteractorExecStep, InteractorPrepareAsync};
use super::{InteractorEnvExec, InteractorExecStep, InteractorPrepareAsync};

impl<'w, From, To, Payment, Gas> InteractorPrepareAsync
for Tx<InteractorExecEnv<'w>, From, To, Payment, Gas, (), ()>
for Tx<InteractorEnvExec<'w>, From, To, Payment, Gas, (), ()>
where
From: TxFromSpecified<InteractorExecEnv<'w>>,
To: TxToSpecified<InteractorExecEnv<'w>>,
Payment: TxPayment<InteractorExecEnv<'w>>,
Gas: TxGas<InteractorExecEnv<'w>>,
From: TxFromSpecified<InteractorEnvExec<'w>>,
To: TxToSpecified<InteractorEnvExec<'w>>,
Payment: TxPayment<InteractorEnvExec<'w>>,
Gas: TxGas<InteractorEnvExec<'w>>,
{
type Exec = InteractorExecStep<'w, TransferStep, ()>;

Expand Down
12 changes: 6 additions & 6 deletions framework/snippets/src/interactor_tx/interactor_query_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use multiversx_sc_scenario::{

use crate::Interactor;

use super::{InteractorPrepareAsync, InteractorQueryEnv, InteractorQueryStep};
use super::{InteractorEnvQuery, InteractorPrepareAsync, InteractorQueryStep};

impl<'w, To, Payment, RH> InteractorPrepareAsync
for Tx<InteractorQueryEnv<'w>, (), To, Payment, (), FunctionCall<StaticApi>, RH>
for Tx<InteractorEnvQuery<'w>, (), To, Payment, (), FunctionCall<StaticApi>, RH>
where
To: TxToSpecified<InteractorQueryEnv<'w>>,
Payment: TxNoPayment<InteractorQueryEnv<'w>>,
RH: RHListExec<TxResponse, InteractorQueryEnv<'w>>,
To: TxToSpecified<InteractorEnvQuery<'w>>,
Payment: TxNoPayment<InteractorEnvQuery<'w>>,
RH: RHListExec<TxResponse, InteractorEnvQuery<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
type Exec = InteractorQueryStep<'w, RH>;
Expand All @@ -32,7 +32,7 @@ where

impl<'w, RH> InteractorQueryStep<'w, RH>
where
RH: RHListExec<TxResponse, InteractorQueryEnv<'w>>,
RH: RHListExec<TxResponse, InteractorEnvQuery<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
pub async fn run(mut self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked {
Expand Down
10 changes: 5 additions & 5 deletions framework/snippets/src/interactor_tx/interactor_query_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ use multiversx_sc_scenario::{
use crate::Interactor;

impl Interactor {
pub fn query(&mut self) -> TxBaseWithEnv<InteractorQueryEnv<'_>> {
pub fn query(&mut self) -> TxBaseWithEnv<InteractorEnvQuery<'_>> {
let data = self.new_env_data();
let env = InteractorQueryEnv { world: self, data };
let env = InteractorEnvQuery { world: self, data };
Tx::new_with_env(env)
}
}

pub struct InteractorQueryEnv<'w> {
pub struct InteractorEnvQuery<'w> {
pub world: &'w mut Interactor,
pub data: ScenarioTxEnvData,
}

impl<'w> TxEnv for InteractorQueryEnv<'w> {
impl<'w> TxEnv for InteractorEnvQuery<'w> {
type Api = StaticApi;

type RHExpect = TxExpect;
Expand All @@ -38,7 +38,7 @@ impl<'w> TxEnv for InteractorQueryEnv<'w> {
}
}

impl<'w> ScenarioTxEnv for InteractorQueryEnv<'w> {
impl<'w> ScenarioTxEnv for InteractorEnvQuery<'w> {
fn env_data(&self) -> &ScenarioTxEnvData {
&self.data
}
Expand Down
6 changes: 3 additions & 3 deletions framework/snippets/src/interactor_tx/interactor_query_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use multiversx_sc_scenario::{
scenario_model::{ScQueryStep, TxResponse},
};

use super::InteractorQueryEnv;
use super::InteractorEnvQuery;

pub struct InteractorQueryStep<'w, RH>
where
RH: RHListExec<TxResponse, InteractorQueryEnv<'w>>,
RH: RHListExec<TxResponse, InteractorEnvQuery<'w>>,
RH::ListReturns: NestedTupleFlatten,
{
pub(crate) step_wrapper: StepWrapper<InteractorQueryEnv<'w>, ScQueryStep, RH>,
pub(crate) step_wrapper: StepWrapper<InteractorEnvQuery<'w>, ScQueryStep, RH>,
}
6 changes: 3 additions & 3 deletions framework/snippets/src/multi/homogenous_tx_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use multiversx_sc_scenario::{
ScenarioTxEnvData,
};

use crate::{Interactor, InteractorExecEnv, InteractorStep, StepBuffer};
use crate::{Interactor, InteractorEnvExec, InteractorStep, StepBuffer};

pub struct HomogenousTxBuffer<'w, Step, RH> {
env: InteractorExecEnv<'w>,
env: InteractorEnvExec<'w>,
steps: Vec<StepWrapper<ScenarioTxEnvData, Step, RH>>,
}

Expand All @@ -22,7 +22,7 @@ impl Interactor {
/// Therefore, after execution, all results will have the same type.
pub fn homogenous_call_buffer<Step, RH>(&mut self) -> HomogenousTxBuffer<'_, Step, RH> {
let data = self.new_env_data();
let env = InteractorExecEnv { world: self, data };
let env = InteractorEnvExec { world: self, data };
HomogenousTxBuffer {
env,
steps: Vec::new(),
Expand Down
Loading