Content pfp
Content
@
0 reply
0 recast
2 reactions

Michael Amadi pfp
Michael Amadi
@michaels
EOF-Solidity feature requests: 1) Native support for Code Section types: Defined as a struct of 4 fields: bytecode, num of inputs, num of outputs and max stack height. This is to be defined at the contract level and must be known at compile time so that it can be validated and compiled together with the solidity code. Then within any function, the code section can be called via solidity or inline assembly and outputs are to be consumed. This feature enables using custom bytecode e.g hyper optimized hand written bytecode or from another compiler be used within solidity. Example with unchecked add 3 bytecode in comments:
1 reply
0 recast
2 reactions

Michael Amadi pfp
Michael Amadi
@michaels
``` contract A { CodeSection huffCode = CodeSection(0x0101e4, 3, 1, 3); // when used in code, huffCode is a constant that holds the code section index of the variable and not the struct defined above. function b(uint256 _a, uint256 _b, uint256 _c) external view returns(uint256 _d) { _d = huffCode_a, _b, _c); } // OR function c(uint256 _a, uint256 _b, uint256 _c) external view returns(uint256 _d) { assembly { // in inline assembly, huffCode is the code section index of huffCode. The solidity version above does this under the hood. _d := callf(huffCode, _a, _b, _c) } } } ``` Also since memory is shared between code sections, similar to inline assembly the concept of memory safe code sections would also be a thing.
1 reply
0 recast
2 reactions

Michael Amadi pfp
Michael Amadi
@michaels
2) Inline assembly execution calling solidity functions with CALLF: Currently in solidity its not possible to call your contracts' solidity function while in an assembly or an assembly block's function from another assembly block. With EOF, it would be a nice feature if a shared functionality can be set as a code section and hence can be callable via CALLF from any inline assembly block within that contract.
0 reply
0 recast
2 reactions