Skip to content
Open
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
2 changes: 2 additions & 0 deletions contracts/executor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ contract executor {

}
}

callbackAddress = address(0);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ pub const EXECUTOR_INIT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/execu
#[cfg(not(docsrs))]
pub const DELEGATE_PROXY_INIT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/proxy.bin"));
#[cfg(not(docsrs))]
pub const EXECUTOR_RUNTIME: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/executor_runtime.bin"));
pub const EXECUTOR_RUNTIME: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/executor_runtime.bin"));
#[cfg(not(docsrs))]
pub const DELEGATE_PROXY_RUNTIME: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/proxy_runtime.bin"));
pub const DELEGATE_PROXY_RUNTIME: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/proxy_runtime.bin"));

// Use empty slices when building on docs.rs
#[cfg(docsrs)]
Expand All @@ -20,7 +22,6 @@ pub const EXECUTOR_RUNTIME: &[u8] = &[];
#[cfg(docsrs)]
pub const DELEGATE_PROXY_RUNTIME: &[u8] = &[];


pub mod flow_builder;
pub mod opcodes;

Expand Down
31 changes: 31 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,37 @@ async fn test_wallet_can_interact() {
assert_eq!(account_balance, BUDGET); // executor has the money sent in empty tx
}

#[tokio::test]
async fn test_execute_actions_clears_unprocessed_callback() {
let provider = ProviderBuilder::new().connect_anvil();
provider
.anvil_set_balance(WALLET, BUDGET + U256::from(10u64.pow(18)))
.await
.unwrap();

let executor = deploy_executor(&provider).await;
let fb = FlowBuilder::empty().set_callback(BOB).build();
let tx = TransactionRequest::default()
.with_from(WALLET)
.with_to(executor)
.with_input(fb);

let tx_hash = provider.eth_send_unsigned_transaction(tx).await.unwrap();
provider.evm_mine(None).await.unwrap();
let receipt = provider
.get_transaction_receipt(tx_hash)
.await
.unwrap()
.unwrap();
assert!(receipt.status());

let callback_slot = provider
.get_storage_at(executor, U256::from(1))
.await
.unwrap();
assert_eq!(callback_slot, U256::ZERO);
}

#[tokio::test]
async fn test_weth_deposit_through_executor() {
let provider = setup_provider().await;
Expand Down