|
|
|
|
|
by remcob
3110 days ago
|
|
Solidity is a complex moving target with limitations such as max 16 local variables, missing optimizations and only partial support for dynamic allocation. You might want to compile directly to EVM instead of through Solidity. The EVM is very simple, as far as virtual machines go. It's fully documented in [the yellow paper](https://ethereum.github.io/yellowpaper/paper.pdf) and only changes with hardforks (and then only incrementally in a backwards compatible way). Smart contract development feels like embedded systems development. Every instruction has a significant cost associated to it. There are different memory spaces like a Harvard architecture (code, memory, storage, input, output, other peoples code). Like embedded systems, you need to be absolutely sure your code is correct before you deploy, as updates are impossible and a lot of economic value depends on correctness. But contrary to embedded systems it has 256 bit registers, 256 bit address space and SHA3 as a cheap instruction. This means that if you pick a 'random' hash, you can safely assume it's free! Hashtables in Solidity are implemented like this. Recently I've been doing some combined Solidity/EVM-assembly that I wrote about [here](https://medium.com/wicketh/mathemagic-chinese-remainder-theo...). I'll post more this month doing some advanced tricks in Solidity/EVM. |
|