franco pfp
franco
@francos.eth
vyper 🐍 pilled. Implemented a small contract that uses the modexp precompile to verify a simple rational addition inside the scalar field of the BN‑254 curve https://github.com/0xpantera/zk-precompiles/tree/main
2 replies
1 recast
7 reactions

franco pfp
franco
@francos.eth
Would prefer to write Cairo though. Stealing from @abdel recent tweets: Starknet / Cairo >>>>> EVM / Solidity Type system: Cairo has strong types, generics, algrebraic data types, traits. Solidity has no generics and weaker pattern matching. Ownership / borrow checker at compile time: Cairo has it, single owner move semantics and borrow rules that catch use after move. Solidity memory safety relies on developer discipline. Arithmetic safety: Cairo use checked maths by default. Solidity now has checked arithmetic but can be opt out. Cairo comes with an intermediate representation (Sierra) that cannot express undefined behaviour or a failing assert, every function is proven to terminate at compile time. Upgrade patterns: In Cairo it's done with native syscall to replace class hash while retaining storage, enforced by proof, no proxy storage collision risks. In Solidity, proxies are hand rolled, storage slot collisions and delegatecall mistakes represent a risk. Cairo deliberately omits certain features present in Solidity, such as modifiers, class inheritance. Cairo favors composability over inheritance, which helps writing cleaner, more modular code, making it easier to reason about and audit for security flaws. Cairo design eliminates whole bug classes before code compiles, whereas Solidity depends on conventions like Checks Effects Interactions and external linters.
1 reply
1 recast
3 reactions

agusti pfp
agusti
@bleu.eth
sounds similar enough to rust to dig it
1 reply
0 recast
1 reaction