Skip to content

Instantly share code, notes, and snippets.

View devfans's full-sized avatar
🎮

Stefan Liu devfans

🎮
  • Mars
View GitHub Profile
@devfans
devfans / tsp_auth.md
Last active April 8, 2025 07:27
tsp_auth

State Reference

reference nothing

Still availabe when account state is updated

reference group

  • slot: group

Block Transaction Design with Authentication Modes


Overview

The design involves authenticating contract calls using a witness containing a cryptographic proof. The function authenticate(witness.proof, auth_mode, sign_target) validates permissions based on the auth_mode parameter, which defines how the proof is verified and reused.

Code Layout:

@devfans
devfans / ZK_ToolKits.md
Last active February 27, 2025 09:38
ZK ToolKits

ZK ToolKits Benchmarks

Overview

ToolKit Prove Verify Proof Size Prove Recursive Verify Recursive Recursive Proof Size
@devfans
devfans / Account_Transaction_Model.md
Created February 18, 2025 11:09
TPS-Account&Transaction

Account Types and Address Calculation

Normal Account (Flag = 0x01)

Purpose: Can sign transactions.

Address Calculation:

address = Hash(flag, wallet_verification_key, public_key)
@devfans
devfans / backup-devfans
Created February 14, 2025 08:22
vscode-profiles
{"name":"backup-devfans","settings":"{\"settings\":\"{\\n \\\"solidity.compileUsingRemoteVersion\\\": \\\"v0.8.17+commit.8df45f5f\\\",\\n \\\"files.autoSave\\\": \\\"afterDelay\\\",\\n \\\"editor.fontSize\\\": 11,\\n \\\"editor.glyphMargin\\\": false,\\n \\\"editor.guides.indentation\\\": false,\\n \\\"editor.guides.highlightActiveIndentation\\\": false,\\n \\\"workbench.tree.renderIndentGuides\\\": \\\"none\\\",\\n \\\"editor.minimap.enabled\\\": false,\\n \\\"editor.renderWhitespace\\\": \\\"none\\\",\\n \\\"go.buildTags\\\": \\\"mainnet\\\",\\n \\\"go.testFlags\\\": [\\n \\\"-count=1\\\",\\n \\\"-v\\\"\\n ],\\n \\\"window.openFilesInNewWindow\\\": \\\"on\\\",\\n \\\"gitlens.blame.format\\\": \\\"${date} ${author} : ${message|18?} \\\",\\n \\\"gitlens.blame.avatars\\\": false,\\n \\\"gitlens.blame.compact\\\": false,\\n \\\"gitlens.blame.dateFormat\\\": \\\"YYYY-MM-DDTHH:mm:ss\\\",\\n \\\"gitlens.defaultDateStyle\\\": \\\"absolute\\\",\\n
@devfans
devfans / git rebase branch
Created September 8, 2020 06:18
git rebase
Note: If you have broad knowledge already about rebase then use below one liner for fast rebase. Solution: Assuming you are on your working branch and you are the only person working on it.
git fetch && git rebase origin/master
Resolve any conflicts, test your code, commit and push new changes to remote branch.
~: For noobs :~
The following steps might help anyone who are new to git rebase and wanted to do it without hassle
Step 1: Assuming that there are no commits and changes to be made on YourBranch at this point. We are visiting YourBranch.
impl NpcCreation {
pub fn new(state: ServerState, num: usize, config: &Value) -> Self {
let report_hosts = if let Some(host) = config["reporter_host"].as_str() {
vec!(host.to_string())
} else { Vec::new() };
let mut px = state.world.physics.lock().unwrap();
@devfans
devfans / k8s_metrics_carbon.py
Created October 30, 2019 06:44
k8s pipe metrics to graphite
import pika
import datetime
import time
import socket
import pickle
import struct
import logging
import subprocess
import json
@devfans
devfans / hashmap.rs
Last active February 26, 2021 08:51
use std::hash::{ Hasher, Hash };
use std::collections::{LinkedList, hash_map::DefaultHasher};
fn hash<K>(k: K) -> usize where K: Hash{
let mut hasher = DefaultHasher::new();
k.hash(&mut hasher);
hasher.finish() as usize
}
@devfans
devfans / client.json
Last active June 6, 2019 06:39
v2r_udp
{
"log": {
"loglevel": "error",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbounds": [
{
"port": 1888,
"protocol": "socks",