Skip to content

Instantly share code, notes, and snippets.

View aludvik's full-sized avatar

Adam Ludvik aludvik

View GitHub Profile

Keybase proof

I hereby claim:

  • I am aludvik on github.
  • I am adamludvik (https://keybase.io/adamludvik) on keybase.
  • I have a public key ASDsSArOP7RnVGsCdOiLt9O3YIg_qz-qaBbZ527wRu20awo

To claim this, I am signing this object:

@aludvik
aludvik / mio-async-minimal-example.rs
Created November 20, 2018 00:06
Minimal example of doing non-blocking I/O with mio
extern crate mio;
use mio::{Events, Ready, Poll, PollOpt, Token};
use mio::net::{TcpListener, TcpStream};
use std::io::{Read, Write};
use std::str;
const LISTENER: Token = Token(0);
const CLIENT: Token = Token(1);
@aludvik
aludvik / sha.rs
Created October 11, 2018 16:17
Verify openssl and rust-crypto give them same output
extern crate hex;
extern crate openssl;
extern crate crypto;
use crypto::digest::Digest;
fn main() {
eprintln!("testing simple hash");
test_simple_hash();
eprintln!("testing cumulative hash");
@aludvik
aludvik / gist:164a9c0a7419b758e54190c4a0dfa72b
Created October 10, 2018 00:41
PBFT Fair Transaction Ordering Extension
1. When a batch arrives, add it to a queue and include a "skip count" and the
queue size when it was added
2. When a block is committed, remove batches from the front of the queue until
all batches in the block have been removed. If a batch is not in the block,
increase its skip count and save it. Push all batches that were skipped back
onto the front of the queue, preserving the original order.
3. While pushing batches back onto the queue, check that the batch isn't being
intentionally skipped by the validator:
a. Check if the skip_count (S) is greater than the size of the queue when
@aludvik
aludvik / sawtooth_docker_rust.md
Created September 19, 2018 15:54
Saving time using Rust and Docker with Sawtooth

This guide will help you save time building Sawtooth Core using the official development build tooling.

Prerequisites:

  • You have docker installed and setup
  • You have already built the docker image you are using, I use sawtooth-validator as an example, but this works with other docker containers that build Rust code
@aludvik
aludvik / gist:12b816a7026850f24c0f5f64463c2902
Last active December 5, 2017 20:24
Simple go-wire interface example
package main
import (
"fmt"
"bytes"
"github.com/tendermint/go-wire"
)
type Foo interface {
Bar()