Extending address from 20 bytes to 32 won't work because of FunctionType requiring 4 bytes extra

There have been a few proposals to increase address size to 32 bytes:

However they seem to miss fact that the FunctionType requires 4 bytes extra. The current storage requirement of FunctionType is 20+4 (24) bytes. So, the maximum the address can store with current 32 byte stack limitation is 28 bytes (224 bits).

Is there a simple way to address this?

// A function type is simply the address with the function selection signature at the end.
//
// readFunctionType enforces that standard by always presenting it as a 24-array (address + sig = 24 bytes)
func readFunctionType(t Type, word byte) (funcTy [24]byte, err error) {

Depending on the scheme, it might not be much of an issue. The notion of a FunctionType is from Solidity, not at the EVM layer. The Solidity language can add new types to represent pointers to extended addresses, that will be stored on two storage slots instead of one.

There will be a need to distinguish the types of legacy function pointers and extended address function pointers. In most schemes, this is desirable anyway, as you don’t want to accidentally call an extended contract with a legacy address or vice-versa, and there might be a need for the Solidity (or any other EVM language) to insert address conversion logic.

1 Like

It does need change in the node client (like go-dp) though, in the ABI layer, where pack/unpack and topics currently hard-code FunctionTypes to 24 bytes.