Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix length calculations of blob-type txs #5884

Merged
merged 7 commits into from
Jul 6, 2023

Conversation

marcindsobczak
Copy link
Contributor

Changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

@@ -201,7 +201,7 @@ public class SystemTransaction : Transaction { }
/// <remarks>Created because of cyclic dependencies between Core and Rlp modules</remarks>
public interface ITransactionSizeCalculator
{
int GetLength(Transaction tx);
int GetNetworkTxLength(Transaction tx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it as GetLength and then have a NetworkTransactionSizeCalculator that would take TxDecoder and call GetLength(tx, RlpBehaviors.InMempoolForm);

Then you can reuse this interface for other calculators if needed, rather than hardcoding that in TxDecoder.

@@ -136,7 +136,7 @@ private void ClearPreHashInternal()
/// </summary>
public int GetLength(ITransactionSizeCalculator sizeCalculator)
{
return _size ??= sizeCalculator.GetLength(this);
return _size ??= sizeCalculator.GetNetworkTxLength(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now there is no differentiation what _size is. Makes it confusing.

@@ -136,7 +136,7 @@ private void ClearPreHashInternal()
/// </summary>
public int GetLength(ITransactionSizeCalculator sizeCalculator)
{
return _size ??= sizeCalculator.GetNetworkTxLength(this);
return _size ??= sizeCalculator.GetLength(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_size can be confusing as it will differ per sizecalculator

# Conflicts:
#	src/Nethermind/Nethermind.TxPool/TransactionExtensions.cs
@marcindsobczak marcindsobczak merged commit 88e4d31 into master Jul 6, 2023
61 checks passed
@marcindsobczak marcindsobczak deleted the fix/blob_length_calcs branch July 6, 2023 14:53
marcindsobczak added a commit that referenced this pull request Jul 6, 2023
* regression test

* fix

* fiz typo

* adjust test

* rename GetLength to GetNetworkTxLength

* refactor

(cherry picked from commit 88e4d31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants