Skip to content

Instantly share code, notes, and snippets.

View michaelsproul's full-sized avatar

Michael Sproul michaelsproul

View GitHub Profile
@michaelsproul
michaelsproul / witch_hunter_warband.json
Created January 2, 2024 09:37
Michael's Witch Hunters for Mordheim at Exiles
{
"name": "Witch Hunters",
"units": [
{
"count": 1,
"profile": {
"name": "Witch Hunter Captain",
"kind": "hero",
"movement": 4,
"weaponSkill": 4,
@michaelsproul
michaelsproul / geth_sync.sh
Created May 16, 2021 05:41
Check Geth sync status via HTTP JSON RPC
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' "http://localhost:8545"
@michaelsproul
michaelsproul / allies_buy_more.txt
Last active June 13, 2023 12:36
Dominion kingdoms for [Dominion, Prosperity, Intrigue]
https://dominionrandomizer.com/?supply=festival,forts,investment,library,moat,specialist,throneroom,tiara,underling,village&ally=arthitectsguild
@michaelsproul
michaelsproul / lido_rmc.md
Created December 13, 2022 04:27
Lido DAO Relay Maintenance Committee

Here is a signed message from my wallet 0x6b29132ea388a308578c1d3be068d0e4fc9915a2, signalling my intent to join the Lido DAO relay maintenance committee.

{
  "address": "0x6b29132ea388a308578c1d3be068d0e4fc9915a2",
  "msg": "0x407370726f756c4d5f206973206c6f6f6b696e6720746f206a6f696e20746865204c69646f2044414f2052656c6179204d61696e74656e616e636520436f6d6d6974746565206d756c74697369672077697468206164647265737320307836423239313332656133383861333038353738633164334265303638443065346663393931356132",
  "sig": "d982416251d29ac1aae4ed8234da3644c5454b5d204a4ab79531e6b63e6a45f21b9bd3f20eca21dd4b87a6e8b43a8d266955b7b32c1f2a8d6c01a26927aa2e4d1c",
  "version": "3",
  "signer": "MEW"
}
# Attempt to slash validators from https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4036000
import requests
def get_attestations(slot):
res = requests.get("https://beaconcha.in/api/v1/block/{}/attestations".format(slot))
res.raise_for_status()
return res.json()
def get_validator_att(atts, validator):
return [att for att in atts["data"] if validator in att["validators"]][0]
@michaelsproul
michaelsproul / ganache.sh
Last active March 25, 2022 04:10
Run Ganache in Docker transparently so that it appears to be running on the host
#!/usr/bin/env fish
# - Use exec so that the parent can signal `docker run` directly.
# - Proxy signals from `docker run` to the container, allowing it to terminate gracefully.
# - Use host networking so that Lighthouse tests which expect to fork from localhost continue
# to work.
exec docker run -i --sig-proxy=true --network=host trufflesuite/ganache:latest $argv[1..-1]
@michaelsproul
michaelsproul / cross-clang-aarch64.dockerfile
Last active November 22, 2021 01:30
Cross with Clang Dockerfiles
FROM rustembedded/cross:aarch64-unknown-linux-gnu-0.2.1
RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get install -y apt-transport-https wget && \
(wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -) && \
printf "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main\ndeb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main" > /etc/apt/sources.list.d/backports.list && \
apt-get update && \
apt-get install -y llvm-3.9-dev libclang-3.9-dev clang-3.9 && \
apt-get purge -y apt-transport-https wget
@michaelsproul
michaelsproul / README.md
Last active November 12, 2021 01:25
Early sync committees on mainnet

You might be reading this because you've noticed that some validator on mainnet are earning extra rewards.

This is due to a new feature of the beacon chain added in the Altair fork called sync committees. Sync committees are groups of 512 validators which are randomly selected every 256 epochs (~27 hours) to perform additional duties. They sign a message called a SyncCommitteeMessage every slot, which is similar to an attestation. For more information, you can read Vitalik's write-up in the annotated spec:

https://github.com/ethereum/annotated-spec/blob/master/altair/sync-protocol.md

So far none of the explorers show the sync committees explicitly, so they are chronicled here in the meantime.

Some of the early sync committees are included below as sync_committee_$epoch.txt files, where $epoch is the epoch at which that committee begins performing duties. Each line of the file is a validator index (512 total). You'll notice that the first two committees are identical: this is intentional (it si

@michaelsproul
michaelsproul / set_bits.fish
Created July 8, 2021 13:44
Sync committee set bits
for i in (seq 416 520)
set set_bits (block.sh $i | jq .data.message.body.sync_aggregate.sync_committee_bits | python3 -c "print(bin(int(input().strip('\"').replace('null', '0x0'), base=16)).count('1'))")
echo "block $i: $set_bits"
end
@michaelsproul
michaelsproul / Cargo.toml
Last active June 24, 2021 04:29
Single Integration Test Binary
[package]
autotests = false
[[test]]
name = "lighthouse_tests"
path = "tests/main.rs"