Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
kroist committed Jan 31, 2025
1 parent b636681 commit bfc409b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
22 changes: 11 additions & 11 deletions crates/shielder-cli/src/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use shielder_contract::{
events::get_event,
providers::create_simple_provider,
ShielderContract::{
depositNativeCall, newAccountNativeCall, withdrawNativeCall, DepositNative,
NewAccountNative, ShielderContractEvents, WithdrawNative,
depositTokenCall, newAccountTokenCall, withdrawTokenCall, Deposit, NewAccount,
ShielderContractEvents, Withdraw,
},
};
use tracing::{error, info};
Expand Down Expand Up @@ -117,15 +117,15 @@ async fn try_get_shielder_event_for_tx(
block_hash: BlockHash,
) -> Result<Option<ShielderContractEvents>> {
let tx_data = tx.input();
let maybe_action = if newAccountNativeCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<NewAccountNative>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::NewAccountNative(event))
} else if depositNativeCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<DepositNative>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::DepositNative(event))
} else if withdrawNativeCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<WithdrawNative>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::WithdrawNative(event))
let maybe_action = if newAccountTokenCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<NewAccount>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::NewAccount(event))
} else if depositTokenCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<Deposit>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::Deposit(event))
} else if withdrawTokenCall::abi_decode(tx_data, true).is_ok() {
let event = get_event::<Withdraw>(provider, tx.tx_hash(), block_hash).await?;
Some(ShielderContractEvents::Withdraw(event))
} else {
None
};
Expand Down
4 changes: 2 additions & 2 deletions crates/shielder-cli/src/shielder_ops/new_account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloy_primitives::U256;
use anyhow::Result;
use shielder_account::{call_data::NewAccountCallType, ShielderAction};
use shielder_contract::{call_type::Call, events::get_event, ShielderContract::NewAccountNative};
use shielder_contract::{call_type::Call, events::get_event, ShielderContract::NewAccount};
use tracing::{debug, info};

use crate::{
Expand All @@ -22,7 +22,7 @@ pub async fn new_account(app_state: &mut AppState, amount: u128) -> Result<()> {
)
.await?;

let new_account_event = get_event::<NewAccountNative>(
let new_account_event = get_event::<NewAccount>(
&app_state.create_simple_provider().await?,
tx_hash,
block_hash,
Expand Down
4 changes: 2 additions & 2 deletions crates/shielder-cli/src/shielder_ops/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use shielder_account::{
ShielderAction,
};
use shielder_contract::{
events::get_event, merkle_path::get_current_merkle_path, ShielderContract::WithdrawNative,
events::get_event, merkle_path::get_current_merkle_path, ShielderContract::Withdraw,
};
use shielder_relayer::{FeeToken, QuoteFeeResponse, RelayQuery, RelayResponse};
use shielder_setup::version::contract_version;
Expand Down Expand Up @@ -49,7 +49,7 @@ pub async fn withdraw(app_state: &mut AppState, amount: u128, to: Address) -> Re
let provider = app_state.create_simple_provider().await?;
let block_hash = get_block_hash(&provider, tx_hash).await?;

let withdraw_event = get_event::<WithdrawNative>(&provider, tx_hash, block_hash).await?;
let withdraw_event = get_event::<Withdraw>(&provider, tx_hash, block_hash).await?;
debug!("Withdraw event: {withdraw_event:?}");

app_state.account.register_action(ShielderAction::withdraw(
Expand Down
7 changes: 4 additions & 3 deletions crates/shielder-relayer/src/relay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::{
};
use shielder_contract::{
alloy_primitives::{Address, U256},
ShielderContract::withdrawNativeCall,
ShielderContract::withdrawTokenCall,
};
use shielder_relayer::{server_error, FeeToken, RelayQuery, RelayResponse, SimpleServiceResponse};
use shielder_setup::version::{contract_version, ContractVersion};
Expand Down Expand Up @@ -74,10 +74,11 @@ fn bad_request(msg: &str) -> Response {
(StatusCode::BAD_REQUEST, SimpleServiceResponse::from(msg)).into_response()
}

fn create_call(q: RelayQuery, relayer_address: Address, relayer_fee: U256) -> withdrawNativeCall {
withdrawNativeCall {
fn create_call(q: RelayQuery, relayer_address: Address, relayer_fee: U256) -> withdrawTokenCall {
withdrawTokenCall {
expectedContractVersion: q.expected_contract_version,
idHiding: q.id_hiding,
tokenAddress: Address::ZERO,
withdrawAddress: q.withdraw_address,
relayerAddress: relayer_address,
relayerFee: relayer_fee,
Expand Down
6 changes: 3 additions & 3 deletions crates/shielder-relayer/src/relay/taskmaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use async_channel::{Receiver as MPMCReceiver, Sender as MPMCSender};
use shielder_contract::{
alloy_primitives::{Address, TxHash},
call_type::{DryRun, Submit},
ShielderContract::withdrawNativeCall,
ShielderContract::withdrawTokenCall,
ShielderContractError, ShielderUser,
};
use tokio::sync::{
Expand All @@ -31,7 +31,7 @@ pub enum TaskResult {

pub struct Task {
report: OneshotSender<(RequestTrace, TaskResult)>,
payload: withdrawNativeCall,
payload: withdrawTokenCall,
request_trace: RequestTrace,
}

Expand Down Expand Up @@ -90,7 +90,7 @@ impl Taskmaster {

pub async fn register_new_task(
&self,
payload: withdrawNativeCall,
payload: withdrawTokenCall,
mut request_trace: RequestTrace,
) -> Result<OneshotReceiver<(RequestTrace, TaskResult)>> {
let (report_sender, report_receiver) = oneshot::channel();
Expand Down
4 changes: 2 additions & 2 deletions crates/stress-testing/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use shielder_circuits::circuits::{Params, ProvingKey};
use shielder_contract::{
alloy_primitives::{Address, U256},
ConnectionPolicy,
ShielderContract::newAccountNativeCall,
ShielderContract::newAccountTokenCall,
ShielderUser,
};

Expand Down Expand Up @@ -37,7 +37,7 @@ impl Actor {
params: &Params,
pk: &ProvingKey,
amount: U256,
) -> newAccountNativeCall {
) -> newAccountTokenCall {
self.account
.prepare_call::<NewAccountCallType>(params, pk, amount, &())
}
Expand Down
5 changes: 2 additions & 3 deletions crates/stress-testing/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use shielder_account::ShielderAction;
use shielder_circuits::new_account::NewAccountCircuit;
use shielder_contract::{
alloy_primitives::U256, call_type::Call, events::get_event, providers::create_simple_provider,
ShielderContract::NewAccountNative,
ShielderContract::NewAccount,
};

use crate::{actor::Actor, config::Config, util::proving_keys, INITIAL_BALANCE, SHIELDED_BALANCE};
Expand Down Expand Up @@ -76,8 +76,7 @@ async fn shield_tokens(config: &Config, actors: &mut [Actor]) -> Result<()> {
.create_new_account_native::<Call>(call, shielded_amount)
.await?;

let new_account_event =
get_event::<NewAccountNative>(&provider, tx_hash, block_hash).await?;
let new_account_event = get_event::<NewAccount>(&provider, tx_hash, block_hash).await?;

actor.account.register_action(ShielderAction::new_account(
shielded_amount,
Expand Down

0 comments on commit bfc409b

Please sign in to comment.