Skip to content

Instantly share code, notes, and snippets.

@mdehoog
mdehoog / main.go
Last active March 18, 2024 19:01
Dump the transcation size + estimated compressed size from a geth database, and analyze using numpy
package main
import (
"bytes"
"compress/zlib"
"context"
"encoding/binary"
"fmt"
"log"
"math/big"
@mdehoog
mdehoog / main.go
Created December 23, 2023 02:03
Calculate the total number of ones + non-ones across all txs
package main
import (
"bytes"
"fmt"
"time"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
@mdehoog
mdehoog / fastlz.go
Last active January 31, 2024 05:43
Golang implementation of Solady's FastLZ
package fastlz
// based on https://github.com/Vectorized/solady/blob/5315d937d79b335c668896d7533ac603adac5315/js/solady.js
func FlzDecompress(ib []byte) []byte {
j := uint32(0)
ob := make([]byte, 0, 2*len(ib))
for i := uint32(0); i < uint32(len(ib)); {
t := uint32(ib[i]) >> 5
if t == 0 {
@mdehoog
mdehoog / Compression.sol
Last active January 31, 2024 05:44
Length-only FastLZ
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
/// @title Compression
/// @notice Compression is a library containing compression utilities.
library Compression {
/// @notice Version of https://github.com/Vectorized/solady/blob/main/src/utils/LibZip.sol
/// that only returns the length of the data if it were to be compressed. This saves
/// gas over actually compressing the data, given we only need the length.
/// @dev Returns the length of the compressed data.
@mdehoog
mdehoog / main.go
Created September 25, 2023 23:48
op-stack: calculate L2 tx hash from L1 deposit receipt
package main
import (
"context"
"errors"
"fmt"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@mdehoog
mdehoog / main.go
Created June 16, 2022 03:15
Request blob sidecar from beacon node
package main
import (
"context"
"fmt"
libp2pcore "github.com/libp2p/go-libp2p-core"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
"github.com/prysmaticlabs/prysm/beacon-chain/sync"
@mdehoog
mdehoog / main.go
Last active June 13, 2022 18:05
Send blob transaction
package main
import (
"context"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/holiman/uint256"
"github.com/protolambda/ztyp/view"
@mdehoog
mdehoog / keybase.md
Created February 9, 2017 18:30
keybase.md

Keybase proof

I hereby claim:

  • I am mdehoog on github.
  • I am mdehoog (https://keybase.io/mdehoog) on keybase.
  • I have a public key ASCbDfTCWwhQ--CS71TjD_M-V5fTu966pjNgRDwkfTgaGAo

To claim this, I am signing this object:

@mdehoog
mdehoog / application.controller.js
Created September 15, 2015 09:53
Array shared between components
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@mdehoog
mdehoog / application.controller.js
Last active October 31, 2016 13:06
ember-wormhole component action not bubbled
import Ember from 'ember';
export default Ember.Controller.extend({
});