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

auto: fix chain module #14140

Closed
wants to merge 6 commits into from

Conversation

FelixFan1992
Copy link
Contributor

Requires Dependencies

Resolves Dependencies

Copy link
Contributor

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found - Please include it in the PR title or in a commit message.

@@ -11,7 +11,7 @@ interface IChainModule {
// retrieve the L1 data fee for a L2 transaction. it should return 0 for L1 chains and
// L2 chains which don't have L1 fee component. it uses msg.data to estimate L1 data so
// it must be used with a transaction. Return value in wei.
function getCurrentL1Fee() external view returns (uint256);
function getCurrentL1Fee(uint256 dataSize) external view returns (uint256);
Copy link
Contributor Author

@FelixFan1992 FelixFan1992 Aug 19, 2024

Choose a reason for hiding this comment

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

option 2 is use a bytes here. but that makes L1 fee calculation extremely costly and that's what we try to avoid

@@ -16,7 +16,7 @@ contract OptimismModule is ChainModuleBase {
uint256 private constant FIXED_GAS_OVERHEAD = 60_000;
uint256 private constant PER_CALLDATA_BYTE_GAS_OVERHEAD = 270;

function getCurrentL1Fee() external view override returns (uint256) {
function getCurrentL1Fee(uint256) external view override returns (uint256) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using uint256 will make it not accurate
using bytes will make it waste lots of gas

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. passing bytes into this function
  2. concat this bytes with a padding
  3. passing the concated bytes to getL1Fee

with chain module (uint256) and V2: nothing
with chain module (bytes) and V2: 1 (BASE, OP), 1/2/3 (Scroll)

@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@FelixFan1992 FelixFan1992 changed the base branch from auto-op-eip-4844-upgrade to develop August 19, 2024 19:05
@FelixFan1992 FelixFan1992 changed the base branch from develop to auto-op-eip-4844-upgrade August 19, 2024 19:05
@FelixFan1992 FelixFan1992 deleted the auto-fix-chain-module branch August 21, 2024 21: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.

1 participant