Alejandro Betancourt retweeted
CodeHawks Practice audit #2: Thunder Loan, the flash-loan protocol from Cyfrin's security course. It sits behind a UUPS proxy.
The bug: the planned upgrade deletes one variable.
V1: s_feePrecision, s_flashLoanFee
V2: s_flashLoanFee, FEE_PRECISION (now a constant)
Constants take no storage, so everything after it moves up one slot. After the upgrade, s_flashLoanFee reads the old precision: 1e18. The flash loan fee jumps from 0.3% to 100%.
V2's initialize() sets the fee back to 0.3%. It never runs: the proxy was already initialized.
Found it with forge inspect <Contract> storage on both versions, comparing slot by slot.
🔑 In an upgrade, variables are positions, not names.
Alejandro Betancourt retweeted
Verifiable build for my Solana program: six weeks of mismatched hashes, fixed by one flag.
The official 4.2.2 image defaults to platform-tools v1.56. My build uses v1.57. Different compiler, different bytecode.
solana-verify build --cargo-build-sbf-args="--tools-version v1.57 --arch v3"
Now the Docker build is byte-for-byte my devnet deployment.
The explorer badge still won't show: remote verification is mainnet-only.
If you're moving to sBPFv3 on 4.2.x, check which platform-tools your build actually uses.
nitter.cf/SolPlay_jonas/status/2…
Soon you will only be able to deploy sBPFv3 Programs! 🚨
Please let us know if you see any problems with that asap!
Check the guide:
solana.com/upgrades/sbpfv3-p…
Alejandro Betancourt retweeted
18.6 ETH in fees. totalFees() returns 0.153.
uint64 tops out at ~18.44 ETH, and an explicit cast doesn't revert: it keeps the low 64 bits. withdrawFees() requires balance == totalFees, which never holds again. Fees locked.
0.8 wouldn't save you here. It checks overflow, not downcasts.
Trace from my PoC 👇
github.com/alebeta06/codehaw…
nitter.cf/Ale_Beta/status/211553…
I practiced auditing on Puppy Raffle, CodeHawks' First Flight #1.
Found 6 of its 16 known issues and wrote 4 Foundry PoCs. The one I missed taught me the most.
refund() looks fine on its own. So does selectWinner().
But refund() doesn't remove you from players[]. It writes address(0) in your slot.
selectWinner() still counts that slot:
→ the winner can be address(0)
→ the prize math counts ETH that was already refunded
I reviewed each function separately. The bug lives in the state they share.
🔑 Audit the system, not the functions.
Findings + PoCs: github.com/alebeta06/codehaw…
Alejandro Betancourt retweeted
Most reentrancy posts show the code. This is what it looks like when it runs.
Puppy Raffle's refund() sends ETH before zeroing your slot. My attacker's receive() calls refund() again with the same index.
1 ETH in. 5 ETH out. Each step to the right is another refund() inside the previous one, until there's nothing left.
It works because sendValue forwards all the gas. With transfer() and its 2300 gas, the re-entry would fail.
The fix: zero the slot first, then send.
PoC: github.com/alebeta06/codehaw…
@CodeHawks @cyfrin
Alejandro Betancourt retweeted
I practiced auditing on Puppy Raffle, CodeHawks' First Flight #1.
Found 6 of its 16 known issues and wrote 4 Foundry PoCs. The one I missed taught me the most.
refund() looks fine on its own. So does selectWinner().
But refund() doesn't remove you from players[]. It writes address(0) in your slot.
selectWinner() still counts that slot:
→ the winner can be address(0)
→ the prize math counts ETH that was already refunded
I reviewed each function separately. The bug lives in the state they share.
🔑 Audit the system, not the functions.
Findings + PoCs: github.com/alebeta06/codehaw…
Alejandro Betancourt retweeted
I fixed a vulnerability in my Solana swap and opened a panic. A property-based test found it, not me.
The fix first. The reference code took token decimals as an instruction parameter, even though the Mint accounts were right there. Declare decimals_a = 0 on a 9-decimal mint and the math is wrong forever, because the value is stored when the market is created. Two lines fixed it: read the decimals from the Mint.
What that fix opened: the caller can no longer lie about decimals, but the program now accepts whatever the Mint says. And an SPL mint can have any u8, from 0 to 255.
10^38 fits in a u128. 10^39 doesn't. The code did 10u128.pow(decimals) unchecked, so with a mint of 39+ decimals every swap panicked instead of returning the MathOverflow error the program already had for exactly that case.
27 integration tests never saw it. They all use 6 and 9 decimals, the range real tokens live in, which is the range anyone tests by hand.
The property tests sample decimals across the full 0..255. Capping them at 38 would have been a test designed to pass. proptest shrank the failure to the smallest case that still broke: amount = 0, price = 1, dec_a = 0, dec_b = 39.
The fix is a pow10() that uses checked_pow and returns the typed error. Side effect I didn't expect: the program binary shrank by 1,984 bytes.
How the tests were made: Claude Code wrote them. I chose the four properties the math had to obey and checked each one by breaking the code on purpose until it went red.
What I take from it: moving trust from the caller to the Mint doesn't remove the input. It widens it. Validating where a value comes from means validating its range too.
nitter.cf/Ale_Beta/status/211002…
New project: my first Solana program, coming from Solidity. A fixed-price SPL token swap in Rust + Anchor, deployed on devnet, with a Next.js frontend.
Anyone can create a market for two tokens and set its price. Anyone can add liquidity, and users swap in both directions at that price.
Stack: Rust + Anchor 1.2 for the program. Next.js, TypeScript and wallet adapter on the frontend. Devnet test tokens with Metaplex metadata and a public faucet that pays for your token accounts, so you can try it without asking anyone.
Inside, it made me deal with:
- Thinking in accounts instead of storage: PDA vaults and a canonical mint order, so one pair can't end up as two markets
- Not trusting the caller: token decimals are read from the Mint account, not passed as a parameter
- Property-based tests over the swap math: 500,000 generated cases found a panic that 27 integration tests missed
- A CI I sabotaged on purpose to check it can actually fail
5 instructions, 9 typed errors, 133 tests across three suites, and known limitations written down in the README. Educational code, not audited.
Try it on devnet (you'll need a little devnet SOL to swap), read the code, and tell me what you'd do differently:
Demo: solana-token-swap.vercel.app
Code: github.com/alebeta06/solana-…
Audio note: I recorded the video in Spanish. The English you hear is YouTube's auto-dubbed track, not my voice.
#Solana #rustlang
Alejandro Betancourt retweeted
I sabotaged my CI and it stayed green.
That was the correct result.
Same type error, two runs:
❌ without `yarn typecheck` → green
✅ with it → red, tests never ran
Vitest doesn't check types. It strips them and runs the JavaScript.
So typecheck is its own step, before the tests.
🔑 A green check means nothing until you've seen it go red.
Repo: github.com/alebeta06/solana-…
nitter.cf/Ale_Beta/status/211002…
New project: my first Solana program, coming from Solidity. A fixed-price SPL token swap in Rust + Anchor, deployed on devnet, with a Next.js frontend.
Anyone can create a market for two tokens and set its price. Anyone can add liquidity, and users swap in both directions at that price.
Stack: Rust + Anchor 1.2 for the program. Next.js, TypeScript and wallet adapter on the frontend. Devnet test tokens with Metaplex metadata and a public faucet that pays for your token accounts, so you can try it without asking anyone.
Inside, it made me deal with:
- Thinking in accounts instead of storage: PDA vaults and a canonical mint order, so one pair can't end up as two markets
- Not trusting the caller: token decimals are read from the Mint account, not passed as a parameter
- Property-based tests over the swap math: 500,000 generated cases found a panic that 27 integration tests missed
- A CI I sabotaged on purpose to check it can actually fail
5 instructions, 9 typed errors, 133 tests across three suites, and known limitations written down in the README. Educational code, not audited.
Try it on devnet (you'll need a little devnet SOL to swap), read the code, and tell me what you'd do differently:
Demo: solana-token-swap.vercel.app
Code: github.com/alebeta06/solana-…
Audio note: I recorded the video in Spanish. The English you hear is YouTube's auto-dubbed track, not my voice.
#Solana #rustlang
Alejandro Betancourt retweeted
Spent two weeks building a rug-pull detector on Solana. Not the "we flag suspicious
tokens" kind — one with a measured number next to every alert.
The signal: the creator adds liquidity to its own token. 97.9% of those ended in a
drain (422 of 431, 431 distinct wallets), median 8 minutes of warning before the
pool went to zero.
The part nobody publishes: it only catches 65.3% of pool rugs. The other 35% are dev
dumps and migration pulls, where the drain IS the event — there is nothing to warn
about beforehand. That's on the dashboard, not buried in a footnote.
I also killed four of my own hypotheses with data. ">10 launches in 24h" as a signal:
1.0% precision. Sell-share before the drain: inverted once I fixed the liquidity
metric. Both documented as discarded, with the numbers that killed them.
Calibrated against 17M frames from one full night of mainnet, over Solami's Blur
stream. TypeScript, 242 tests, docker compose up and it runs. Without an API key it
replays a real recorded hour through the same detector.
@useSolami
Alejandro Betancourt retweeted
New project: Northwind Customer Management. A REST API in Rust with a Next.js admin panel on top.
Full CRUD over the classic Northwind database (93 customers, 16,282 orders): filter, sort, create, edit and delete customers.
Stack: Rust + Rocket, rusqlite (SQLite) and Docker on the backend. Next.js 15, TypeScript, Tailwind and shadcn/ui on the frontend. Backend on Render, frontend on Vercel.
A CRUD looks boring from the outside. Inside, it made me deal with:
- Concurrency: rusqlite's Connection isn't Sync, so Rocket won't even compile until it's behind a Mutex
- Referential integrity: deleting a customer with orders returns a 409, shown as a business rule, not as an error
- SQLite traps that only show up when you actually run things
- A free-tier backend that goes to sleep, handled in the UI with retries instead of a red error
15 tests, clippy clean with -D warnings, and a README that explains why each decision was made.
Try it, read the code, and tell me what you'd do differently:
Demo: northwind-fullstack.vercel.a…
(the first load can take up to a minute while the backend wakes up)
Code: github.com/alebeta06/northwi…
Audio note: I recorded the video in Spanish. The English you hear is YouTube's auto-dubbed track, not my voice.
#rustlang
Alejandro Betancourt retweeted
My swaps failed about 4 times in 10 with "Blockhash not found". Same code, same RPC, no pattern.
The cause wasn't my code. It was which node answered each request 🧵
Alejandro Betancourt retweeted
I wrote four tests for the new Solana Explorer MCP and designed two of them expecting it to fail.
It passed all four.
Ran them against my own devnet deployment, where I already know every value it should return 🧵
Alejandro Betancourt retweeted
I made a 🦊 wallet plugin that:
1. Decodes your calldata
2. Uses that decoded data as input to an AI
3. Which then searches the web to see if the transaction has anything "fishy" about it.
Here is an example where you'd be sending money to the ByBit hackers, but it catches it!
Alejandro Betancourt retweeted
🔥 Te lo perdiste...
+70 equipos virtuales
10 equipos locales
+40,000 USDT en premios 💰
Talento local e internacional construyendo el futuro Web3 🌐🚀
Gracias a nuestros patrocinadores por hacer historia con nosotros.
Alejandro Betancourt retweeted
🔥 New SpeedRun Stark is LIVE! 🚀
Ready to learn @CairoLang & build dApps on @Starknet?🌟
👾 Challenges: Learn, Build, & Grow
📺 Must Watch: Basecamps
🗺 Roadmap: From learning to fundraising
👨🎓 Starklings: Start with Cairo!
👨💻 Build Easy
🔗 Join here: speedrunstark.com
Alejandro Betancourt retweeted
🆕 Campaign Release: Entering Cairo🏝️
Cairo is a programming language designed for compiling provable STARKs and is the language of @Starknet.
5 beginner-friendly quests just launched - your first steps into Cairo, live today.
Time to speak integrity.
nodeguardians.io/campaigns/e…
Alejandro Betancourt retweeted
Jueves de Cairo sobre STARK & Bitcoin 🐺🐱
📅 jueves, 29 de agosto
⏰🚨 Para esta sesión tendremos un horario diferente: 10am 🇲🇽 🇨🇷 | 11am 🇨🇴🇵🇪 | 1pm 🇦🇷 | 6pm 🇪🇸
🔗 Registra tu asistencia a la sesión para obtener acceso a la sala de zoom: zoom.us/meeting/register/tJI…
Alejandro Betancourt retweeted
¿Cómo @Starknet puede convertirse en una capa única que escale tanto Bitcoin como Ethereum?
La clave para lograr esto es la posible adopción del código de operación OP_CAT en Bitcoin 🐱
Esta actualización permitiría la implementación de un verificador STARK dentro del Script de Bitcoin, ofreciéndonos transferencias seguras y autocustodiales entre Bitcoin y @Starknet 🚀
Este sería un gran paso hacia la adopción masiva de Bitcoin, ya que podría aumentar la velocidad de las transacciones a miles por segundo⚡
@StarkWareLtd está trabajando activamente para lograr este objetivo porque los beneficios de escalar Bitcoin con @Starknet son significativos:
- Mayor privacidad
- Mejor experiencia de usuario
- Desarrollo de nuevos productos y servicios financieros
¿Quieres saber más detalles de este nuevo desafío para el ecosistema STARK? Mañana en el jueves de Cairo estaremos conversando sobre este tema con @henrlihenrli de la @StarknetFndn 👀
Más detalles en el siguiente tweet ⬇️
Alejandro Betancourt retweeted
Watch Falcon 9 launch 56 Starlink satellites to orbit → spacex.com/launches/ nitter.cf/i/broadcasts/1mnxeROvO…
Alejandro Betancourt retweeted
#Chainlink Functions permite a los desarrolladores de contratos inteligentes obtener cualquier dato de cualquier API con sólo unas pocas líneas de código.
En esta traducción de @zestyblockchain, descubre cómo Functions trae un mundo de posibilidades #Web3
chainlinkspanishcommunity.me…
Alejandro Betancourt retweeted
We are going.
For the first time, the @NASA_SLS rocket and @NASA_Orion fly together. #Artemis I begins a new chapter in human lunar exploration.





















