Hacker News new | past | comments | ask | show | jobs | submit login

Wouldn't it be cheaper to replace the method id with byte id? No need to follow solidity abi if nobody but you is going to call the contract.



For sure. The biggest challenge is once you leave Solidity entirely, it's hard to do anything but very simple operations. And actually, I did essentially do what you mentioning for our "gas refund" contracts. Basically another trick to cut gas spend is to use the refund the EVM gives for calling contract self-destruct.

You create a bunch of dummy contracts when gas is cheap. Then on your transaction where you're paying a 100x gas price to win the contract, you self-destruct as many contracts as you can to max the refund. However the self-destruct call itself costs gas, so you want to make the call as simple as possible. This is a pretty simple: 1) check caller address, invoke self-destruct. So you'd just write the entire contract directly in EVM byte code instead of using Solidity.


>The biggest challenge is once you leave Solidity entirely, it's hard to do anything but very simple operations.

You don't have to leave solidity, it could all be done in the fallback/default function, no?

For the rest, you described gas tokens, but self destruct refunds were removed with London so they are all worthless now.


Good question. I'm 90% sure that fallback function is actually implemented in byte code by comparing the byte code against all the method signatures. Then if none match, the assembly jumps to the fallback. So, what you save in 0s in the input byte code, you pay more than that in the execution gas.

Yeah, for gas tokens you're right. This was all pre-Flashbots, so talking about February or March at the latest. Flashbots kind of wrecked the whole game. Now it's a whole lot simpler, just ship transactions to Flashbots and bid as close as possible to breakeven. Consequently 90%+ of the profits now go to the miners.


>So, what you save in 0s in the input byte code, you pay more than that in the execution gas.

In this case all methods should be internal, so the preamble would have no methods at all to look for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: