diff --git a/crates/signer/src/signer.rs b/crates/signer/src/signer.rs index 080c385f..6d5e7072 100644 --- a/crates/signer/src/signer.rs +++ b/crates/signer/src/signer.rs @@ -149,7 +149,7 @@ mod test { } #[tokio::test] - async fn sign_transaction_with_aws_signer() { + async fn sign_transaction_with_kms_signer() { // Start the container running Localstack let _container = start_localstack_container().await; @@ -162,6 +162,17 @@ mod test { ) .await; + let default_tx = TxLegacy { + to: address!("d8dA6BF26964aF9D7eEd9e03E53415D37aA96045").into(), + value: U256::from(1_000_000_000), + gas_limit: 2_000_000, + nonce: 0, + gas_price: 21_000_000_000, + input: bytes!(), + chain_id: Some(1), + }; + let mut test_data: TestData = TestData::new(default_tx); + // Create an AWS KMS Client let client = aws_sdk_kms::Client::new(&config); @@ -175,22 +186,12 @@ mod test { .await .unwrap(); - let mut tx = TxLegacy { - to: address!("d8dA6BF26964aF9D7eEd9e03E53415D37aA96045").into(), - value: U256::from(1_000_000_000), - gas_limit: 2_000_000, - nonce: 0, - gas_price: 21_000_000_000, - input: bytes!(), - chain_id: Some(1), - }; - // Sign the transaction - let signature = signer.sign_transaction(&mut tx).await.unwrap(); + let signature = signer.sign_transaction(&mut test_data.input).await.unwrap(); // Recover the address let mut encoded_tx = Vec::new(); - tx.encode_for_signing(&mut encoded_tx); + test_data.input.encode_for_signing(&mut encoded_tx); let prehash = keccak256(encoded_tx); let recovered_address = signature.recover_address_from_prehash(&prehash).unwrap();