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

Make EIP-4844 parameters configurable #6192

Merged
merged 6 commits into from
Oct 18, 2023
Merged

Make EIP-4844 parameters configurable #6192

merged 6 commits into from
Oct 18, 2023

Conversation

rubo
Copy link
Contributor

@rubo rubo commented Oct 13, 2023

Changes

  • Made the following EIP-4844 parameters configurable with chain spec:

    • BLOB_GASPRICE_UPDATE_FRACTION
    • MAX_BLOB_GAS_PER_BLOCK
    • MIN_BLOB_GASPRICE
    • TARGET_BLOB_GAS_PER_BLOCK

    The default EIP-4844 parameters can be overridden by defining them in a chain spec file (e.g., gnosis.json). Otherwise, the hardcoded defaults are used.

  • Refactored some parameter names to match the ones in EIP-4844.

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

@rubo rubo marked this pull request as ready for review October 14, 2023 13:38
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

I see we are going with the hacky version, but should be good enough for now

@@ -40,11 +40,14 @@
}
},
"params": {
"blobGasPriceUpdateFraction": "0x10fafa",
Copy link
Member

Choose a reason for hiding this comment

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

very minor: maybe keep cancun values close to each other rather than alphabetic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it brings much value, as not everyone knows what parameter belongs to EIP-4844 or Cancun while it's always easy to check visually whether a particular parameter is defined.

@@ -41,11 +41,14 @@
}
},
"params": {
"blobGasPriceUpdateFraction": "0x10fafa",
Copy link
Member

Choose a reason for hiding this comment

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

should we put into gnosis when we are not doing hardfork yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's your concern exactly? How can this be a problem?

@@ -258,6 +259,14 @@ public void Chiado_loads_properly()
VerifyGnosisShanghaiExceptions(preShanghaiSpec, postShanghaiSpec);
GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy(
t => ValidateSlotByTimestamp(t, ChiadoSpecProvider.BeaconChainGenesisTimestamp, GnosisBlockTime).Should().BeTrue());

Assert.Multiple(() =>
Copy link
Member

Choose a reason for hiding this comment

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

This test can still be Parallelizable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, nothing in NUnit docs indicates otherwise.

Comment on lines 49 to 55
public static void OverrideBlobGasPriceUpdateFraction(UInt256 value) => BlobGasPriceUpdateFraction = value;

public static void OverrideMaxBlobGasPerBlock(ulong value) => MaxBlobGasPerBlock = value;

public static void OverrideMinBlobGasPrice(UInt256 value) => MinBlobGasPrice = value;

public static readonly UInt256 BlobGasUpdateFraction = 3338477;
public static readonly UInt256 MinBlobGasPrice = 1;
public static void OverrideTargetBlobGasPerBlock(ulong value) => TargetBlobGasPerBlock = value;
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense for the mutators to be granular or maybe we should have just one taking all parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also was thinking about this. If we move all mutators to a single method, we also move all null checks to that method and always call, say, Eip4844Constants.OverrideValues(...) in the chain spec loader. For a developer, it looks like we always override those values (until they dig into the method to see those checks), while I find it more explanatory when null checks are visible in the chain spec loader. So it's immediately obvious we override the values only if they are defined in the chain spec.

@rubo
Copy link
Contributor Author

rubo commented Oct 17, 2023

I see we are going with the hacky version, but should be good enough for now

@LukaszRozmej As already has been discussed, I chose the same solution as we have for Eip1559Constants.

@rubo rubo merged commit b81e73a into master Oct 18, 2023
61 checks passed
@rubo rubo deleted the feature/eip-4844-config branch October 18, 2023 13:33
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.

3 participants