In Solidity, is it possible to craft a memory array of length 2**256 - 1? Yes -> if function that creates the array is an internal call No -> if function call is external. Reverts with out of gas error. Code github.com/t4sk/notes/blob/m…
2
4
64
3,693
Math for vault and rebase token (like SUSDS and aToken) calculate the same redeemable amount with different mechanisms. But in code, precision loss causes these 2 ways of calculations to diverge. Notes github.com/t4sk/notes?tab=re… Code github.com/t4sk/notes/blob/m…
5
19
130
5,142
txgraph.org/ - Visualize transaction - Compiles and visualizes Solidity contracts - Code navigation if contract compiled
4
10
101
6,153
I've received a fake job recruitment email from zendarox Here are some things I do before clicking on any link. 1. Background check (google the company) 2. Hover over link to see if it matches text 3. Open links in browser's private mode Stay safe
17
4
67
4,914
I found out last night this is an invalid attack😳 Lido.transferToVault overrides AragonApp Apology for the misinformation
5
352
stETH has a function that - transfers any token and ETH to a vault set by Lido - any user can call Vault address is 0 1. Find a way to set the vault address or deploy code at the 0 address 2. Report bug💰 Lido proxy etherscan.io/address/0xae7ab… Lido impl etherscan.io/address/0x02827…
2
4
70
9,074
Incremental Merkle Tree Fast (O(H)) merkle root calculation for 2^H leaf nodes Used by ETH deposit contract to prove ETH deposits to CL Deposit contract etherscan.io/address/0x00000… Python github.com/t4sk/notes/blob/m… Solidity github.com/t4sk/notes/blob/m… Notes github.com/t4sk/notes
2
1
74
3,597
USDtb market cap $354M 1 owner (EOA) owner can 1. grant mint role 2. mint any amount (for example 1 billion USD) I pray the owner isn't a single private key etherscan.io/address/0xc1391…
7
7
68
6,157
Contract that uses 1251 slots deployed for only $26 It stores a lookup table from b to x x^(year in seconds) = 1 + b/1e4 etherscan.io/address/0xea91a…
6
2
97
10,996
Math of WstETH stETH is rebasing WstETH is not how does WstETH accounting work? X = _getShareRateNumerator()) / _getShareRateDenominator() Notes github.com/t4sk/notes/blob/m… WstETH etherscan.io/address/0x7f39c… stETH etherscan.io/address/0xae7ab…
2
2
44
2,530
Schnorr signature scheme - Uses Elliptic curve math (similar to ECDSA) - A signature can easily be turned into multi-sig - Multi-sig can be vulnerable to rogue key attack - Used by Chronicle Labs price oracles cantina.xyz/bounties/5240b7c…
2
7
85
4,469
Why reusing nonce when signing 2 different messages in ECDSA exposes the private key Code github.com/t4sk/notes/blob/m…
4
27
195
14,860
Dollar cost average vault Sell token = X Buy token = Y - User deposits X - X earns yield from external DeFi - X can be swapped to Y, rate limited by time and amount - Oracle checks swap price Code (not tested) github.com/t4sk/notes/blob/m… Math based on Liquity stability pool
5
1
40
2,976
Elliptic curve addition P + Q = R For P != Q 1. Draw a line (L) through P and Q 2. Find where L intersects the elliptic curve (x2, y2) 3. Reflect on x-axis (x2, y2) -> (x2, -y2) For P = Q 1. Draw tangent line of P 2 and 3 are the same desmos.com/calculator/efumve…
1
5
44
2,793
Notes on mulDiv for Solidity devs - Math theorems are treated as black boxes - Why certain checks and operations are needed - Why overflows are safe in some places Code github.com/t4sk/notes/blob/m…
1
2
42
3,583
Simulation of a P-controller for interest rates of a lending protocol (pic 1) Controller aims to keep utilization rate high (pic 3) util < optimal -> decrease interest rate util > optimal -> increase interest rate Simulation (pic 2) Yields (pic 4) github.com/t4sk/notes/blob/m…
1
13
1,023
Midnight morpho's math to calculate credit after slashing is the same math used in Liquity stability pool Midnight code github.com/morpho-org/midnig… Liquity stability pool math github.com/liquity/liquity/b…
2
2
46
3,700
1. Swap 100 ETH to 100.001 stETH 2. Queue withdraw on LIDO (stETH to ETH) 3. Receive 100.001 ETH in 2 days Net profit $1676 / ETH * 0.001 ETH - gas = $1.676 - gas💀
5
45
13,081
Review of 63 / 64 gas rule in EVM An easy summary to remember, although slightly inaccurate, is that a naive gas refund mechanism can overpay the caller by about 1/64 of the gas sent Code github.com/t4sk/notes/blob/m…
1
14
1,056
@cantinasecurity Do you think it's fair to publish audit reports into out of scope after the contest has started?
9
1
40
2,097
Vault inflation attack x axis = donation amount purple region = where attack is possible green line = profit (attack vs no attack) green line above y = 0 and inside purple region is where attack is profitable Graph desmos.com/calculator/orugjr… Code + notes github.com/t4sk/notes/tree/m…
3
9
55
2,898
Optimal capital allocation is at the peak of the 1st graph Graphs the sum of yield x user's position for reserve 0 and 1 (pic 1, 2, 3) When change in yields are small, replacing the yield functions with constants approximates the exact solution (pic 4)
4
637
Yield optimization for 2 reserves in Aave V3 Give initial capital of C, how much should you put in reserve 0 and 1 to maximize yield? Assumptions - Similar assets (DAI and USDC) - Or slippage and fee on swap is 0 Graph desmos.com/calculator/rrvybo… Code github.com/t4sk/notes/blob/m…
1
2
24
1,803
[Andre Cronje | Flying Tulip] Advice to Builders & Why He Came Back piped.video/jbXFENvyziM?si=SbNx… via @YouTube
1
15
1,233
AST grapher click on contract to see list of state variables and functions txgraph.vercel.app/?tab=ast
1
31
1,490
2 columns to visualize Solidity contracts left column - functions right column - state variagles 1st picutre Which functions read or write to this state variable? 2nd picture Which functions and state variables does this function (balance()) touch? txgraph.vercel.app/?tab=ast
2
3
29
2,101
Soliditity AST visualizer graphical representation of which state varaibles are touched when a function is called txgraph.vercel.app/?tab=ast
1
6
65
3,623
Solidity AST visualizer txgraph.vercel.app/?tab=ast Current state - visualize inheritance (pic 1) TODO - Graph functions and state variables (pic 2) - AST grapher for live contracts (pic 3) Consider donating to any project on ETH security QF My project qf.giveth.io/project/transac…
4
5
59
3,827
How a peg stability module can accidentally create unbacked stablecoin yield Peg stability module - swaps stablecoins 1 to 1 Stablecoin savers earn yield by staking their stablecoin into the protocol Primary yield typically comes from stablecoin borrowers
2
2
51
3,319
Incremental Merkle tree animations 1. Initialization (caching zero hashes) 2. Inserts (caching right most left nodes) Code github.com/t4sk/notes/blob/m…
4
28
2,190
Web3 companies are posting jobs on jobs.ashbyhq.com Here is how to find them 1. Google "site:jobs.ashbyhq.com defi" 2. Filter by date (last month) Replace "defi" with other keywords Positions I found gist.github.com/t4sk/faed549… Good luck
10
19
299
18,944
Borrow GHO -> pay 3.05% Deposit GHO -> receive 4.73% Free money, except you cant borrow GHO at the moment app.aave.com/sgho/
2
1
18
3,792
Clever way to reverse 32 bytes simple method -> 32 iterations clever method -> 5 iterations # input A B C D E F G H # swap 1 byte B A D C F E H G # swap 2 bytes D C B A H G F E # swap 4 bytes H G F E D C B A Code github.com/risc0/risc0-ether…
4
2
31
1,459
Protocol insurance 1. Insuree pays premium to stakers 2. In a bad event, contracts are halted and stakers pay the insuree 3. Staker withdrawal are queued to prevent bank runs Code github.com/t4sk/defi-cookboo… Deployment tx tx-graph-eight.vercel.app/tx…
1
4
47
2,779
ZKSTARK Why FRI detects a dishonest prover - Proximity gap theorem (optional) - Distance preservation under fold - Honest and dishonest prover Notes github.com/t4sk/notes/tree/m…
1
1
20
1,281
ZKSTARK - FRI (Intro, notations, commit and query) More notes github.com/t4sk/notes/tree/m…
1
3
20
1,483
Replying to @EChinagozim
Namespace for storage variables without clever code like this github.com/OpenZeppelin/open… After a little experiment, I concluded that it was indeed confusing since Solidity creates read only functions for public state variables, these functions will have $ prefix.
1
1
161
Like or dislike? Prefix storage variables with $
16
1
45
4,986
How is it possible that a call to address(1) returns data? Precompiles address(1) = call to ecrecover transaction tx-graph-eight.vercel.app/tx…
4
2
23
3,239