Skip to content

Instantly share code, notes, and snippets.

@akashin
akashin / After_gas_cost_change
Created April 11, 2024 15:13
Gas cost change logs
[2024-04-11 16:07:54] INFO: Use default config {'local': True, 'near_root': '/home/akashin/repos/nearcore/target/debug', 'binary_name': 'neard', 'release': False}
[2024-04-11 16:07:54] INFO: Creating LOCAL cluster configuration with 2 nodes
[2024-04-11 16:07:54] INFO: Search for stdout and stderr in ['/home/akashin/.near/test0', '/home/akashin/.near/test1']
[2024-04-11 16:07:54] INFO: Starting node 0 as BOOT NODE
[2024-04-11 16:07:59] INFO: node 0 started
[2024-04-11 16:07:59] INFO: Starting node 1 with --boot-nodes=He7QeRuwizNEhBioYG3u4DZ8jWXyETiyNzFD3MkTjDMf@127.0.0.1:24577
[2024-04-11 16:08:04] INFO: node 1 started
{
"jsonrpc": "2.0",
"result": {
@akashin
akashin / Triplets.txt
Created March 16, 2024 10:12
Triplets
0: (1, 0, 0)
1: (-1, 0, 0)
1: (1, 2, 0)
1: (1, 0, 2)
2: (-1, -2, 0)
2: (-1, 0, -2)
2: (3, 2, 0)
2: (1, 2, 6)
2: (3, 0, 2)
2: (1, 6, 2)
@akashin
akashin / stats
Created February 16, 2024 10:26
wasmi stats
Total opcodes: 292945
Opcode counts:
local.get: 71492
i32.const: 48239
i32.add: 23429
local.set: 16986
end: 16427
i32.load: 15149
block: 13453
@akashin
akashin / benchmarking.md
Created February 13, 2024 13:51
Discussion about benchmarking

Ideas

Using zkAsm runner for benchmarks

Use-cases:

  • filetests
  • benchmarks
  1. How would the benchmarking pipeline look like after your work?
  2. How will the workflow of using benchmarking look like for the user?
@akashin
akashin / keccak.rs
Created February 5, 2024 14:06
Keccak
#![no_main]
#![no_std]
use panic_halt as _;
use sha3::{Digest, Keccak256};
extern "C" {
fn assert_eq_i64(actual: u64, expected: u64);
}
@akashin
akashin / fixmes.txt
Created February 1, 2024 10:40
fixmes
;; FIXME: Inst::Select([Writable { reg: v350 }], v213, ValueRegs { parts: [v211, v2097151] }, ValueRegs { parts: [v201, v2097151] }, i32)
;; FIXME: Inst::Select([Writable { reg: v346 }], v218, ValueRegs { parts: [v214, v2097151] }, ValueRegs { parts: [v215, v2097151] }, i32)
;; FIXME: Inst::BrTable(v212, Writable { reg: v358 }, Writable { reg: v359 }, [Label(MachLabel(15)), Label(MachLabel(4)), Label(MachLabel(14)), Label(MachLabel(11)), Label(MachLabel(10)), Label(MachLabel(6)), Label(MachLabel(5))])
;; FIXME: Inst::BrTable(v253, Writable { reg: v349 }, Writable { reg: v350 }, [Label(MachLabel(9)), Label(MachLabel(8)), Label(MachLabel(7))])
;; FIXME: Inst::BrTable(v220, Writable { reg: v292 }, Writable { reg: v293 }, [Label(MachLabel(16)), Label(MachLabel(22)), Label(MachLabel(21)), Label(MachLabel(17)), Label(MachLabel(18)), Label(MachLabel(20)), Label(MachLabel(19))])
;; FIXME: Inst::Select([Writable { reg: v438 }], v205, ValueRegs { parts: [v199, v2097151] }, ValueRegs { parts: [v200, v2097151
@akashin
akashin / build.sh
Created January 30, 2024 14:30
Simpler SHA256
#!/bin/bash
cargo build --target wasm32-unknown-unknown --release
mkdir -p out
cp target/wasm32-unknown-unknown/release/cranelift-bench.wasm out/mod.wasm
cd out
wasm-strip mod.wasm
wasm2wat mod.wasm > mod.wat
@akashin
akashin / sha256.rs
Created January 25, 2024 14:58
SHA256
#![no_main]
#![no_std]
use panic_halt as _;
use sha2::{Digest, Sha256};
extern "C" {
fn assert_eq_i64(actual: u64, expected: u64);
}
@akashin
akashin / sha256.rs
Created December 18, 2023 17:08
SHA256
#![no_main]
#![no_std]
use panic_halt as _;
use sha2::{Sha256, Digest};
extern "C" {
fn assert_eq(actual: u64, expected: u64);
}
@akashin
akashin / fibo.rs
Created December 18, 2023 17:08
Fibonacci
#![no_main]
#![no_std]
use panic_halt as _;
extern "C" {
fn assert_eq(actual: i64, expected: i64);
}
#[no_mangle]