Skip to content

Instantly share code, notes, and snippets.

@meowsbits
meowsbits / main.go
Created January 28, 2020 00:35 — forked from cryptix/main.go
using go/ast to find specific function calls and the values of a parameter
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"log"
)

The interrelated stories of at least but not limited to EIP1283, EIP1706, EIP2200, EIP1884, ECIP1061, ECIP1078, and ECIP1086.

EIP1283 comes into existence. Has way of net gas metering. Gets Finalized.

EIP____ ("Constantinople") comes into existence specifying enabling EIP1283 on ETH (and testnets).

EIP1283 enabled on Ropsten and other testnets.

Uh oh! EIP1283 has bugs.

@meowsbits
meowsbits / EIP1884.md
Created March 2, 2020 12:47 — forked from ritzdorf/EIP1884.md
Recently Executed Transactions affected by EIP1884

Recently Executed Contracts with Issues in EIP 1884

EIP 1884 is set to be implemented into the upcoming Ethereum 'Istanbul' hard fork. It

  • increases the cost of opcode SLOAD from 200 to 800 gas
  • increases the cost of BALANCE and EXTCODEHASH from 400 to 700 gas
  • adds a new opcode SELFBALANCE with cost 5.
#!/usr/bin/env bash
SO_SSVM=/home/ia/dev/second-state/SSVM/build/tools/ssvm-evmc/libssvmEVMC.so
SO_HERA=/home/ia/dev/ewasm/hera/build/src/libhera.so
SO_PATH=''
if [[ $1 = ssvm ]]; then
SO_PATH="$SO_SSVM"
elif [[ $1 = hera ]]; then
84: cumulative: 5505330 gas: 280358 contract: 0x0000000000000000000000000000000000000000 status: 1 tx: 0x05cf5ec99628ed509e2f1bd38055eaec8c1e3c84d125fb154b2d502d0552c657 logs: [0xc0000d3ce0] bloom: 00000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000200000000000000100000000000000000000004000000000008000000000000100000000000040000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000220000000000000000000800000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000 state:
85: cumulative: 5526330 gas: 21000 contract: 0x0000000000000000000000000000000000000000 status: 1 tx: 0x97ea613d80a11d900b059324815d75c218ae4a150b3cd44afba3c7f4d96d4491 logs: [] bloom: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
{
"openrpc": "1.2.4",
"info": null,
"methods": [
{
"name": "MyCalculator.PlusOne",
"description": "```go\nfunc (c *MyCalculator) PlusOne(arg *PlusOneArg, reply *PlusOneReply) error {\n\tif arg == nil {\n\t\treturn errBadUse\n\t}\n\tanswer := *arg + 1\n\tc.history = append(c.history, int(answer))\n\t*reply = (PlusOneReply)(answer)\n\treturn nil\n}// PlusOne is deceivingly simple function that increments any value by 1.\n\n```",
"summary": "PlusOne is deceivingly simple function that increments any value by 1.\n",
"paramStructure": "by-position",
"params": [
@meowsbits
meowsbits / swapfile.sh
Created May 23, 2020 19:04
Create and enable a swap file.
# Is swap memory already in use?
root@my-computer:~$ free
total used free shared buff/cache available
Mem: 4039400 2454264 105892 1152 1479244 1346484
Swap: 0 0 0
root@my-computer:~$ touch /var/swap.img
root@my-computer:~$ chmod 600 /var/swap.img
root@my-computer:~$ swap_megabytes=1000
@meowsbits
meowsbits / geth.miner-hashrate-floor-monitor.js
Created May 28, 2020 12:42
When and if geth's CPU miner drops below floor hashrate, switch off and restart mining after an interval.
var hashrateFloor = 20000;
for (;true;) {
var sleepInterval = 60;
if (!eth.mining) {
console.log(Date(), "starting miner")
miner.start();
sleepInterval = 60*10;
}
var hashrate = miner.getHashrate();
console.log(Date() , "hashrate", hashrate);
@meowsbits
meowsbits / geth.core.block_validator.go-block-gaslimit-max-step.diff
Created May 28, 2020 18:54
Maximized block gas limit steps for miners with strong opinions.
diff --git a/core/block_validator.go b/core/block_validator.go
index 37bea2b246..862ee952cc 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -107,34 +107,19 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
// ceil if the blocks are full. If the ceil is exceeded, it will always decrease
// the gas allowance.
func CalcGasLimit(parent *types.Block, gasFloor, gasCeil uint64) uint64 {
- // contrib = (parentGasUsed * 3 / 2) / 1024
- contrib := (parent.GasUsed() + parent.GasUsed()/2) / vars.GasLimitBoundDivisor
@meowsbits
meowsbits / coregeth_mordor.service.sh
Last active June 2, 2020 12:22
Example systemd unit file for running Mordor network on core-geth.
#!/usr/bin/env bash
cat <<EOF > /etc/systemd/system/coregeth_mordor.service
[Unit]
Description=CoreGeth Mordor
[Service]
Type=simple
User=root
Restart=always