design icon indicating copy to clipboard operation
design copied to clipboard

Define ABI

Open axic opened this issue 9 years ago • 4 comments

The word ABI is overused in ethereum and I think there are several levels to it. Not all of them are properly documented:

  • the way contracts pass data between themselves (was depending on the language, now it seems to be converging), this includes precompiled contracts
  • the way external inputs are entered to the contract (both during calls and creation) - it is defined in the Contract ABI
  • the way storage is used (specific to the language)

Since eWASM changes the word size from 256 bit to at most 64 bit, it is important to state whether it will follow the same ABI for contract data passing or define a new one, more appropriate to its word size.

axic avatar Mar 08 '16 15:03 axic

Why not fixing word size with 64-bit?

chfast avatar Mar 08 '16 15:03 chfast

For case 2) it is a question of compatibility - does it want to be compatible with the current Contract ABI (and therefore web3.js and client apps).

For the other cases it is only about actually writing a specification down as we don't have any even for EVM1 on that matter.

See also #2

axic avatar Mar 08 '16 15:03 axic

Can WASM code export multiple methods?

Each of the ABI signatures could be an exported method and this removes the need of writing a dispatcher as we have in current EVM/Solidity.

Example set of ABI methods:

5c19a95c delegate(address)
9e7b8d61 giveRightToVote(address)
b3f98adc vote(uint8)
609ff1bd winningProposal()

would become:

(func $5c19a95c (param ...
(func $9e7b8d61 (param ...

Update: well, I guess it really has to stay within a dispatcher given this is part of the calldata. Well at least proper methods can be defined in WASM.

axic avatar Apr 14 '16 01:04 axic

one problem with that @axic is that funcs in wasm can only return a single parameter

wanderer avatar Apr 14 '16 01:04 wanderer