Closed liamzebedee closed 2 months ago
JESUS FUCKING CHRIST
This is from the Cairo whitepaper:
I like the idea of memory-mapped IO. Instead of defining a new brainfuck opcode for a "syscall interrupt", it should be possible to hook the builtin I/O operators of Brainfuck (. and ,) and build a simple IO interface.
Here's how it could work. All we want is a contract runtime. What does that entail? Programs, with persistent storage, that is permissioned only to them, and the ability to call programs within other programs.
Smart contract runtime model
Approaches:
CALL
opcode to call contracts, each contract has its own area of persistent memory aka storage, calling functions via the EVM ABI interface - ie.CALL
with 6 arguments, push ABI-coded "function selector" onto stack and then binary search at the callsite inside contract bytecodea.out
,a.exe
), then execute them through the OS which loads them into CPU, begins executing opcode by opcode. Then to read/write files, call other programs, we invoke a syscall via the interrupt opcode80h
/0x80
and pass some arguments according to theunistd.h
interface on Linux https://en.wikipedia.org/wiki/System_callSomeone implemented a syscall interrupt opcode in brainfuck - https://github.com/ajyoon/systemf