Skip to content

Instantly share code, notes, and snippets.

View evan-forbes's full-sized avatar

Evan Forbes evan-forbes

View GitHub Profile
@evan-forbes
evan-forbes / online_offline_test.go
Created June 3, 2021 18:09
test to figure out is we can use the online and offline api's interchangeably
func TestOnlineOfflineIPFSAPI(t *testing.T) {
ipfsNode, err := coremock.NewMockNode()
if err != nil {
t.Error(err)
}
ipfsAPI, err := coreapi.NewCoreAPI(ipfsNode)
if err != nil {
t.Fatal(err)
}
@evan-forbes
evan-forbes / gist:1230b0ae31605fe99222cc82051adb64
Created May 31, 2022 16:13
Resyncing success (switching from legacy=true to lagacy=false) Stack dump (resync-legacy-false-2-success)
goroutine 8565 [running]:
runtime/pprof.writeGoroutineStacks({0x29e2a20, 0xc0032c3c00})
/home/evan/.go/src/runtime/pprof/pprof.go:693 +0x70
runtime/pprof.writeGoroutine({0x29e2a20, 0xc0032c3c00}, 0x0)
/home/evan/.go/src/runtime/pprof/pprof.go:682 +0x2b
runtime/pprof.(*Profile).WriteTo(0x1e7c520, {0x29e2a20, 0xc0032c3c00}, 0xc)
/home/evan/.go/src/runtime/pprof/pprof.go:331 +0x14b
net/http/pprof.handler.ServeHTTP({0xc02a558311, 0x3c00060}, {0x2a03d68, 0xc0032c3c00}, 0xc02a558304)
/home/evan/.go/src/net/http/pprof/pprof.go:253 +0x49a
net/http/pprof.Index({0x2a03d68, 0xc0032c3c00}, 0xc000d04a00)
@evan-forbes
evan-forbes / gist:4dd50fdc1f42def01401cc842e5b4608
Created June 1, 2022 15:08
Stack trace: running genesis validator with v0.35.x, pex=false, legacy=false
goroutine 141369 [running]:
runtime/pprof.writeGoroutineStacks({0x2a1a840, 0xc001c2aee0})
/snap/go/9760/src/runtime/pprof/pprof.go:694 +0x70
runtime/pprof.writeGoroutine({0x2a1a840?, 0xc001c2aee0?}, 0x0?)
/snap/go/9760/src/runtime/pprof/pprof.go:683 +0x2b
runtime/pprof.(*Profile).WriteTo(0x1e8f500?, {0x2a1a840?, 0xc001c2aee0?}, 0xc?)
/snap/go/9760/src/runtime/pprof/pprof.go:332 +0x14b
net/http/pprof.handler.ServeHTTP({0xc0069d58a1, 0x9}, {0x2a307e8, 0xc001c2aee0}, 0x736f686c61636f6c?)
/snap/go/9760/src/net/http/pprof/pprof.go:253 +0x4a5
net/http/pprof.Index({0x2a307e8?, 0xc001c2aee0}, 0xc003650100)
goroutine 0 [idle]:
runtime.futex()
/home/evan/.go/src/runtime/sys_linux_amd64.s:552 +0x21
runtime.futexsleep(0x10000000000?, 0x0?, 0x3?)
/home/evan/.go/src/runtime/os_linux.go:66 +0x36
runtime.notesleep(0x3a85308)
/home/evan/.go/src/runtime/lock_futex.go:159 +0x87
runtime.mPark(...)
/home/evan/.go/src/runtime/proc.go:1449
runtime.stopm()
@evan-forbes
evan-forbes / gist:3a1204ff1f22eb708f4b80f142803a69
Created January 19, 2023 02:06
bump celestia-node to celestia-app v0.12.0 race detected
==================
WARNING: DATA RACE
Read at 0x00c01e401b50 by goroutine 116016:
github.com/celestiaorg/celestia-node/das.(*coordinatorState).waitCatchUp()
/home/evan/go/src/github.com/celestiaorg/celestia-node/das/state.go:227 +0x64
github.com/celestiaorg/celestia-node/das.(*DASer).WaitCatchUp()
/home/evan/go/src/github.com/celestiaorg/celestia-node/das/daser.go:175 +0x64
github.com/celestiaorg/celestia-node/nodebuilder/tests.TestSyncFullWithBridge()
/home/evan/go/src/github.com/celestiaorg/celestia-node/nodebuilder/tests/sync_test.go:183 +0x7e7
github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
@evan-forbes
evan-forbes / plot_gas_consumption.py
Created July 25, 2023 10:41
Script to visualize gas consumption traces
import sys
import json
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def plot_gas_consumption(trace, color_map):
gas_readings = trace['readings']
descriptions = [reading['description'] for reading in gas_readings]
gas_values = [reading['amount'] for reading in gas_readings]
cumulative_gas = [sum(gas_values[:i+1]) for i in range(len(gas_values))]