You might have noticed we are being inundated with scam video and tutorial posts, and posts by victims of this "passive income" or "mev arbitrage bot" scam which promises easy money for running a bot or running their arbitrage code. There are many variations of this scam and the mod team hates to see honest people who want to learn about ethereum dev falling for it every day.
How to stay safe:
There are no free code samples that give you free money instantly. Avoiding scams means being a little less greedy, slowing down, and being suspicious of people that promise you things which are too good to be true.
These scams almost always bring you to fake versions of the web IDE known as Remix. The ONLY official Remix link that is safe to use is: https://remix.ethereum.org/ All other similar remix like sites WILL STEAL ALL YOUR MONEY.
If you copy and paste code that you dont understand and run it, then it WILL STEAL EVERYTHING IN YOUR WALLET. IT WILL STEAL ALL YOUR MONEY. It is likely there is code imported that you do not see right away which is malacious.
What to do when you see a tutorial or video like this:
Report it to reddit, youtube, twitter, where ever you saw it, etc.. If you're not sure if something is safe, always feel free to tag in a member of the r/ethdev mod team, like myself, and we can check it out.
Hi everyone, I'm a university student learning Solidity and new to Web3. For my final-year project, I want to build an autonomous app where AI agents perform Web3 operations with single goal or something similar . What project ideas would you suggest, what's in demand and trending right now and what's good to build as a project that can solve a problem.
Over the past month I was building two parallel pieces for autonomous AI agents: a pre-sign security gate (`security-gate-x402`) and an on-chain finance/vault agent.
This week I made a hard architectural cut: I stripped out 2,367 lines of directional trading, arbitrage, and ERC-4626 vault code and merged the useful counterparty verification primitives directly into a single **Pre-Settlement Customs & Verification Gate**.
**Why:**
With Solana's 0.4s finality and x402 machine-to-machine USDC payments, one prompt injection, poisoned MCP tool, or bad counterparty address drains a treasury irreversibly. At the same time, taking custody or running directional strategies adds massive risk. Sitting purely at the pre-sign / pre-settlement layer is much cleaner.
- Single call checks OFAC/mixer blocklists, live on-chain USDC + gas solvency across **Solana (501), Polygon (137), Base (8453), Arbitrum (42161), and Ethereum (1)**, plus optional `<3ms` payload audit and SHA-256 `proof_hash`.
**Shrunk our PyPI package by 97% (`v3.0.0` Thin MCP Client):**
- `agent-security-gate-x402` went from 537 KB (`fastapi`/`web3`/`cryptography`) down to **16.9 KB** (`httpx` + `mcp` only), forwarding stdio MCP calls to 18 live tools (`/mcp/tools`).
For anyone building agents that hold Solana or EVM wallets: how are you currently handling pre-sign policy enforcement and counterparty solvency checks before your agent signs a transfer?
small one but we've hit it on a couple of builds so figured it's worth posting.
some tokens (USDT on mainnet is the classic one) revert if you call approve(spender, x) while the current allowance is already nonzero. you have to set it to 0 first, then to the new value. if your contract does a plain approve before every swap or deposit, it works fine in tests with a normal ERC20 mock and then fails in prod the second time a user interacts, because some dust allowance was left over from the first call.
also USDT's approve doesn't return a bool, so a straight IERC20(token).approve(...) with a return check will revert too.
what we do now: use SafeERC20 forceApprove (newer OZ versions), which handles both the reset to zero and the missing return value. and in tests, add a mock that copies USDT's behavior instead of only testing with a vanilla ERC20. that mock alone catches a surprising amount.
the other option is approving exactly the amount you're about to spend and making sure it gets fully consumed, but that falls apart once fees or partial fills leave a remainder.
curious if anyone has other weird-token behaviors they now test for by default. fee on transfer and rebasing are the obvious ones, wondering what else people include.
0xCE744BE9c6674D81e4F4688917575C1fa8FC8e8E I just need it to test a project I had and the faucelets I tried didnt give me enough or mostly didnt work thank you so much
oksolc 0.2.5 now supports solc 0.8.37, 0.8.38 and 0.8.39, as well as solc 0.8.36.
Before oksolc 0.2.5, the compiler targeted only solc 0.8.36. A project pinned to a later release had no way to get the same bytecode from oksolc that its own solc produces.
What oksolc is
oksolc is a new Solidity compiler written in Zig. It accepts the same Standard JSON input as solc, and on the 12 projects we measured it built 3.3 to 6.0 times faster than solc's via-IR pipeline.
We wrote it for our own use while developing Chainwall. The goal was shorter build times during contract development.
oksolc provides a command-line tool, a C library with the same interface as libsolc, and a Zig module. The supported compilation path is optimized via-IR through Standard JSON.
What changed in oksolc 0.2.5
The default is now solc 0.8.39, and --solc-version selects any of the three earlier releases. The selected release controls pragma checks, code generation, diagnostics and metadata.
block.slotnum and Yul slotnum() compile on the Amsterdam EVM version from the solc 0.8.37 target onwards.
solc fixed four via-IR bugs between solc 0.8.37 and solc 0.8.39: SOL-2026-4, SOL-2026-6, SOL-2026-7 and SOL-2026-8 in the Solidity compiler bug list. oksolc applies the same fixes on every target.
Checked and unchecked arithmetic get separate constant helpers, and Yul returndatacopy calls that can revert keep their bounds checks.
I compiled the 14 projects bundled with the oksolc benchmark with both compilers, on each of the three new solc releases. The complete Standard JSON output was the same every time. The README reports the same result for 17 workloads.
The solc 0.8.36 target keeps the security fixes and the constant-helper fix, so its bytecode can differ from solc 0.8.36. The README documents each difference.
Build times on 12 open-source projects
For each project we sent the same Standard JSON build request to solc 0.8.39 and to oksolc 0.2.5 targeting solc 0.8.39. oksolc ran on 1 job and on 4 jobs. The benchmark records a result only when both compilers produce the same bytecode. Both compilers ran the optimized via-IR pipeline, so these times compare oksolc with solc via-IR, not with solc's default pipeline.
Project
solc 0.8.39
oksolc, 1 job
oksolc, 4 jobs
Sablier v2 1.2.0
523.1 s
208.4 s
145.9 s
EigenLayer 0.3.0
175.1 s
77.9 s
40.0 s
Solady 0.1.26
58.1 s
29.2 s
17.5 s
Uniswap v4 (2024-06-06)
39.3 s
18.2 s
7.4 s
Pendle v2 (2026-09-16)
26.0 s
12.1 s
6.8 s
OpenZeppelin 4.8.0
20.9 s
9.7 s
3.7 s
OpenZeppelin 4.7.0
18.9 s
8.8 s
3.2 s
Liquity (2024-10-30)
14.7 s
7.0 s
3.4 s
OpenZeppelin 4.9.0
13.6 s
6.4 s
2.7 s
OpenZeppelin 5.0.2
10.8 s
5.1 s
2.0 s
OpenZeppelin 5.6.1
10.3 s
4.9 s
1.7 s
Uniswap v4 (2022-06-16)
6.6 s
3.1 s
1.3 s
With a single job, oksolc built every project 2.0 to 2.5 times faster than solc. With 4 jobs, it was 3.3 to 6.0 times faster. Building all twelve took 15 minutes 17 seconds with solc and 3 minutes 56 seconds with oksolc on 4 jobs.
Incremental builds are faster still. In a serve or watch session, oksolc keeps the compiler in memory and reuses work between edits.
I measured on my Apple Silicon MacBook Air with 16 GB of memory. The solc times and the oksolc 4-job times are the median of 3 runs after 1 warmup run. The 1-job times are single runs. On 4 jobs, oksolc used more memory than solc on most projects, for example a peak of 5.3 GiB against 2.4 GiB on Solady. Sablier v2 peaked at about 8 GiB with either compiler in these runs, and its three runs varied more than any other project's.
Sablier v2, the largest project in the set, went from 8 minutes 43 seconds with solc to 2 minutes 26 seconds with oksolc on 4 jobs, with the same bytecode.
How to use it
You need Zig 0.17.1. Build oksolc from the release tag:
git clone https://github.com/okcontract/oksolc
cd oksolc
git checkout v0.2.5
zig build -Doptimize=ReleaseFast
./zig-out/bin/oksolc version
For a Foundry project, point foundry.toml at the oksolc executable and enable optimized via-IR:
oksolc can serve a local page for browsing a compiled project. It lists the project's source files next to the file you select, with an outline of everything that file declares.
For each contract the page also shows the ABI and the creation and runtime bytecode with their sizes. You can search the project, and two side panels list diagnostics and references.
open in the oksolc browser
The browser is left out of a default build. Build with -Dbrowser=true, which needs Bun 1.4.5 and TypeScript 7.0.2, then run it from your project:
oksolc serve --browse
Open http://127.0.0.1:8080. serve watches the Solidity files in src/ and recompiles when they change. To browse a single Standard JSON request instead, run oksolc browse --request input.json.
Including the browser adds about 0.3 MB to the binary.
What should it show next? Open an issue and tell us.
Try it on your project
Build one of your own projects with oksolc and compare the result with solc. If the two differ, open an issue on github.com/okcontract/oksolc and include the output of oksolc version --json.
If oksolc is useful to you, star the repository. For new releases, follow us on X at u/okcontract.
I used to spend a lot of time during audits trying to understand unfamiliar contracts, what each function actually does, how everything connects, and what assumptions the protocol relies on.
It was taking me longer than I wanted, so I started building this tool for myself to make that process easier. It’s called Autsec, and it helps me get a clearer picture of a contract before I go deeper into the audit.
It’s still early, but it has already been helpful for me and saved me time. I recorded a short demo and would genuinely like to hear what you think.
I've been working on a problem I think more of us will hit soon: AI agents that can spend money.
The usual options are bad: give the agent a key (unbounded loss on the first prompt injection), or use a custodial agent wallet whose policy engine runs on someone else's servers.
cyphos-guard takes a different route, using the MetaMask Delegation Framework:
The owner has a Hybrid DeleGator smart account (passkey owner via RIP-7212, optional EOA recovery).
The agent gets one delegation per permission, with caveats: recipient allowlist, per-period caps (NativeTokenPeriodTransfer / ERC20PeriodTransfer), allowed methods, expiry.
ERC-20 per-tx caps can't be expressed with stock enforcers, so I wrote a small CosignerEnforcer: a policy service co-signs each redemption (EIP-712, single-use, 5-min deadline). It can only block, never move funds.
Over the limit → approval request → the owner signs a one-shot delegation (ExactExecution + LimitedCalls(1) + Timestamp) with a passkey on their phone.
For x402 APIs: an ERC-1271 "vault" is the payer and only approves EIP-3009 TransferWithAuthorization to listed sellers. Verified against the official x402 facilitator on a fork, then live on Base Sepolia.
A static recovery page lets the recovery EOA sign a UserOp (EIP-712) and self-submit via EntryPoint.handleOps: no bundler, no backend.
Status: testnet only, not audited; I published an internal security review (3 findings fixed). Live runs with Basescan links are in the README.
Questions I'd love input on:
Anyone found a clean way to express ERC-20 per-tx caps without a co-signer?
Would you trust an ERC-1271 vault as an x402 payer, or wait for ERC-7710 support in facilitators?
x402 is the HTTP 402 flow: request, 402 with a USDC price, sign an EIP-3009 transfer, retry, facilitator settles. Nothing in it tells the buyer whether the seller will deliver or charge the listed price, so since October we have been the paying customer of every seller we could find in the Coinbase Bazaar.
Numbers as of today (live):
25,011 paid calls to 1,036 sellers, about 135 USDC in total
1,587 failed the buyer: 6.3%, 95% Wilson interval 6.0% to 6.7%
1,080 of those settled on-chain, then returned 4xx/5xx, an empty or wrong-typed body, or nothing within the seller's own declared timeout
507 quoted a price above the one the seller lists in the Bazaar; the official client has no expected price to compare with, so it paid every one; 428 were at 2x or more
Of 312 sellers with at least 30 paid calls, 228 have never failed one; 27 are rated avoid
The top 20 sellers by 30-day on-chain inflow fail at 10.3% [9.5%, 11.1%]; a random tail at 3.6% [3.1%, 4.0%]
The protocol finding: the exact scheme has no idempotency key. We sent one intent twice with fresh signatures to 10 sellers and 5 settled both. A plain retry after a dropped connection settled a second time at 5 of 10. Each new signature is a new payment, so a client that retries after a timeout or a paid 500 pays again unless it stores the nonce per intent and replays the stored result.
Method: u/x402/fetch 2.28, exact only, no retries, caps in code before any signature (0.50 USD a call, 20 a seller a day, 100 a day). Every settlement is matched to the AuthorizationUsed log for the nonce we signed. Wrong goods are unmeasured (no per-service schemas), so every rate is a lower bound. The sample is weighted to cheap calls; the dollar-weighted rate is 18.5% with an effective n of about 3,300, so treat it with care.
Disclosure: we run paidfor.dev, which publishes these as per-seller verdicts, and maintain two buyer-side clients on the official SDK. Sellers do not pay for ratings; every seller page has a reply route and one seller has already used it to get a correction published.
[Lasso RPC](https://github.com/jaxernst/lasso-rpc) is an open source (Apache-2.0) smart proxy for aggregating EVM RPC providers. You drop in one Ethereum JSON-RPC URL with a programmable routing strategy in the path (`/rpc/fastest/ethereum`, `/rpc/load-balanced/ethereum`), and Lasso measures each provider from live traffic and routes between them.
The annoying part is that providers all fail differently with transient network issues, rate limits, and frequent latest-block lag. v0.9.0 ([release notes](https://github.com/jaxernst/lasso-rpc/releases/tag/v0.9.0)) closes a few of those gaps:
- **Hung or unstable endpoints leave rotation.** A hang isn't an error response, so a timeout didn't count against the endpoint and it kept getting traffic. Now a timeout triggers a health check, and two failed checks take it out.
- **`latest` reads always go to endpoints at the chain head.** This replaces the fixed `max_lag_blocks` setting and ensures latest blocks can be strictly monotonic (except for during reorgs). Lagging endpoints still serve historical reads.
- **Fast modes don't trust unproven endpoints.** `fastest` no longer sends traffic to failing endpoints that haven't proven themselves, and `balanced-fast` no longer locks a method onto whichever endpoint qualified first.
- **Standalone builds** for Linux (x86_64, aarch64) and macOS on Apple silicon. No Docker or Erlang needed: unpack, run `lasso/bin/lasso start`, and point your client at `http://localhost:4000/rpc/ethereum`.
Since my last post here (v0.6), Lasso also started learning provider limits from live traffic (v0.7) and pinning tx sends to providers you choose (v0.8).
**Where these fixes came from:** Bloom, an open source wallet, had a failover bug where it never reached a chain's third endpoint ([#527](https://github.com/bloom-directory/bloom/issues/527)). I built a harness that reproduces wallet failure cases like that one and posted the results on [their tracker](https://github.com/bloom-directory/bloom/issues/540). Run 1 exposed the hung endpoint problem. Run 2, on v0.9.0 meaningfully improved these results.
Still hard: a burst of txs to an endpoint that silently drops them can lose some before Lasso notices, and a lagging endpoint can serve stale reads between head checks (faster head checks are next).
I'll rerun this every release. If you've hit an RPC failure in prod that's worth testing, drop it here and I'll add it to the next run.
Someone posted a DAO treasury prototype this week where governance votes on the mandate and a Safe executes it. They had just added a proposal, a vote and a delay before any mandate change, which is good. But the signers are still Safe owners, so they can call execTransaction and send the treasury anywhere, vote or no vote.
My first thought was a guard that only lets through calls the current mandate allows, or giving the signers a Zodiac Roles module instead of owner keys. The more I look at the guard version the less clean it gets.
setGuard is a Safe transaction too, so the owners can just remove the guard unless it also blocks calls to setGuard, enableModule, changeThreshold and the owner functions, and then a bug in the guard can lock the Safe for good, removing it included. And on 1.3 and 1.4 Safes a module goes through execTransactionFromModule, which never touches the transaction guard, so one enabled module is a way around it. 1.5 added module guards for exactly that.
So right now I lean towards the signers not being owners at all, only role holders, with the owner being something governance controls. I'm not sure that holds up once you need someone to act fast in an incident though.
If you run a treasury where the vote is supposed to bind the signers, what actually enforces it today, and what did you give up to get there?
Solidity v0.8.39 fixes a medium-severity bug that could silently corrupt storage when copying recursive structs, and warns about code size based on the new limits of the Amsterdam EVM version. It is likely the last release of the 0.8 series before 0.9.0.
Recursive struct copy bug fix
A struct is recursive when it can contain values of its own type, as in struct Node { Node[] children; uint256 data; }.
When such a struct, or an array of such structs, was copied within storage to a location that contained it, as in root = root.children[0] or roots = roots[0].children, the copy overwrote the source before it had finished reading it. The elements nested in the source were lost, and the members declared after the array came back as zero. No error was reported.
Versions 0.4.9 to 0.8.38 are affected with the default evmasm pipeline, and versions 0.8.13 to 0.8.38 with --via-ir. The optimizer settings and the EVM version do not matter.
The fix adds a runtime check to every storage-to-storage copy of a recursive struct or an array of such structs. The check costs extra gas, and copies into deeply nested targets can run out of stack space at a smaller depth than before.
A scan of the verified contracts on Sourcify found no deployed contract that performs an affected copy.
The bug was reported by cyberthirst through the Ethereum Foundation's bug bounty program.
In the evmasm pipeline, a nested tuple assignment with a string literal could assign values to the wrong variables. For example, with bytes32 z and uint256 a, ((z, a), b) = (("x", 111), 222) assigned 111 to z and bytes32("x") to a. We do not consider this a security issue, because the pattern is unusual and unlikely to be used in practice.
When compiling with --evm-version amsterdam, the compiler now warns about contract code larger than 64 KiB and initcode larger than 128 KiB, the new limits from EIP-7954. For all other EVM versions, including the current default Osaka, the warnings still use the old limits.
The compiler now also warns about code size when it compiles standalone Yul code.
With --ethdebug-resources, the compiler now emits the full info/resources schema of the ethdebug format, which describes types and their layout to debuggers. ethdebug output remains experimental and requires --experimental. For an introduction to the format, see ethdebug: a shared language for debug data, in use across projects today.
Solidity 0.9.0
For years, we planned 0.9.0 as a large breaking release that would make the IR pipeline the default. Our plans have changed. We still plan to make the IR pipeline the default, but we no longer tie this to 0.9.0. Instead, we want to make breaking releases more often and make them smaller.
Most of the changes merged for 0.9.0 so far remove features that earlier 0.8 releases deprecated, such as ABI coder v1, virtual modifiers, the ABIEncoderV2 pragma, the SMTChecker's BMC engine and the EVM versions older than Constantinople.
We plan to publish a pre-release of 0.9.0 before the final release. A separate post will explain the new release schedule and the reasons for it.
We’re announcing a **7-day transition window (Nov 20 – Nov 27, 2026)** to move our Python SDK/MCP package `agent-security-gate-x402` (`v2.2.1`) from a heavy local bundle to **`v3.0.0` (Cloud-Native Thin Client & Remote Gateway)**.
### Why this matters for EVM / Agent Wallet builders
**Live Threat & Drain Rules > Stale Local Packages:** ERC-20 `approve` / `increaseAllowance` / `permit` drain bypasses, prompt injections, and dangerous AST payloads evolve constantly. Centralizing inspection on our Cloud Gateway guarantees `<5ms` up-to-date defenses and EIP-712 attestation generation without waiting for manual package upgrades.
**Zero-Bloat Client:** Moving away from bundling `fastapi`, `uvicorn`, `web3`, and `eth-account` locally—`v3.0.0` only needs lightweight HTTP/MCP deps (`httpx`, `mcp`) while keeping full **Polygon OMS (`SecurityGateOMSPolicy.sol`), Base AgentKit, and Arbitrum Safe/Stylus** guardrails active on the gateway.
### 7-Day Schedule (Nov 20 – Nov 27, 2026)
* **Nov 20 (Day 1):** Official 7-day transition notice published.
Building a community around a Web3 project is one thing. Keeping people interested and involved over time is a different challenge.
Some projects have thousands of members across Discord and Telegram, but only a small number actively participate in discussions. Others may have smaller communities where members regularly share ideas, ask questions and contribute to the project.
It makes me wonder whether community growth should be measured by the number of members or by how much people actually participate.
For those involved in Web3 communities, what do you think makes members stay active and genuinely interested in a project beyond launch announcements, giveaways and token-related discussions?
Short version: DeFi still doesn't have a basic piece of finance, which is fixed rates. We spent a long time iterating on an onchain rate swap design until it worked.
Kairos lets you fix the rate on a loan you already have without moving it. Live on Ethereum and Base.
We just open-sourced **Zean** (Zig + Lean), a toolkit for translating supported Zig functions into executable Lean models and proving their behavior. It came out of our formal verification work on [oksolc](https://github.com/okcontract/oksolc), our Solidity compiler written in Zig.
Zean works from AIR, Zig's analyzed intermediate representation. An instrumented compiler captures supported functions from AIR, and a translator emits executable Lean program definitions. Specifications and proofs live in separate handwritten Lean modules.
A verification library derives the proof obligations for memory access, initialization, permissions, arithmetic, control flow and supported calls. You write the contracts and loop invariants. If an obligation still needs a mathematical argument, you supply that too, and Lean checks the proofs. Unsupported operations are rejected, and unresolved obligations stay open.
The caller has to establish that the source has enough initialized words and the destination has enough writable storage. For the source-preservation contract, the two ranges also have to be disjoint. Under those assumptions the proofs show there are no invalid accesses or uninitialized reads. A successful run copies the source contents into the destination and preserves memory outside it. Modeled allocation exhaustion is an explicit permitted failure, and termination is a separate property.
Change the loop bound from `< length` to `<= length` and you get an extra boundary access that the original contract can't justify. The tutorial also includes deliberately false claims that must fail verification.
When the Zig source changes, you recapture the function to regenerate the model, then replay the proofs.
This release covers memory-safety examples derived from Ziglings, buffer updates, copy loops, helper calls and a captured specialization of `std.mem.replaceScalar`. It supports restricted AIR fragments, with explicit target and layout constraints. The capture pipeline, the Zig frontend and the native backend remain trust boundaries, so the proofs don't establish correctness of the final native binary or of the whole compiler.
The idea is to keep design iteration in Zig and prove a component's contracts once it has settled.
Our contracts took 709 seconds to build with solc. We tried tuning the build for a while, gave up, and wrote our own compiler.
oksolc is a reimplementation of solc 0.8.36 in Zig. Around 156K lines, no C++. It only does the optimized via-IR pipeline through Standard JSON, because that's what we ship with. For Foundry you just point FOUNDRY_SOLC at it.
The frontend is still sequential. The Yul optimizer and EVM codegen run per contract in a thread pool, which works because contracts barely depend on each other after the frontend.
The bigger win for day to day work is the persistent session. Each source file gets a semantic fingerprint, so editing a comment or reformatting doesn't invalidate anything. Import cycles are handled as SCCs and invalidate together. Artifacts are cached per phase in SQLite with HMAC-SHA256 on the entries, so a tampered cache can't hand you bytecode. oksolc serve --stdio keeps the whole thing warm between builds.
solc vs oksolc with 4 jobs:
Uniswap V4, full build: 59.0s vs 11.2s (5.3x) Pendle V2, incremental: 38.9s vs 1.4s (27.6x) Chainwall, full build: 709.8s vs 138.4s (5.1x)
Script is at test/benchmarks/external-compare.sh if you want to rerun them.
The thing I didn't expect going in is how much time we'd spend on what Solidity actually means. There's no formal spec. The language is whatever solc does. We run a weekly fuzz job that diffs our bytecode against solc on a public corpus, and CI builds OpenZeppelin, Uniswap v4, Pendle and Solady and pins the hashes. When the two compilers disagree, the diff shows you they differ but there's nothing that says which one is correct. We ended up with 9 places where we do something different from solc on purpose, and every one of those was an argument from the docs and from what the feature is obviously meant to do.
For most languages that's annoying. For this one it's worse, since the output can't be patched after deployment and often holds a lot of money. A compiler bug stays on chain. And fuzzing only covers the programs the fuzzer happened to generate, so at some point you want proofs, and you can't prove anything against a language with no definition.
So we started writing the definition. Solidity Spec is an executable formal model of Solidity in Lean. You can run real programs through it and compare with compiler output, and you can state properties about the semantics and get them machine checked. There's a paper, and machine-checked proofs for explicitly defined parts of the model. Coverage is still growing.
The long term goal is checking a compiler's output against a definition of the language, the way CompCert did for C and CakeML did for ML, instead of against another compiler.
If your Solidity builds are slow, try it. And if you work on semantics or verified compilers, I'd really like to know where the Lean model is wrong.
Kava's CalculateSupplyInterestFactor (in x/hard/keeper/interest.go) divides new interest by cash + borrows − reserves, and the only guard is IsZero(). On Nov 14, someone brought the dead BUSD market's net supply down to 2 base units. One accrual pushed the supply index from about 2.76 to 671,187, and 127 loans against that inflated collateral drained about 53.9M KAVA.
This is the same shape as Hundred, Onyx, Radiant and Sonne. Those were new markets, while this one was a market being wound down with its collateral factor still above zero. The post also covers a separate, unreported 23.5k ATOM shortfall that showed up in the same module on Nov 10. I also scanned about 2,000 Aave-fork reserves and about 260 Compound comptrollers, and empty markets that still count as collateral are held shut only by caps or freeze flags. For example, Radiant's sUSDe reserve on Ethereum has zero supply, a 72% collateral factor, and a borrow cap of 1.
If you're winding down a market, set the collateral factor to zero first, then turn off borrowing, then tell depositors to leave.
Lets say we have this simple smart contract written in solidity:
pragma solidity ^0.8.13;
contract Counter {
uint256 public number;
function setNumber(uint256 newNumber) public {
number = newNumber;
}
}
Environment:
Solidity: 0.8.13
Optimizer: disabled
Foundry: 1.0.0-stable
After compilation we get this runtime code: 6080...56fe. I was curious about how this bytecode is executed for example when I send a transaction with function signature: setNumber(uint256 newNumber) and argument: 1. And I analysed by hand opcode by opcode what is happening (yes I'm crazy - leave me alone). And I wrote it this way::
6080 PUSH1 stack:80
6040 PUSH1 stack:40,80
etc.
I counted 118 opcode executions until I reached the 00(STOP) opcode. Which I think is a crazy amount of opcodes.
I'm aware that what really matters in this example is the SSTORE opcode which consumes 98% of the gas. I have these questions:
Is it really that necessary to have these 118 opcodes to store a single value? At some point I just lost what happens after multiple SWAPs, POPs and JUMPs. Is it important for security reasons or rather to make bytecode more universal in case of more complex operations?
When it comes to optimizing gas consumption do people really pay attention to that 2% of triggered opcodes or do they just focuse entirely on finding the locations of operational codes that actually consume gas, such as sstore?
PS After writing this post, I compiled the code with the optimizer enabled and got a completely new, more optimized bytecode, so I'm no longer sure if my original post is still relevant, but I'd still love to hear your thoughts.