Skip to content

Commit

Permalink
feat: expose encoded_len_with_signature() (alloy-rs#1063)
Browse files Browse the repository at this point in the history
* feat: expose encoded_len_with_signature()

* nit: fmt
  • Loading branch information
leruaa authored and ben186 committed Jul 27, 2024
1 parent be78597 commit 283e8cb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
6 changes: 1 addition & 5 deletions crates/consensus/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,7 @@ impl TxEip1559 {
///
/// If `with_header` is `true`, the payload length will include the RLP header length.
/// If `with_header` is `false`, the payload length will not include the RLP header length.
pub(crate) fn encoded_len_with_signature(
&self,
signature: &Signature,
with_header: bool,
) -> usize {
pub fn encoded_len_with_signature(&self, signature: &Signature, with_header: bool) -> usize {
// this counts the tx fields and signature fields
let payload_length = self.fields_len() + signature.rlp_vrs_len();

Expand Down
6 changes: 1 addition & 5 deletions crates/consensus/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ impl TxEip2930 {
///
/// If `with_header` is `true`, the payload length will include the RLP header length.
/// If `with_header` is `false`, the payload length will not include the RLP header length.
pub(crate) fn encoded_len_with_signature(
&self,
signature: &Signature,
with_header: bool,
) -> usize {
pub fn encoded_len_with_signature(&self, signature: &Signature, with_header: bool) -> usize {
// this counts the tx fields and signature fields
let payload_length = self.fields_len() + signature.rlp_vrs_len();

Expand Down
6 changes: 1 addition & 5 deletions crates/consensus/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,7 @@ impl TxEip4844 {
///
/// If `with_header` is `true`, the payload length will include the RLP header length.
/// If `with_header` is `false`, the payload length will not include the RLP header length.
pub(crate) fn encoded_len_with_signature(
&self,
signature: &Signature,
with_header: bool,
) -> usize {
pub fn encoded_len_with_signature(&self, signature: &Signature, with_header: bool) -> usize {
// this counts the tx fields and signature fields
let payload_length = self.fields_len() + signature.rlp_vrs_len();

Expand Down
6 changes: 1 addition & 5 deletions crates/consensus/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ impl TxEip7702 {
///
/// If `with_header` is `true`, the payload length will include the RLP header length.
/// If `with_header` is `false`, the payload length will not include the RLP header length.
pub(crate) fn encoded_len_with_signature(
&self,
signature: &Signature,
with_header: bool,
) -> usize {
pub fn encoded_len_with_signature(&self, signature: &Signature, with_header: bool) -> usize {
// this counts the tx fields and signature fields
let payload_length = self.fields_len() + signature.rlp_vrs_len();

Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl TxLegacy {

/// Returns what the encoded length should be, if the transaction were RLP encoded with the
/// given signature.
pub(crate) fn encoded_len_with_signature(&self, signature: &Signature) -> usize {
pub fn encoded_len_with_signature(&self, signature: &Signature) -> usize {
let payload_length = self.fields_len() + signature.rlp_vrs_len();
Header { list: true, payload_length }.length() + payload_length
}
Expand Down

0 comments on commit 283e8cb

Please sign in to comment.