Skip to content

Commit f94843a

Browse files
committed
chore: cleanup unused test
1 parent 99d55e1 commit f94843a

File tree

1 file changed

+1
-102
lines changed
  • core/node/api_server/src/web3/tests

1 file changed

+1
-102
lines changed

core/node/api_server/src/web3/tests/vm.rs

Lines changed: 1 addition & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use zksync_multivm::interface::{
1515
ExecutionResult, OneshotEnv, VmExecutionLogs, VmExecutionResultAndLogs, VmRevertReason,
1616
};
1717
use zksync_types::{
18-
api::ApiStorageLog, fee_model::BatchFeeInput, get_intrinsic_constants, l2::L2Tx,
18+
api::ApiStorageLog, fee_model::BatchFeeInput, get_intrinsic_constants,
1919
transaction_request::CallRequest, u256_to_h256, K256PrivateKey, L2ChainId, PackedEthSignature,
2020
StorageLogKind, StorageLogWithPreviousValue, Transaction, U256,
2121
};
@@ -744,107 +744,6 @@ async fn send_raw_transaction_with_detailed_output() {
744744

745745
// Tests for `eth_sendRawTransactionSync` (EIP-7966)
746746

747-
// Helper to create transaction execution result from raw transaction bytes
748-
fn create_tx_result_from_bytes(tx_bytes: &[u8], tx_hash: H256) -> TransactionExecutionResult {
749-
// Parse the transaction from bytes
750-
let chain_id = L2ChainId::default();
751-
let (tx_request, parsed_hash) = api::TransactionRequest::from_bytes(tx_bytes, chain_id)
752-
.expect("Failed to parse transaction");
753-
assert_eq!(parsed_hash, tx_hash, "Transaction hash mismatch");
754-
755-
// Convert to L2Tx
756-
let max_tx_size = 1_000_000; // 1MB, same as used in tests
757-
let mut l2_tx =
758-
L2Tx::from_request(tx_request, max_tx_size, false).expect("Failed to convert to L2Tx");
759-
760-
// Set the raw input data (required for the transaction to be valid)
761-
l2_tx.set_input(tx_bytes.to_vec(), tx_hash);
762-
763-
mock_execute_transaction(l2_tx.into())
764-
}
765-
766-
#[derive(Debug)]
767-
struct SendRawTransactionSyncImmediateReceiptTest;
768-
769-
#[async_trait]
770-
impl WsTest for SendRawTransactionSyncImmediateReceiptTest {
771-
fn transaction_executor(&self) -> MockOneshotExecutor {
772-
let mut executor = MockOneshotExecutor::default();
773-
executor.set_tx_responses(|_, _| {
774-
// Accept the transaction from transaction_bytes_and_hash(true)
775-
ExecutionResult::Success { output: vec![] }
776-
});
777-
executor
778-
}
779-
780-
async fn test(
781-
&self,
782-
client: &WsClient<L2>,
783-
pool: &ConnectionPool<Core>,
784-
mut pub_sub_events: mpsc::UnboundedReceiver<PubSubEvent>,
785-
) -> anyhow::Result<()> {
786-
let mut storage = pool.connection().await?;
787-
storage
788-
.storage_logs_dal()
789-
.append_storage_logs(
790-
L2BlockNumber(0),
791-
&[SendRawTransactionTest::balance_storage_log()],
792-
)
793-
.await?;
794-
drop(storage);
795-
796-
// Wait for the notifiers to initialize before proceeding
797-
wait_for_notifiers(&mut pub_sub_events, &[SubscriptionType::Blocks]).await;
798-
799-
// Use unique transaction to avoid duplicates with other tests
800-
let (tx_bytes, tx_hash) =
801-
SendRawTransactionTest::unique_transaction_bytes_and_hash(100_001);
802-
803-
// Spawn a task that will store the block very quickly after the sync call starts
804-
let pool_clone = pool.clone();
805-
let tx_bytes_clone = tx_bytes.clone();
806-
let tx_hash_clone = tx_hash;
807-
tokio::spawn(async move {
808-
// Small delay to let the sync call submit the transaction first
809-
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
810-
811-
let mut storage = pool_clone.connection().await.unwrap();
812-
store_l2_block(
813-
&mut storage,
814-
L2BlockNumber(1),
815-
&[create_tx_result_from_bytes(&tx_bytes_clone, tx_hash_clone)],
816-
)
817-
.await
818-
.unwrap();
819-
});
820-
821-
// Call sync - it submits the transaction and should find the receipt very quickly
822-
let receipt: api::TransactionReceipt = client
823-
.request(
824-
"eth_sendRawTransactionSync",
825-
rpc_params![Bytes(tx_bytes), Option::<U256>::None],
826-
)
827-
.await?;
828-
829-
assert_eq!(receipt.transaction_hash, tx_hash);
830-
assert_eq!(receipt.block_number, U64::from(1));
831-
assert_eq!(receipt.status, U64::from(1)); // Success
832-
833-
Ok(())
834-
}
835-
}
836-
837-
// NOTE: This test cannot be implemented with the current test infrastructure.
838-
// It would require a transaction to be pre-mined before calling eth_sendRawTransactionSync,
839-
// but manually storing blocks with transactions causes "Duplicate" assertion failures
840-
// in the test infrastructure when the method tries to submit the transaction.
841-
// This scenario (calling sync on an already-mined transaction) would return a
842-
// "known transaction" error in practice, which is the correct behavior.
843-
// #[tokio::test]
844-
// async fn send_raw_transaction_sync_immediate_receipt() {
845-
// test_ws_server(SendRawTransactionSyncImmediateReceiptTest).await;
846-
// }
847-
848747
#[derive(Debug)]
849748
struct SendRawTransactionSyncDelayedReceiptTest;
850749

0 commit comments

Comments
 (0)