| layout | title | date |
|---|---|---|
post |
EVM implementation references |
2017-10-02 17:11 |
- Determines which opcodes are valid in each epoch, and also has a 'read-only' mode for byzantium:
- Just objects with opcodes:
| $ npm test | |
| > [email protected] test /Users/primary/Projects/cryptokitties-bounty | |
| > truffle test | |
| Compiling ./contracts/Auction/ClockAuction.sol... | |
| Compiling ./contracts/Auction/ClockAuctionBase.sol... | |
| Compiling ./contracts/Auction/SaleClockAuction.sol... | |
| Compiling ./contracts/Auction/SiringClockAuction.sol... | |
| Compiling ./contracts/Debuggable.sol... |
| function controlSelf() { | |
| eval "defaults write org.eyebeam.SelfControl BlockDuration -int $1" | |
| extras="" | |
| if [ "$2" = "nuke" ]; then | |
| extras="inbox.google.com slack.com" | |
| fi | |
| blacklist="facebook.com news.ycombinator.com reddit.com twitter.com $extras" | |
| eval "defaults write org.eyebeam.SelfControl HostBlacklist -array $blacklist" | |
| defaults read org.eyebeam.SelfControl | |
| sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install > /dev/null 2>&1 |
| pragma solidity ^0.4.18; | |
| // Some sample code for better understanding the implications of the storage/memory keywords | |
| // when used in function args | |
| library Libby { | |
| struct Nums { | |
| uint8 num; | |
| uint8 num2; |
| { | |
| "NOTE": "this JSON file configures solhint for errors on security risks, and warnings on areas that should be scrutinized further. It ignores items of style as configured.", | |
| "rules": { | |
| "reentrancy": "error", | |
| "avoid-sha3": "error", | |
| "avoid-suicide": "error", | |
| "avoid-throw": "error", | |
| "func-visibility": "error", | |
| "state-visibility": "error", | |
| "check-send-result": "error", |
| layout | title | date |
|---|---|---|
post |
EVM implementation references |
2017-10-02 17:11 |
| ## [It would be nice to import a library, another contract's interface, or a | |
| ## parent to inherit from] | |
| ## but that's not supported. Yes, inheritance is dangerous, but code reuse can | |
| ## be very beneficial as | |
| ## well. I believe adoption will be held back by this. | |
| ## [Declare a positive number] Why change the type from `uint256`? `num` is | |
| ## less descriptive, ie. it could include irrational numbers for all I know. | |
| ## Also, will 4-byte identifiers be compatible with solidity? | |
| ## ie. `bytes4(keccak256('uint256'))` or `bytes4(keccak256('num'))` ? Or is |
| 1544a46634426c84943c1b63667209200aad493d |
| pragma solidity ^0.4.0; | |
| contract C { | |
| uint[] x; // the data location of x is storage | |
| // the data location of memoryArray is memory | |
| function f(uint[] memoryArray) public { | |
| x = memoryArray; // works, copies the whole array to storage | |
| var y = x; // works, assigns a pointer, data location of y is storage | |
| y[7]; // fine, returns the 8th element |
| layout | title | date |
|---|---|---|
post |
contract creation golf |
2018-02-22 17:33 |
Fun little learning exercise, what's the shortest bytecode you can send that will publish a contract with non-zero bytecode? The response to getCode() should have some characters that aren’t either 0 or x.
To test it out:
| pragma solidity ^0.4.10; | |
| // Based on Alex Miller's design, with minor revisions to appease the compiler, and incorporate Christian Lundkvist's | |
| // input about hash collisions. | |
| contract Bitcoin { | |
| struct UTXO { | |
| address owner; | |
| uint value; |