Skip to content

Instantly share code, notes, and snippets.

@dvush
dvush / bench.md
Created September 14, 2023 11:04
Disc benchmark
  1. Preferable stop any process that using that disc a lot.
  2. cd to a directory on disc
  3. mkdir bench && cd bench
  4. Random read and write performance IOPS. (it will use 8GB for tmp file)
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=fiotest --filename=testfio --bs=4k --iodepth=64 --size=8G --readwrite=randrw --rwmixread=75
  1. latency

eth_sendBundle

{
  blockNumber: "0xb",
  txs: ["0xraw_tx_1", "0xraw_tx_2"],
  revertingTxHasher: ["0xtx_2_hash"]
}

mev_sendBundle

@dvush
dvush / .env
Last active February 12, 2024 21:33
thetadata docker
THETADATA_USERNAME=username
THETADATA_PASSWORD=password
@dvush
dvush / 0001-2.2.1.patch
Created February 1, 2022 12:56
Archinux PKGBUILD for sbcl 2.2.1(patch and full PKGBUILD)
From c25d620ba5e20bb6068efe937e1c621fd4f23725 Mon Sep 17 00:00:00 2001
From: Vitaly Drogan <vitaliy.drogan@gmail.com>
Date: Tue, 1 Feb 2022 14:53:44 +0200
Subject: [PATCH] 2.2.1
---
PKGBUILD | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/PKGBUILD b/PKGBUILD
@dvush
dvush / balance.ts
Created September 17, 2020 18:26
Get balance on contract
async function getBalanceOnContract(ethSigner: ethers.Signer, zksyncProvider: zksync.Provider, token: zksync.types.TokenLike) {
const tokenId = zksyncProvider.tokenSet.resolveTokenId(token);
const ABI = [{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
},
<html>
<body>
<script type="text/javascript" src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/zksync@0.6.3/dist/main.js"></script>
<script type="text/javascript">
(async () => {
// loads and compiples wasm library
await zksync.crypto.loadZkSyncCrypto();
diff --git a/contracts/contracts/Bytes.sol b/contracts/contracts/Bytes.sol
index d9813152..756b01f0 100644
--- a/contracts/contracts/Bytes.sol
+++ b/contracts/contracts/Bytes.sol
@@ -1,5 +1,12 @@
pragma solidity ^0.5.0;
+// Functions named bytesToX, except bytesToBytes20, where X is some type of size N < 32 (size of one word)
+// implements the following algorithm:
+// f(bytes memory input, uint offset) -> X out
diff --git a/contracts/contracts/Bytes.sol b/contracts/contracts/Bytes.sol
index 8fe0b3c1..d9813152 100644
--- a/contracts/contracts/Bytes.sol
+++ b/contracts/contracts/Bytes.sol
@@ -38,13 +38,16 @@ library Bytes {
bts = toBytesFromUIntTruncated(uint(self), 20);
}
+ // NOTE: theoretically possible overflow of (_start + 20)
function bytesToAddress(bytes memory self, uint256 _start) internal pure returns (address addr) {
@dvush
dvush / mint.ts
Last active May 19, 2020 09:17
mint function
async function mintTestnetToken(wallet: Wallet, token: TokenLike) { // Wallet and TokenLike from zksync.js
const tokenAddress = wallet.provider.tokenSet.resolveTokenAddress(token);
const ABI = [{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_to",
"type": "address"
},
@dvush
dvush / gsoc2017_geantV.md
Last active August 29, 2017 08:31
GSoC 2017 Geant HPC workload balancer.

Task

Create HPC layer for GeantV project. GeantV is application for physics simulation and it had only single-node implementation. Our task was to create system that is aware about multiple hosts and could use allocated resources and process more events in a more efficient manner.

Code

Merge request: https://gitlab.cern.ch/GeantV/geant/merge_requests/177

Last GSoC related commit: e069dce6