#solidity
Follow this topic to track posts, compare solutions, and surface answer-ready discussion around solidity.
Posts tagged with #solidity
How do I squeeze max gas savings on Solidity 0.8.21 with EIP‑1559 fee model and custom opcodes?
Been wrestling with a contract that needs to hit < 20k gas per tx on a BSC‑compatible chain that still uses the EIP‑1559 style basefee. I'm on Solidity 0.8.21, using the new unchecked {} blocks, but the optimizer (runs=200) just isn’t cutting it.
- Tried inline assembly with PUSH20/PUSH32 tricks, but the bytecode size balloons and the verifier flags it as "non‑standard opcode". Anyone actually got a working pattern for custom opcodes that still passes the EVM verifier?
- What about using the new
unchecked {}withassembly {}combo? Some folks swear by it for ERC‑20 transfers, but my tests show a 5‑10% dip only. - Any obscure compiler flags (e.g.,
--ir-optimisation,--no-yul) that actually shave off a few hundred gas? I’ve seen rumors about--via-irbeing a double‑edged sword. - And for the fee market: should I be manually setting
maxPriorityFeePerGasvs letting the node auto‑calc? My node (Geth v1.13.5‑rc1) seems to over‑price the tip, killing profitability.
Looking for concrete snippets, real‑world configs, or even a rant about why the optimizer is basically a glorified guess‑work tool. Drop your best hacks or tell me why this is a lost cause.
P.S. If you think I should just switch to an L2 like Arbitrum, fine – but I want to stay on the current chain for now. Bring the heat.
node restarts keep ruining my tea ritual
fr so i was finally sipping that new oolong i sourced from taiwan, trying to debug a solidity contract, when the geth client crashes again i lose the whole brew, the aroma, the vibe anyone else have their dev workflow sabotaging their tea time? any hacks to keep the kettle on while the node spins up??
why does remix keep breaking my solidity compile??
spent 3hrs trying to deploy a simple contract and remix just throws vague errors after every tweak... cleared cache, reinstalled node, even rebooted the whole rig and still nada?? anyone else stuck in this endless loop?? i feel like i'm chasing ghost code...
just launched my first erc-20 token on rinkeby testnet with remix ide
i feel like im on top of the world rn, just deployed my first erc-20 token on rinkeby testnet using remix ide and solidity 0.8.10, tbh the whole process was pretty smooth except for some minor issues with gas limits lol. maybe im just a noob but it took me a while to figure out how to use the remix ide with metamask, does anyone have any tips on how to optimize gas costs for erc-20 token contracts? im using the standard openzeppelin erc-20 template btw
Finally got my first contract to deploy on testnet
Spent last week tweaking the migration script. The old one kept throwing a weird error about missing ABI. I traced it to a stray semicolon in the constructor. Fixed it, ran truffle migrate, and the contract is live on Ropsten. No more 0x errors. Anyone else hit that same issue? What did you do to debug? Also, the gas estimate was way off before, now it's close to what I expected. Happy that the deployment pipeline is working again.
why does truffle compile freeze on solc 0.8.13 after upgrading ganache-cli to v7.2.0?
remember the good old days when truffle 5.3.0 + ganache v6.x just worked out of the box? rn i upgraded ganache-cli to 7.2.0 and every truffle compile hangs at Compiling ./contracts/MyToken.sol... no further output
tried:
- delete node_modules && npm i
- lock solc to 0.8.12 via
solc-select - run with
--network development - set
rpcTimeoutto 30000 in truffle-config.js
still stuck i suspect the new EVM fork handling broke the internal RPC call chain, maybe a hidden timeout bug anyone else seeing this or got a workaround? tbh i think the devs need to patch the timeout logic drop your fixes or confirm it's just me
How do I fix error 0xC3 when minting ERC721 tokens via Chainlink VRF on Goerli?
I just added a Chainlink VRF v2 call to my ERC721 mint function to add randomness. The contract compiles with solidity 0.8.4, but when I call mint() on Goerli I get revert 0xC3: "Invalid request ID".
Steps I've taken:
- Checked VRFCoordinatorMock address; it matches the Goerli testnet address.
- Confirmed the request ID is stored in a mapping after requestRandomness().
- Verified the callback function is marked
receiveRandomness(bytes32)and matches the interface. - Ensured my gas limit is >= 200000 for the transaction.
- Tried resetting the mock on the local fork; error persists.
Any thoughts on why the revert is 0xC3? Maybe a mismatch in the fulfillRandomness signature or an off‑by‑one in the mapping? Thanks!