Skip to content

Instantly share code, notes, and snippets.

View alexanderbez's full-sized avatar
🚀
Building the Cosmos

Aleksandr Bezobchuk alexanderbez

🚀
Building the Cosmos
View GitHub Profile
@alexanderbez
alexanderbez / mustafa_storage.txt
Created October 13, 2022 18:31
Mustafa on Cosmos SDK Storage Patterns
My current thoughts and conclusions after all this are:
1. I do not think that it's really necessary for Cosmos to replace the IAVL with the SMT, as they're both theoretically provide roughly the same computational complexity for operations. I think SMT is actually less suitable for the Cosmos SDK because it doesn't support efficient range proofs, and the Cosmos SDK modules use a lot of iteration.
2. The fact that Cosmos SDK modules use iteration is a poor design. Iterating over the entire validator set and requiring an O(n) operation to add a validator is not efficient; and IMO modules should be designed without iteration by using things like ordered linked list and binary search.
3. If Cosmos SDK did not require iteration, we could make the store way faster as we would not need to use a b-tree to cache keys.
4. It's possible to implement state storage+state commitment decoupling in IAVL; which is what I believe what https://github.com/cosmos/iavl/pull/468 does with "fast nodes".
5. The current IAVL is a hac
@alexanderbez
alexanderbez / enigma_foundation_tax.md
Last active August 24, 2020 13:47
Enigma Secret Foundation Tax Proposal

Secret Enigma Foundation Tax

Background

Currently, the native x/distribution module within the Cosmos SDK contains support for a built-in "tax", which is tunable via a ParamChangeProposal, that is distributed to what is known as a "community pool". The community pool can have funds additionally sent to it via altruistic actors. However, the main purpose of the community pool is to be source of funds to help aid in development and progression of the Cosmos ecosystem. See this excellent post

@alexanderbez
alexanderbez / gaia_v1_rc_migration.sh
Last active August 7, 2019 18:36
Gaia v1.0.0-rc1 to rc3 custom migration script
#!/bin/bash
#
# Example:
# sh ./gaia_v1_rc_migration.sh ./old_genesis.json ./new_genesis.json
INPUT_GENESIS=$1
OUTPUT_GENESIS=$2
if [ -z "$INPUT_GENESIS" ]; then
echo "no input genesis provided"
@alexanderbez
alexanderbez / gaia_upgrade_instructions.md
Last active June 8, 2019 12:29
Gaia network upgrade (cosmoshub-1 => cosmoshub-2)

Gaia v0.34.0 Upgrade Instructions

The following document describes the necessary steps involved that a full node must take in order to upgrade from cosmoshub-1 to cosmoshub-2.

Preliminary

Given the acceptance of the transfers enablement proposal which encompasses the v0.34.0 release of the SDK, the Cosmos network, cosmoshub-1, will halt at block TODO and will upgrade to cosmoshub-2 using the v0.34.0 (0f7877c2) release

@alexanderbez
alexanderbez / limited_multisend.go
Last active December 18, 2022 20:32
A limited multisend tx command in the Cosmos SDK for the Gaia network.
package cli
import (
"fmt"
"github.com/spf13/cobra"
bankfork "github.com/cosmos/cosmos-sdk/cmd/gaia/app/x/bank"
"github.com/cosmos/cosmos-sdk/client"
@alexanderbez
alexanderbez / purge_github_branches.sh
Created September 10, 2018 21:20
A shell function to purge all local git branches that do not exist on remote.
func purgeLocalGitBranches() {
red='\033[0;31m'
echo "${red}Purging local branches no longer found on remote..."
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
}
@alexanderbez
alexanderbez / badger_wrapper.go
Last active January 22, 2023 21:03
An example wrapper around BadgerDB providing a simple embedded key/value store interface.
import (
"context"
"fmt"
"os"
"time"
"github.com/dgraph-io/badger"
)
const (
@alexanderbez
alexanderbez / .zshrc
Created August 20, 2018 14:04
ZSH configuration
# Path to your oh-my-zsh installation.
export ZSH="/Users/aleksbez/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="bureau"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
{
"workbench.iconTheme": "eq-material-theme-icons",
"editor.minimap.enabled": false,
"workbench.colorTheme": "One Dark Pro Vivid",
"materialTheme.fixIconsRunning": false,
"editor.rulers": [
80,
120
],
"workbench.colorCustomizations": {
@alexanderbez
alexanderbez / ethminer.service
Last active August 10, 2018 23:23
A simple systemd service definition for Ethminer.
[Unit]
Description=Ethereum mining service
Requires=multi-user.target
After=multi-user.target
[Service]
User=aleks
Type=simple
WorkingDirectory=$HOME/miners/ethminer
EnvironmentFile=$HOME/miners/ethminer/env