This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import json | |
def get_frozen_abi(tag): | |
url_base = f"https://raw.githubusercontent.com/solana-labs/solana/{tag}/" | |
path = "gossip/src/cluster_info.rs" | |
# print(url_base + path) | |
r = requests.get(url_base + path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL=$(curl https://ziglang.org/download/index.json | jq '.master."aarch64-macos".tarball') | |
URL=${URL//\"/} | |
curl $URL -O | |
# unwrap .tar to directory | |
FN=$(basename "$URL") | |
tar xf $FN | |
rm $FN | |
# required: ~/.profile PATH already points to this 'zig' path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const net = std.net; | |
const os = std.os; | |
const info = std.log.info; | |
const expect = std.testing.expect; | |
const system = os.system; | |
const linux = os.linux; | |
const c = std.c; | |
const MAX_CONNECTIONS = 32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{str::FromStr, collections::HashMap}; | |
use serde::{Serialize, Deserialize}; | |
use solana_client::rpc_client::RpcClient; | |
use solana_sdk::{vote::{instruction::VoteInstruction, self}, signature::Signature, transaction::{VersionedTransaction, SanitizedTransaction}, pubkey::Pubkey}; | |
use solana_transaction_status::{EncodedTransaction, UiTransactionEncoding, UiConfirmedBlock, EncodedConfirmedBlock, TransactionBinaryEncoding}; | |
use solana_account_decoder::{self, UiAccountData, parse_stake::{parse_stake, StakeAccountType}, parse_vote::parse_vote}; | |
#[macro_export] | |
macro_rules! send_rpc_call { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{net::{SocketAddr, TcpStream, IpAddr, Ipv4Addr}, time::{Duration, Instant}, sync::{atomic::{AtomicBool, Ordering}, Arc, RwLock}, thread::sleep, collections::{HashSet, HashMap}, path::Path, io::Read, str::FromStr}; | |
use crossbeam_channel::unbounded; | |
use solana_core::{validator::Validator, tpu::DEFAULT_TPU_COALESCE}; | |
use solana_gossip::{gossip_service::{GossipService}, cluster_info::{ClusterInfo, Protocol, Node}, socketaddr_any, socketaddr, duplicate_shred::{DuplicateShred, into_shreds}}; | |
use solana_gossip::{legacy_contact_info::LegacyContactInfo as ContactInfo}; | |
use solana_perf::{recycler::Recycler, packet::{PacketBatch, Packet, PacketBatchRecycler}}; | |
use solana_streamer::{socket::SocketAddrSpace, streamer::{self, StreamerReceiveStats}}; | |
use tracing_subscriber; | |
use solana_sdk::{signer::{Signer}, timing::timestamp, signature::read_keypair_file}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use paste::paste; | |
macro_rules! dispatch_trait_fn { | |
($value_name:ident : $value:ty => $key_name:ident : $key:ty) => { | |
paste!( | |
fn [<get_ $value_name>](&self, $key_name:$key) -> Result<$value>; | |
fn [<put_ $value_name>](&self, $value_name:$value) -> Result<$key>; | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::error::Error; | |
use std::time::Duration; | |
use tokio::sync::mpsc::{channel, Receiver, Sender}; | |
use tokio::time::sleep; | |
use tokio::runtime::Builder; | |
use tracing_subscriber; | |
use tracing::{info, Instrument}; | |
pub async fn generator(sender: Sender<u64>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashSet; | |
use std::error::Error; | |
use std::hash::Hash; | |
use std::sync::Arc; | |
use discv5::Enr; | |
use futures::lock::Mutex; | |
use libp2p::gossipsub::subscription_filter::AllowAllSubscriptionFilter; | |
use lighthouse_network::{EnrExt, GossipTopic, Eth2Enr, strip_peer_id}; | |
use lighthouse_network::config::{Config, gossipsub_config}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::{prelude::*, select}; | |
use libp2p::gossipsub::{Gossipsub, GossipsubConfig, Sha256Topic, GossipsubEvent}; | |
use libp2p::{ | |
gossipsub, identity, mdns, swarm::NetworkBehaviour, swarm::SwarmEvent, PeerId, Swarm, | |
}; | |
use async_std::io::{stdin, BufReader}; | |
use std::error::Error; | |
#[async_std::main] | |
async fn main() -> Result<(), Box<dyn Error>> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// steps: | |
// 1) setup and run lighthouse to run with checkpoint sync | |
// 2) run akula execution client | |
// 3) wait till lighthouse is 'synced' (takes a few minutes) | |
// 4) run this script to query the newest block + its txs | |
use std::{result::Result, error::Error}; | |
use hyper::{Client, body::HttpBody, Request}; | |
use hyper::http::header::ACCEPT; | |
use rlp::{Rlp, Decodable}; |
NewerOlder