Why Kernel Is Not Written in Huff

Why extensibility, auditability, testing, and development speed matter more than marginal gas savings for Kernel.

A ZeroDev customer asked whether we would ever rewrite Kernel in Huff to squeeze out more gas savings. The answer is a clear no.

Extensibility

I want Kernel to remain extensible and easy to understand so that plugin developers can engage with it. Writing Kernel in Huff would sacrifice those qualities and make it less extensible.

Security

As far as I know, there are not many auditors capable of reviewing Huff. I do not blame them: its syntax and the intent of the code are difficult to understand. That would make security reviews much more expensive without guaranteeing proper results.

Testing

Because I prioritize Kernel’s security, I make sure it meets my testing criteria. I consider testing a first-class security measure, and I think it is better than an audit, but Huff limits it.

Productivity

You may have seen an ERC-4337 EntryPoint or wallet written in Huff. Writing one takes me roughly ten times longer than writing it in Solidity. That can still provide valuable input, but we cannot risk that amount of time for a small gas reduction.

Experiments

I am experimenting with Huff to find gas optimizations that I can apply in Solidity and to check whether I understand what is happening under the hood.

I will continue testing Huff for experimental work that might be applied in future updates, although I cannot guarantee anything. There is a very low probability that we will use Huff as Kernel’s primary language.