Skip to content

Instantly share code, notes, and snippets.

View erwanor's full-sized avatar
🧿
🤚

Erwan Or erwanor

🧿
🤚
  • penumbra labs
  • toronto, canada
  • X @erwanor
View GitHub Profile
@erwanor
erwanor / excerpt_shell.md
Last active January 11, 2022 18:51
Benchmark os.loadavg

13:51:19-:aaron>benchmarks (develop) λ strace node printloadAvg.js

....
sysinfo({uptime=11517, loads=[22240, 16576, 15232] totalram=8049532928, freeram=4235063296, sharedram=0, bufferram=27828224} totalswap=0, freeswap=0, procs=582}) = 0
....

13:51:23-:aaron>benchmarks (develop) λ time node printloadAvg.js

@erwanor
erwanor / keybase.md
Last active December 29, 2021 12:25

Keybase proof

I hereby claim:

  • I am erwanor on github.
  • I am ounn (https://keybase.io/ounn) on keybase.
  • I have a public key ASBhUANfFiEX-su8r37Cs0n29WXaWpp5knlHbJeJjs3QUQo

To claim this, I am signing this object:

@erwanor
erwanor / slope_vs_starting.md
Created November 7, 2018 04:59 — forked from gtallen1187/slope_vs_starting.md
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@erwanor
erwanor / main.rs
Created November 28, 2021 19:43
Signing Celo transaction using a Ledger and ethers-rs
use ethers::prelude::{HDPath, Signer, SignerMiddleware, TransactionRequest};
use ethers::providers::*;
use ethers::signers::Ledger;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let chain_id: u64 = 44787;
let rpc = "https://alfajores-forno.celo-testnet.org";
println!("using rpc provider: {}", rpc);
println!("chain id: {}", chain_id);
2023-05-05T07:38:39.427917Z DEBUG abci:EndBlock{height=218}:dex:handle_batch_swaps:route_and_fill:fill_route: filling along route up to spill price input=Value { amount: 10000000, asset_id: passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm } hops=[passet1fyq20eaeee33cweq9actqac9ald5h97rw8c2zl9ewa2ydpz0kvxs8uzu4f, passet1r4kcf2m4r92jqmdks5c9yt7v2tgnht4aj3fml4qln56x72nm8qrsm9d598, passet1nupu8yg2kua09ec8qxfsl60xhafp7mmpsjv9pgp50t20hm6pkygscjcqn2] spill_price=Some(U128x128 { integral: 1, fractional: 0 })
2023-05-05T07:38:39.428106Z DEBUG abci:EndBlock{height=218}:dex:handle_batch_swaps:route_and_fill:fill_route:find_constraints: executed against position input=10000000 output=1000000000000000000 unfilled=5000000 old_reserves=Reserves { r1: 1000000000000000000, r2: 0 } new_reserves=Reserves { r1: 0, r2: 5000000 } id=plpid1avr4ww3q073s5fqnaw0nl7fsjxchkpln0sdl0gk6w5rrkknegczsrrq2xr
2023-05-05T07:38:39.428118Z DEBUG abci:EndBlock{height=218}:dex:handle_batch_swaps:route_and_fill:fill_route:find_cons
@erwanor
erwanor / main.rs
Created May 22, 2023 04:27
Deserializing a `Node`
use std::collections::BTreeMap;
use anyhow::{bail, Result};
use borsh::{BorshDeserialize, BorshSerialize};
use jmt::storage::{Node, NodeKey, TreeReader};
use jmt::{JellyfishMerkleTree, KeyHash, OwnedValue, Sha256Jmt};
use sha2::Sha256;
struct MockStorage {
values: BTreeMap<Vec<u8>, OwnedValue>,
---- component::router::tests::fill_route_constraint_1 stdout ----
asset ids:
gm: passet1r4kcf2m4r92jqmdks5c9yt7v2tgnht4aj3fml4qln56x72nm8qrsm9d598
gn: passet1nupu8yg2kua09ec8qxfsl60xhafp7mmpsjv9pgp50t20hm6pkygscjcqn2
penumbra: passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm
pusd: passet14h46dmcyy6fl5vyz7xx933n8l7jy202ahrxg92kad6yfladsvcyqczcwda
delta_1: Value {
amount: 4000000,
asset_id: passet1r4kcf2m4r92jqmdks5c9yt7v2tgnht4aj3fml4qln56x72nm8qrsm9d598,
}
2023-06-02T14:14:43.552116Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}: searching for path src=pen dst=pen max_hops=5
2023-06-02T14:14:43.552636Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}: beginning path
2023-06-02T14:14:43.552722Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}: relaxing active paths active_paths_len=1
2023-06-02T14:14:43.552804Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}: relaxing path degree=7 candidates=[gm, test_btc, test_usd, test_osmo, test_atom, pen, gn]
2023-06-02T14:14:43.553487Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}:extend_to{new_end=test_osmo}: no best position, failing to extend path
2023-06-02T14:14:43.553620Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}:extend_to
2023-06-02T14:14:43.571129Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}: searching for path src=pen dst=pen max_hops=5
2023-06-02T14:14:43.571192Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}: beginning path
2023-06-02T14:14:43.571265Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}: relaxing active paths active_paths_len=1
2023-06-02T14:14:43.571310Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}: relaxing path degree=7 candidates=[gm, test_btc, test_usd, test_osmo, test_atom, pen, gn]
2023-06-02T14:14:43.571680Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}:extend_to{new_end=gn}: no best position, failing to extend path
2023-06-02T14:14:43.571744Z DEBUG abci:EndBlock{height=3424}:dex:arbitrage:route_and_fill:path_search{max_hops=5}:path{start=pen}:extend_to{new_en
2023-06-02T18:38:59.290999Z INFO penumbra_storage::storage: opening rocksdb path="/var/folders/j7/mbymjl4j16bfslngd1r6gt4h0000gn/T/.tmp8XGPZg/storage.db"
2023-06-02T18:38:59.321478Z DEBUG jmt: key=b"block_height" key_hash=KeyHash("c4b4e25a8824650a238d3451f754dcda1551dec8bec1a96abe23d2ff8b454db8")
2023-06-02T18:38:59.321520Z DEBUG jmt: key=b"chain/epoch_by_height/0" key_hash=KeyHash("ac0564683e6400e242f342e2b31a882a1195ac1aab399be415baef324ea87845")
2023-06-02T18:38:59.333391Z INFO penumbra_dex::component::tests: penumbra_id=passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm
2023-06-02T18:38:59.333471Z INFO penumbra_dex::component::tests: test_usd_id=passet14h46dmcyy6fl5vyz7xx933n8l7jy202ahrxg92kad6yfladsvcyqczcwda
2023-06-02T18:38:59.333613Z DEBUG put_position{id=plpid17uuhzt0544hck7x8fsv4fg8qtfwcm49897ahqudyq0745kwwct4qyyy72y}: penumbra_dex::component::position_manager: position=Position { state: Opened, reserves: Reserves { r1: 110000000, r2: 0 }, phi: TradingFunction { component: BareTrad