diff --git a/contracts/executor.sol b/contracts/executor.sol index 0e79ea9..97e7b44 100644 --- a/contracts/executor.sol +++ b/contracts/executor.sol @@ -258,6 +258,8 @@ contract executor { } } + + callbackAddress = address(0); } /** diff --git a/src/lib.rs b/src/lib.rs index d2f8715..1ba4dd1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] @@ -20,7 +22,6 @@ pub const EXECUTOR_RUNTIME: &[u8] = &[]; #[cfg(docsrs)] pub const DELEGATE_PROXY_RUNTIME: &[u8] = &[]; - pub mod flow_builder; pub mod opcodes; diff --git a/src/test.rs b/src/test.rs index d33478c..e55fc75 100644 --- a/src/test.rs +++ b/src/test.rs @@ -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;