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

Gas saving: Expose another initialize method without hook #97

Open
KONFeature opened this issue Apr 17, 2024 · 1 comment
Open

Gas saving: Expose another initialize method without hook #97

KONFeature opened this issue Apr 17, 2024 · 1 comment

Comments

@KONFeature
Copy link
Contributor

When a hook isn't wanted during the init of a Kernel, we still have to send an 0 address + empty array of bytes

function initialize(ValidationId _rootValidator, IHook hook, bytes calldata validatorData, bytes calldata hookData)

Having another initialize method without this data could save up a bit of gas on L2, since less calldata sent (and this data is required to be sent during the contract creation, on arbitrum, it's approx 24k ArbGas that could be saved), smth like that:

function initialize(ValidationId _rootValidator, bytes calldata _validatorData) external {
  // ... Same as before
  // Hook setup would be: 
  ValidationConfig memory config = ValidationConfig({nonce: uint32(1), hook: address(0) });
  _installValidationWithoutNonceIncremental(_rootValidator, config, _validatorData, 0x);
}

Ooh and btw, the ValidationConfig fit on 32 bytes, so similarly to the custom ValidationId or ExecMode, type ValidationConfig could be a custom type on top of bytes32, saving up a bit on computation cost on L1 / alt L1

@leekt
Copy link
Collaborator

leekt commented Apr 19, 2024

nice idea :), we are adding some initialization flow on kernel v3.1, i think this can be added while doing that

@zerodevapp zerodevapp deleted a comment Jun 14, 2024
@zerodevapp zerodevapp deleted a comment Jun 14, 2024
@zerodevapp zerodevapp deleted a comment Jun 14, 2024
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

No branches or pull requests

2 participants