Skip to content

Instantly share code, notes, and snippets.

View nisdas's full-sized avatar

Nishant Das nisdas

View GitHub Profile
@nisdas
nisdas / ecverify.sol
Last active March 20, 2018 05:43 — forked from axic/ecverify.sol
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
@nisdas
nisdas / rawlogData
Last active January 23, 2019 10:15
rawLogData
Dynamic Args: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000009d00000007735940000000000000000014890000003000000074657374696e6700000000000000000000000000000000000000000000000000000000000000000000000000000000003000000074657374696e670000000000000000000000000000000000000000000000000000000000000000000000000000000000ebe00197000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000080000000100000000000000000000000000000000000000000000000000000000
Static Args: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000009d0000000773594000000000000000001
@nisdas
nisdas / depContract.v.py
Created February 9, 2019 07:43
Deposit Contract
## compiled with v0.1.0-beta.7 ##
DEPOSIT_TREE_DEPTH: constant(uint256) = 32
TWO_TO_POWER_OF_TREE_DEPTH: constant(uint256) = 4294967296 # 2**32
SECONDS_PER_DAY: constant(uint256) = 86400
MAX_64_BIT_VALUE: constant(uint256) = 18446744073709551615 # 2**64 - 1
Deposit: event({deposit_root: bytes32, data: bytes[528], merkle_tree_index: bytes[8], branch: bytes32[32]})
ChainStart: event({deposit_root: bytes32, time: bytes[8]})
@nisdas
nisdas / panic.txt
Last active March 12, 2019 04:37
POWChain Panic
3-12 12:16:43] ERROR powchain: Panicked when handling data from ETH 1.0 Chain! Recovering... r=runtime error: invalid memory address or nil pointer dereference stack=goroutine 125 [running]:
github.com/prysmaticlabs/prysm/beacon-chain/powchain.safelyHandlePanic()
beacon-chain/powchain/service.go:574 +0xb8
panic(0x11189e0, 0x1f4a8e0)
GOROOT/src/runtime/panic.go:522 +0x1b5
github.com/prysmaticlabs/prysm/beacon-chain/powchain.(*Web3Service).processSubscribedHeaders(0xc0003b6b00, 0x0)
beacon-chain/powchain/service.go:469 +0x5a
github.com/prysmaticlabs/prysm/beacon-chain/powchain.(*Web3Service).run(0xc0003b6b00, 0xc000051440)
beacon-chain/powchain/service.go:460 +0x637
created by github.com/prysmaticlabs/prysm/beacon-chain/powchain.(*Web3Service).Start
@nisdas
nisdas / blocks.txt
Last active August 27, 2019 17:48
Blocks Byte Dump
1 0 0 0 0 0 0 0 139 6 51 37 15 165 94 173 10 19 110 87 138 135 164 71 116 131 106 190 221 145 129 247 35 27 1 195 117 221 37 206 183 37 9 160 254 153 225 209 110 186 221 104 24 0 255 98 3 166 10 69 47 170 140 151 111 143 203 46 153 99 103 120 172 0 0 0 175 66 133 47 254 51 157 60 40 1 4 171 22 220 29 28 12 8 153 16 227 84 6 193 149 158 164 152 212 149 3 39 178 189 114 89 81 153 213 171 221 168 113 172 58 202 112 243 10 81 235 19 159 253 170 204 38 3 107 75 35 42 28 9 120 94 107 41 4 12 148 41 192 31 236 104 25 135 242 171 63 50 212 194 39 87 198 51 149 172 177 127 109 48 212 170 138 27 232 135 213 69 28 239 81 37 227 197 71 201 0 78 27 193 60 6 116 0 162 148 137 102 44 44 193 0 194 124 3 13 161 89 90 159 183 249 159 249 18 247 23 250 130 58 6 71 171 71 15 174 179 30 239 209 234 152 98 58 15 0 171 192 118 5 82 96 10 171 203 220 243 74 210 185 155 200 155 74 129 188 173 97 220 170 134 11 16 195 58 54 10 181 195 7 182 221 131 124 76 141 108 231 249 28 254 211 134 134 46 150 28 211 24 182 155 53 83 212 99 38 115
@nisdas
nisdas / error.txt
Created August 28, 2019 04:54
Attestation Error
[2019-08-28 10:10:18] ERROR sync: Failed to handle p2p pubsub error=epoch 12 can't be greater than 5
could not determine epoch start shard
github.com/prysmaticlabs/prysm/beacon-chain/core/helpers.AttestationDataSlot
beacon-chain/core/helpers/attestation.go:45
github.com/prysmaticlabs/prysm/beacon-chain/blockchain.(*ChainService).waitForAttInclDelay
beacon-chain/blockchain/receive_attestation.go:125
github.com/prysmaticlabs/prysm/beacon-chain/blockchain.(*ChainService).ReceiveAttestationNoPubsub
beacon-chain/blockchain/receive_attestation.go:68
github.com/prysmaticlabs/prysm/beacon-chain/sync.(*RegularSync).beaconAttestationSubscriber
beacon-chain/sync/subscriber_beacon_attestation.go:17
@nisdas
nisdas / discv.txt
Last active September 4, 2019 11:03
Discv5 E2E
func createListener(ipAddr net.IP, privKey *ecdsa.PrivateKey, cfg *Config) *discover.UDPv5 {
udpAddr := &net.UDPAddr{
IP: ipAddr,
Port: int(cfg.Port),
}
conn, err := net.ListenUDP("udp4", udpAddr)
if err != nil {
log.Fatal(err)
}
localNode, err := createLocalNode(privKey, ipAddr, int(cfg.Port))
@nisdas
nisdas / interop.txt
Last active September 9, 2019 10:11
Interop Instructions
Run a beacon node
bazel run //beacon-chain --define ssz=minimal -- --datadir ~/beacon --deposit-contract 0x806773c96BF02a4F6C6D2026881CBc398D4f14e2 --no-genesis-delay --pprof --verbosity=debug --clear-db --bootstrap-node=enr:-IS4QH3_ZBzviCxMv22QxpoPEecvPmj5kHJVFJwkyTFhhN1bd1msDEjk4vhSHRarJ0yDJr7mf5g_sSmwpG8qN1wDU2YBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQM1E5yUsp9vDQj1tv3ZWXCvaFBvrPNdz8KPI1NhxfQWzIN1ZHCCD6A --peer=/ip4/192.168.1.71/tcp/9000/p2p/16Uiu2HAmDxrqPnD6xitN8MxPHnqwugqd3jbJxqMKdRZSxf52b34j --interop-genesis-state /home/nishant/Desktop/genesis.ssz --interop-eth1data-votes
@nisdas
nisdas / make_genesis.sh
Created September 11, 2019 13:10
Nimbus-make Genesis
#!/bin/bash
set -eo pipefail
# Read in variables
source "$(dirname "$0")/vars.sh"
# set up the environment
source "${SIM_ROOT}/../env.sh"
@nisdas
nisdas / vars.sh
Created September 11, 2019 13:11
Nimbus-vars.sh
#!/bin/bash
PWD_CMD="pwd"
# get native Windows paths on Mingw
uname | grep -qi mingw && PWD_CMD="pwd -W"
cd $(dirname $0)
SIM_ROOT="$($PWD_CMD)"