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

add block limit #2

Merged
merged 4 commits into from
Apr 5, 2023
Merged

add block limit #2

merged 4 commits into from
Apr 5, 2023

Conversation

pinges
Copy link
Collaborator

@pinges pinges commented Apr 4, 2023

PR description

Adding first try to enforce block call data limit

pinges and others added 3 commits April 4, 2023 17:09
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Copy link
Collaborator

@fab-10 fab-10 left a comment

Choose a reason for hiding this comment

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

I pushed a commit to implement my comments

names = {BLOCK_MAX_CALLDATA_SIZE},
paramLabel = "<INTEGER>",
description =
"If specified, overrides the max size in bytes allowed in the transaction calldata field, specified by the current hard fork")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adapt the description to block max calldata size

@@ -534,4 +557,13 @@ private boolean blockOccupancyAboveThreshold() {
occupancyRatio);
return occupancyRatio >= minBlockOccupancyRatio;
}

private Optional<TransactionSelectionResult> maxCalldataEnforcer(final Transaction transaction) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems this could simplified to just return a boolean

@@ -12,6 +12,7 @@
import java.util.Set;

public class LineaProtocolSpecs {
public static final int DEFAULT_BLOCK_MAX_CALLDATA_SIZE = 1000000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be private

@@ -304,6 +321,12 @@ private TransactionSelectionResult evaluateTransaction(
throw new CancellationException("Cancelled during transaction selection.");
}

final Optional<TransactionSelectionResult> maybeResult =
Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems this could simplified to be a Predicate

@@ -52,6 +53,7 @@ static ProtocolSpecBuilder lineaDefinition(
TransactionType.EIP1559),
quorumCompatibilityMode,
txCalldataMaxSize))
.lineaParameters(lineaParameters)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should not pass lineaParameters here, but we can abstract and pass only calldata limits, also because lineaParameters only contain the configuration overrides, and not the value specified in the hard fork definition

Comment on lines 397 to 399
public LineaParameters getLineaParameters() {
return lineaParameters;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

as described before, we can replace this with blockMaxCalldataSize

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 merged commit b559b37 into main Apr 5, 2023
@fab-10 fab-10 deleted the addBlockCallDataLimit branch April 5, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants