|
1 | 1 | use crate::{EncodableSignature, SignableTransaction, Signed, Transaction, TxType};
|
2 | 2 | use alloy_eips::eip2930::AccessList;
|
3 | 3 | use alloy_primitives::{keccak256, Bytes, ChainId, Signature, TxKind, B256, U256};
|
4 |
| -use alloy_rlp::{length_of_length, BufMut, Decodable, Encodable, Header}; |
| 4 | +use alloy_rlp::{BufMut, Decodable, Encodable, Header}; |
5 | 5 | use core::mem;
|
6 | 6 |
|
7 | 7 | #[cfg(not(feature = "std"))]
|
@@ -269,19 +269,6 @@ impl TxEip7702 {
|
269 | 269 | self.input.len() + // input
|
270 | 270 | self.authorization_list.capacity() * mem::size_of::<SignedAuthorization>() // authorization_list
|
271 | 271 | }
|
272 |
| - |
273 |
| - /// Output the length of the RLP signed transaction encoding, _without_ a RLP string header. |
274 |
| - pub fn payload_len_with_signature_without_header(&self, signature: &Signature) -> usize { |
275 |
| - let payload_length = self.fields_len() + signature.rlp_vrs_len(); |
276 |
| - // 'transaction type byte length' + 'header length' + 'payload length' |
277 |
| - 1 + length_of_length(payload_length) + payload_length |
278 |
| - } |
279 |
| - |
280 |
| - /// Output the length of the RLP signed transaction encoding. This encodes with a RLP header. |
281 |
| - pub fn payload_len_with_signature(&self, signature: &Signature) -> usize { |
282 |
| - let len = self.payload_len_with_signature_without_header(signature); |
283 |
| - length_of_length(len) + len |
284 |
| - } |
285 | 272 | }
|
286 | 273 |
|
287 | 274 | impl Transaction for TxEip7702 {
|
@@ -401,66 +388,10 @@ impl Decodable for TxEip7702 {
|
401 | 388 |
|
402 | 389 | #[cfg(all(test, feature = "k256"))]
|
403 | 390 | mod tests {
|
404 |
| - use core::str::FromStr; |
405 |
| - |
406 | 391 | use super::TxEip7702;
|
407 | 392 | use crate::SignableTransaction;
|
408 | 393 | use alloy_eips::eip2930::AccessList;
|
409 |
| - use alloy_primitives::{address, b256, hex, Address, Bytes, Signature, TxKind, U256}; |
410 |
| - |
411 |
| - #[test] |
412 |
| - fn test_payload_len_with_signature_without_header() { |
413 |
| - let tx = TxEip7702 { |
414 |
| - chain_id: 1u64, |
415 |
| - nonce: 0, |
416 |
| - max_fee_per_gas: 0x4a817c800, |
417 |
| - max_priority_fee_per_gas: 0x3b9aca00, |
418 |
| - gas_limit: 2, |
419 |
| - to: TxKind::Create, |
420 |
| - value: U256::ZERO, |
421 |
| - input: Bytes::from(vec![1, 2]), |
422 |
| - access_list: Default::default(), |
423 |
| - authorization_list: Default::default(), |
424 |
| - }; |
425 |
| - |
426 |
| - let signature = Signature::from_rs_and_parity( |
427 |
| - U256::from_str("0xc569c92f176a3be1a6352dd5005bfc751dcb32f57623dd2a23693e64bf4447b0") |
428 |
| - .unwrap(), |
429 |
| - U256::from_str("0x1a891b566d369e79b7a66eecab1e008831e22daa15f91a0a0cf4f9f28f47ee05") |
430 |
| - .unwrap(), |
431 |
| - 1, |
432 |
| - ) |
433 |
| - .unwrap(); |
434 |
| - |
435 |
| - assert_eq!(tx.payload_len_with_signature_without_header(&signature), 91); |
436 |
| - } |
437 |
| - |
438 |
| - #[test] |
439 |
| - fn test_payload_len_with_signature() { |
440 |
| - let tx = TxEip7702 { |
441 |
| - chain_id: 1u64, |
442 |
| - nonce: 0, |
443 |
| - max_fee_per_gas: 0x4a817c800, |
444 |
| - max_priority_fee_per_gas: 0x3b9aca00, |
445 |
| - gas_limit: 2, |
446 |
| - to: TxKind::Create, |
447 |
| - value: U256::ZERO, |
448 |
| - input: Bytes::from(vec![1, 2]), |
449 |
| - access_list: Default::default(), |
450 |
| - authorization_list: Default::default(), |
451 |
| - }; |
452 |
| - |
453 |
| - let signature = Signature::from_rs_and_parity( |
454 |
| - U256::from_str("0xc569c92f176a3be1a6352dd5005bfc751dcb32f57623dd2a23693e64bf4447b0") |
455 |
| - .unwrap(), |
456 |
| - U256::from_str("0x1a891b566d369e79b7a66eecab1e008831e22daa15f91a0a0cf4f9f28f47ee05") |
457 |
| - .unwrap(), |
458 |
| - 1, |
459 |
| - ) |
460 |
| - .unwrap(); |
461 |
| - |
462 |
| - assert_eq!(tx.payload_len_with_signature(&signature), 93); |
463 |
| - } |
| 394 | + use alloy_primitives::{address, b256, hex, Address, Signature, TxKind, U256}; |
464 | 395 |
|
465 | 396 | #[test]
|
466 | 397 | fn encode_decode_eip7702() {
|
|
0 commit comments