Michael Amadi Profile Banner
Michael Amadi Profile
Michael Amadi

@AmadiMichaels

3,283
Followers
393
Following
122
Media
1,272
Statuses

Protocol Engineer @OPLabsPBC | Prev: @RareSkills_io

Don't wanna be here? Send us removal request.
Pinned Tweet
@AmadiMichaels
Michael Amadi
2 years
Took some time and a lot of debugging but it's completed. Uniswap V2 written in @huff_language 🐴 - UniswapV2Pair - UQ112x112
34
43
359
@AmadiMichaels
Michael Amadi
2 years
@FeyiiSZN That's why everyone isn't LGBTQ. This is like saying that Engineers that go to doctors for treatment are funny to you because if everyone was an engineer then who'd treat them. Everyone can't be an Engineer. Everyone can't be LGBTQ. Let everyone do what they want. Simple.
8
13
312
@AmadiMichaels
Michael Amadi
1 month
Happy to share that I'm joining @OPLabsPBC as a Protocol Engineer. Excited to collaborate with some of the brightest minds to help scale Ethereum and build the future 🔴
65
12
282
@AmadiMichaels
Michael Amadi
11 months
For the Huffathon, I, alongside @tanim0la and @Jesserc_ built Zyclone, a Token mixer, similar to Tornado Cash, but way cheaper. In fact, it's more than 500% cheaper to use than current TC instances. Here's the benchmarks and the link to the repo can be found below 👇
Tweet media one
13
21
140
@AmadiMichaels
Michael Amadi
11 months
Made a Secp256r1/p256 EC verifier Huff implementation. This was inspired by @daimo_eth 's implementation and passes their unit tests. In comparison to theirs, this implementation costs approximately 90k gas less (~ 240k gas) to verify a p256 sig.
12
17
115
@AmadiMichaels
Michael Amadi
9 months
Today I'm starting a repository of vulnerabilities unique to smart contracts written without the guardrails that higher level langs provide. I'll be updating it over time with more vulnetabilities and POCs. More info under tweet 👇
3
20
113
@AmadiMichaels
Michael Amadi
1 year
Been learning rust. Made this cool CLI tool to practice my learning so far. Would appreciate criticisms on it and how it can be better, faster etc
5
12
108
@AmadiMichaels
Michael Amadi
8 months
1/25 2023 was my first full year as a developer and was definitely one to remember. I learnt a lot, made a lot of OS code, did gas, bytecode audits, wrote smart contracts and articles Collating certain milestones made me realize my progress hasn't been as bad as I thought 👇
16
11
98
@AmadiMichaels
Michael Amadi
2 years
@huff_language is already cool but sometimes debugging large your codes requires some patience. Imagine how much easier debugging it would be if we could console log the stack, memory, calldata at different points in our huff codebase? Well here you go
6
21
91
@AmadiMichaels
Michael Amadi
9 months
LowLevelVulnerabilities: NOT SO MEMORY SAFE Your code can be memory unsafe even without violating what the solidity docs define as memory-safe. Without running the code first, check if you can correctly guess whay these two contracts return Answer is below 👇
Tweet media one
Tweet media two
6
6
89
@AmadiMichaels
Michael Amadi
3 months
Starting today...
Tweet media one
4
3
89
@AmadiMichaels
Michael Amadi
4 months
Last week was my last at Rareskills. It's been a wonderful ride researching, learning, and building with brilliant colleagues! Very grateful for the invaluable experiences and the exceptional people who made it an unforgettable part of my journey!
5
2
82
@AmadiMichaels
Michael Amadi
1 year
Was interesting building this! @huff_language implementation of a @Uniswap UniswapX Filler execution contract with ability to dynamically swap between V2 and V3 pools via the SwapRouter02 router.
6
13
78
@AmadiMichaels
Michael Amadi
7 months
Thrilled to have been selected as one of the recipients of Builders Grant from @base for my P256 Huff Verifier: Grateful for the support and excited to continue building 🫡
@base
Base
7 months
Announcing some of the first recipients of Builder Grants in 2024: - @coinage_media , a DAO putting media ownership onchain - @mikebodge for Stay Hydrated's 'love letter to web3' - @OmniKingdoms , an onchain MMO with gasless gaming - @theahchu for @basemint_tech 's key-gated chat
90
83
448
11
6
77
@AmadiMichaels
Michael Amadi
5 months
Thanks for this cool custom pfp! @asterixlabs
Tweet media one
10
9
71
@AmadiMichaels
Michael Amadi
3 years
@6ixthian @Fasoye_Mide @Tunde_OD Digital Ownership* NFTs are tokens on the blockchain that represent ownership of unique items, not just art.
2
5
67
@AmadiMichaels
Michael Amadi
1 year
My evm simulator detects balance and allowance changes (for erc20, 721 and 1155 token standards) for each tx simulated all from your CLI
4
6
68
@AmadiMichaels
Michael Amadi
7 months
Thrilled to share the launch of DN404, the result of a collaborative weekend effort with an exceptional team of chads, @0xCygaar @optimizoor @PopPunkOnChain @0xjustadev @0xQuit . DN404 is an implementation of a co-joined ERC20 and ERC721 pair. It offers: • Full compliance with
8
5
67
@AmadiMichaels
Michael Amadi
1 year
What if you had an external library with a couple of functions you wanted to optimize it as much as possible. So much so that if you could minimize function dispatch costs, you would be very glad? Well here you have it. A constant gas function dispatcher in external libraries 👇
Tweet media one
Tweet media two
9
8
63
@AmadiMichaels
Michael Amadi
9 months
Indepth explainer (POC, why) on ECC edge cases are quite hard to find. Most just say "Do not do this, it can be exploited this way", but never say why, how its possible mathematically. So I decided to make it easier to understand Summary below 👇
3
11
59
@AmadiMichaels
Michael Amadi
2 months
Found an elliptic curve lib I was writing from scratch last year but didn't have the time to work much on it. I spent the weekend completing it. It's not as optimized as standard cryptography libs, but I can say it's way faster than it was initially.
2
4
57
@AmadiMichaels
Michael Amadi
11 months
Some weeks back, I built Tempest, a prototype of how I imagine private transfer of value between 2 parties would work within a privacy based system similar to Tornado Cash. This is the outcome with a few extra features 🔅 Brief explainer 👇
3
6
54
@AmadiMichaels
Michael Amadi
3 months
Just finished the Self-Hosted EVM quest on @nodeguardians and can't recommend it enough. Link in comments
Tweet media one
2
2
53
@AmadiMichaels
Michael Amadi
3 years
@airykohnie @FrankKhalidUK @ChelseaFC @bluesempireCFC Quite a wonderful RB he's been this season. Wonder why he wasn't mentioned🤔
1
0
50
@AmadiMichaels
Michael Amadi
1 year
Huffidity, but it let's you jump back to solidity when you're done executing the huff bytecode. POC 👇
Tweet media one
Tweet media two
Tweet media three
3
5
49
@AmadiMichaels
Michael Amadi
3 months
TIL: For addresses that do not exist, i.e., a) haven't sent a tx, i.e., nonce is 0 and b) haven't been the recipient of a non-zero value tx Their EXTCODEHASH is bytes32(0) and not keccak256(new bytes(0)) as you might expect. This includes selfdestructed contracts (at least
2
2
52
@AmadiMichaels
Michael Amadi
2 years
So I brought this idea to life. A way for anybody to transfer and receive ERC20 tokens on any EVM chain without the internet using USSD. Basically, @Machankura8333 but for EVM chains.
@AmadiMichaels
Michael Amadi
2 years
Why isn't there a way to use stablecoins without the internet via USSD?
0
0
1
5
10
43
@AmadiMichaels
Michael Amadi
11 months
Want to start using cancun fork opcodes like tload and tstore with @huff_language ? It's as easy as just adding `cancun = true` to your foundry.toml and using the opcodes with the huff helper function __VERBATIM(). Here's an example with tload and tstore
0
6
43
@AmadiMichaels
Michael Amadi
1 year
Normally, 2**256 should revert since it "overflowed" before subtracting 1. But since this is hardcoded in the x function, Solidity (at compile time) performed the arithmetic outside evm rules and simply hardcoded true (in this case) as the return value, as seen in the x function
Tweet media one
@RareSkills_io
RareSkills
1 year
Will this return true or false? function maxUint() public pure returns (bool) { return 2**256 - 1 == type(uint256).max; } Why?
14
1
23
1
8
44
@AmadiMichaels
Michael Amadi
1 year
@bytes032 Further optimization: use the scratch space (0x00 - 0x40) to store the revert message to avoid expanding memory. You also avoid the extra mload of 0x40 If the revert data is > 64 bytes, no need to check the free memory pointer since you're reverting right after.
5
1
43
@AmadiMichaels
Michael Amadi
3 months
Done with it. Learning fundamentals makes higher level stuff make so much more sense. Strongly recommend.
Tweet media one
@AmadiMichaels
Michael Amadi
3 months
Starting today...
Tweet media one
4
3
89
1
0
41
@AmadiMichaels
Michael Amadi
6 months
Congrats to everyone who submitted for the @curta golf contest @atarpara @real_philogy @shunduquar @0xjustadev Spent hours working on a constant gas solution for hours only to realize when I was done that there was a codesize gas penalty imposed 🤦🏾‍♂️ Thought I should still share
4
2
39
@AmadiMichaels
Michael Amadi
6 months
Happy to have audited Bytecode20, and it's finally public so check it out ! Gas bad
@PopPunkOnChain
Pop Punk
6 months
Introducing Bytecode20. The most ridiculously optimized and over engineered ERC20 base contract to ever exist. This is accomplished with raw EVM bytecode compiled directly in the constructor. Written by @0xjustadev , audited by @AmadiMichaels .
44
23
284
3
4
35
@AmadiMichaels
Michael Amadi
9 months
This is now deployed on Eth-Goerli, Eth-Sepolia, Base-Goerli and Base-Sepolia testnets at address 0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5 Also has a custom library that huff contracts can use to interact with it and verify sigs while choosing if to support malleability or not
@AmadiMichaels
Michael Amadi
11 months
Made a Secp256r1/p256 EC verifier Huff implementation. This was inspired by @daimo_eth 's implementation and passes their unit tests. In comparison to theirs, this implementation costs approximately 90k gas less (~ 240k gas) to verify a p256 sig.
12
17
115
4
3
36
@AmadiMichaels
Michael Amadi
1 year
More Dynamic Huffidity for CT This time a basic commit reveal scheme contract written in Solidity What's interesting is the hash algo it uses. It uses MiMCSponge, same as tornado cash. But here's the thing, it's not called via a staticcall like TC but internally via a jump 👇
Tweet media one
2
3
35
@AmadiMichaels
Michael Amadi
1 year
EIP-7212: Precompiled for secp256r1 Curve Support
2
1
34
@AmadiMichaels
Michael Amadi
9 months
So I've been thinking of ways to improve runtime security for smart contracts and had an idea. Once a protocol is deployed. The team can define set of invariants and have a script check that these invariants still hold after every tx sent to the contract. 👇
11
5
32
@AmadiMichaels
Michael Amadi
3 months
Here's an interesting way to encode all of the supported opcodes of an EVM chain in 256 bits. This is that of Ethereum mainnet currently. Base 2:
3
0
35
@AmadiMichaels
Michael Amadi
3 years
0
0
31
@AmadiMichaels
Michael Amadi
9 months
🫡
Tweet media one
Tweet media two
@0xjustadev
0xjustadev.eth (⛽️,📉)
9 months
@real_philogy @curta_ctf @orenyomtov Need to look at @AmadiMichaels submission, that's the real alpha. I reverted all my 2251's last night, if I wasn't going to take the top spot I wanted my score to represent spirit of the challenge 😅
1
0
9
8
2
32
@AmadiMichaels
Michael Amadi
11 months
I'll be giving a talk tomorrow for the Huffathon on Huffidy: What it is, Its uses, detailed explainer on how it's possible and how it works, making it "Dynamic" and a live workshop where we will build a Huffidity contract from scratch! You won't want to miss this!
@huff_language
Huff
11 months
Speaker highlight: "Huffidity" by @AmadiMichaels 👈 Join the discussion about a project that allows you to write Huff code inside a Solidity contract 🤯 The "Huffidity" presentation on the Huff Center Stage Monday, Oct 2 at 5pm UTC
Tweet media one
2
3
32
3
6
32
@AmadiMichaels
Michael Amadi
1 year
OptimizedMiMC Sponge hash function written in @huff_language . Tbh it's already a well optimized contract but was able understand how it works and squeeze out some gas saving Here's the benchmark for runtime and creation time gas savings Repository 👇
Tweet media one
1
5
31
@AmadiMichaels
Michael Amadi
2 years
I could write low-level evm code for the rest of my life.
3
2
31
@AmadiMichaels
Michael Amadi
2 months
Wrote a generic (over the number of `bitsPerIteration`) Strauss Shamir impl. The space complexity is O(2 ** 2n), where n is the bitsPerIteration. Because of this, it's important to find a balance between gas cost per iteration and memory expansion cost that comes with reducing
Tweet media one
1
0
30
@AmadiMichaels
Michael Amadi
1 year
Check out what we made guys!, great way to begin huffing 🐴
@RareSkills_io
RareSkills
1 year
Wanted to try @huff_language but needed some easy first steps? We've created Huff Puzzles () where you fill in the missing code, then run the tests we've created for you. It's super seamless. The puzzles start off very easy and get progressively harder.
5
24
111
2
0
27
@AmadiMichaels
Michael Amadi
6 months
1
6
24
@AmadiMichaels
Michael Amadi
10 months
@PopPunkOnChain contract RevGas { uint256 public i; /// call me {in, ex}ternally if you need that bag function getThatBag(uint256 x) public { for (uint256 i; i < x;) { assembly { let a := sload(i) } i := SafeMath.add(i, 1); } } }
2
0
25
@AmadiMichaels
Michael Amadi
1 year
Ofc Solidity uses 0x40 - 0x80 for its compiler operations (0x40 stores the free memory pointer and 0x60 is where uninitialized dynamic types point to) and expects only itself to update values stored there. 👇
@asyncakash
zkash
1 year
@AmadiMichaels @bytes032 can you please elaborate your point about revert data > 65 bytes… ?
0
0
1
2
4
25
@AmadiMichaels
Michael Amadi
7 months
First answer: Explainer: In Solidity, when it successfully matches the first 4 bytes of calldata sent to a function selector that expects parameters, it asserts that the length of calldata is >= (4(i.e the selector) + the number of parameters * 32). So
@AmadiMichaels
Michael Amadi
7 months
Solidity Trivia 0: Without looking at it's bytecode, does this contract have a revert path? and if so how can you trigger it?
Tweet media one
3
0
13
2
1
23
@AmadiMichaels
Michael Amadi
11 months
This now passes all wycheproof tests which test edge cases in parsed in parameters while verifying p256 sigs. There's also now a benchmark in the Readme and comparison with FCL's verifier and Daimo's verifier.
Tweet media one
@AmadiMichaels
Michael Amadi
11 months
Made a Secp256r1/p256 EC verifier Huff implementation. This was inspired by @daimo_eth 's implementation and passes their unit tests. In comparison to theirs, this implementation costs approximately 90k gas less (~ 240k gas) to verify a p256 sig.
12
17
115
2
0
25
@AmadiMichaels
Michael Amadi
1 year
Huffoors and optimizoors, TIL, in the past, solidity supports something called "loose-assembly" which is basically what we would call Huff in Solidity. This means there's a codebase for this somewhere and the idea isn't far fetched It was disallowed in solidity 0.5.0!
Tweet media one
Tweet media two
3
2
23
@AmadiMichaels
Michael Amadi
8 months
2/25 I started @RareSkills_io at the start of last year and it has been nothing short of wonderful. Learnt a lot doing reasearch in different fields - Low level EVM - Gas Optimization - Security - Smart contract patterns - Cryptography and ZK - Other blockchain's architecture 👀
2
1
23
@AmadiMichaels
Michael Amadi
4 months
I've spent a substantial amount of the past 2 months playing around with aztec sandbox and reading through the docs/protocol specs, and I can't tell you how excited I am about this! Certainly can't wait!
@Zac_Aztec
Zac Williamson
4 months
gm gang, we've been hard at work building the Aztec L2 and I want to give an update! We're building a full end-to-end testnet and we're close to completing this breakthrough technology It will be the world's 1st decentralized, privacy-first programmable L2. Kind of a big deal.
34
71
482
0
1
23
@AmadiMichaels
Michael Amadi
1 year
Please correct me if I'm wrong We can safely use the zero slot and without setting it back to 0 while jumping btw solidity and julia, as long as there are no uninitialized dynamic memory values (UDMVs) e.g bytes memory, string memory and T[] memory within that call stack. 👇
4
4
23
@AmadiMichaels
Michael Amadi
1 year
For solidity devs using inline assembly, solidity uses the scratch space to perform keccak256 operations to get dynamic storage vars (DSV)'s storage slots. So best not to point memory vars there if the code reads DSVs using solidity afterwards. Solidity will be overwrite it.
6
0
21
@AmadiMichaels
Michael Amadi
1 year
🐴
Today, we are thrilled to announce a partnership that takes us back to our roots. @aztecnetwork has officially sponsored the Huff language ecosystem with a RPGF grant.
4
26
124
0
0
10
@AmadiMichaels
Michael Amadi
1 year
Bytecode auditing and analysis might **need** to be a thing after all...
2
0
20
@AmadiMichaels
Michael Amadi
4 months
With EIP-7702, what happens if the one-time code executes the selfdestruct opcode? - Gas refund? - More gas? Seems the better option since the nodes will still _attempt_ to delete the code & storage at the address after tx execution More importantly, what happens to the ETH at
5
0
19
@AmadiMichaels
Michael Amadi
4 years
I really haven’t even cracked the surface of what’s possible... I didn’t come this far to only come this far!
2
1
17
@AmadiMichaels
Michael Amadi
1 year
They're probably a dozen mm snaps and extensions now that do this now but just thought to share it in case anyone might find it helpful Here's the github repo, you can clone it and start running simulations
1
3
18
@AmadiMichaels
Michael Amadi
1 year
Damnnn, the urge to live stream writing in huff 😬
6
0
18
@AmadiMichaels
Michael Amadi
3 months
Spent the evening making an EOF bytecode parser with some header invariant validation based on the specs. Also using this to get back into rust. Here's an example output when run with EOF bytecode: 0xef0001010004020001000304000400008000013050fe0bad60a7 Repo link in comments
Tweet media one
2
1
18
@AmadiMichaels
Michael Amadi
2 years
@asemota every "Centralized/Custodial Service" is going to end up regulated and customers protected.
3
1
16
@AmadiMichaels
Michael Amadi
2 years
This article by @marqymarq10 is a gem, thanks for sharing @pashovkrum One more thing that's not mentioned is how dynamic values initiated in memory are stored and returned. Which can be quite tricky, so I will explain it here. Let's dive in
Tweet media one
@pashovkrum
pashov
2 years
Best intro for beginners to Yul I have read so far. Filled some gaps in my knowledge. Only problem was it says "19 minutes read" but it took me ~1hr lol
8
62
264
2
6
15
@AmadiMichaels
Michael Amadi
1 year
Was fun co-working on this. Zk tutorial, explaining and simplifying bilinear pairings, with examples written in python and on chain verification examples in solidity and in-line assembly.
@RareSkills_io
RareSkills
1 year
Without bilinear pairings, implementing zk in smart contracts would either be infeasible or cost a lot of gas. We've created a tutorial that removes as much of the scary math as possible (without taking shortcuts) and shows how to use them in Solidity.
Tweet media one
3
3
20
1
1
15
@AmadiMichaels
Michael Amadi
1 year
TIL you can push to an array like so `x.push() = a`. With the optimiser turned off, X2.x(a) cost 19 gas less than X.s(a). With the optimiser turned on, it all cost the same anyways.
Tweet media one
2
0
16
@AmadiMichaels
Michael Amadi
2 years
One of the side projects I've been sitting on extensively lol. Works nicely, but more can be done. More features too. Need to dedicate some spare time to finalize it ⚡️
3
2
16
@AmadiMichaels
Michael Amadi
3 months
Officially an EOF Maxi
@AmadiMichaels
Michael Amadi
3 months
EOF weekend 🔎
0
0
4
2
0
16
@AmadiMichaels
Michael Amadi
1 year
Alpha packed article! Over 11k words. Contains not just gas optimization tips but tips about inline assembly (beloved julia), the evm, the solidity compiler and more unique tricks!
@RareSkills_io
RareSkills
1 year
The RareSkills Book of Gas Optimization has been published. With over > 90 pointers and 11k+ words, not including source code, you are almost certainly going to see a trick or two you haven't seen before. We assume you know the EVM to a certain degree, this is not a beginner
Tweet media one
20
76
295
1
0
15
@AmadiMichaels
Michael Amadi
2 years
Kudos to @jeiwan7 This used ZuniswapV2Pair's foundry tests, saved me a lot of time The uniswapv2 book was also a great resource/documentation for reference.
0
3
15
@AmadiMichaels
Michael Amadi
8 months
Wrote a minimal implementation showing how different stealth address protocols work So far, I've added 2 - Single key stealth address protocol - Double key stealth address protocol which is consistent with EIP 5564, Scheme ID 0 (SECP256K1 with view tags)
1
0
16
@AmadiMichaels
Michael Amadi
9 months
A day after this I was able to shave off 251 gas from this solution, check out the update in the github link in this tweet
@AmadiMichaels
Michael Amadi
9 months
🫡
Tweet media one
Tweet media two
8
2
32
0
0
15
@AmadiMichaels
Michael Amadi
9 months
All the equations, low level stuffs memecoins and whitepapers are nice but we really need more people and teams building for and with end users in mind. By end users I mean also and majorly users who have never or rarely heard of blockchains.
1
0
15
@AmadiMichaels
Michael Amadi
1 year
Pro tip: turn on notifications for @ScrapingBits podcast on all streaming platforms. There's a couple of hours/days difference between when @DeGatchi releases a new podcast there and when he announces it on here That way you get to hear alpha before others ⚡️
3
1
14
@AmadiMichaels
Michael Amadi
1 year
Okay You update your free memory pointer in JULIA, I update mine in Solidity. We are not the same. Warning: some forbidden code
Tweet media one
2
1
14
@AmadiMichaels
Michael Amadi
2 years
@JustEmil6 @0xCygaar In solidity, uint256 overflows after (2^256)-1 and 1 ether is stored as 1e18. (2^256)-1 / 1e18 is the highest number to input before the overflow happens. Add 1 to that and that's what we should input to get an overflow. Twitter tweet limit, the screenshot I made explains further
Tweet media one
1
0
13
@AmadiMichaels
Michael Amadi
4 months
You're in her dms, I'm in her PXE. We're not the same.
3
0
14
@AmadiMichaels
Michael Amadi
2 years
@0xCygaar Call "setFirstTime" with uint160(yourLibrary) that it's "setFirstTime" function can modify storage slot 1 or preferably can modify arbitrary storage slots for more flexibility, then you call "setFirstTime" again with uint160(yourAddress) to set slot 1 to your address.
1
2
13
@AmadiMichaels
Michael Amadi
3 months
@Jeyffre This (and the Yul course) was the first resource that ignited my love for low-level and gas optimization. Back then, it was difficult to find anything that explained yul/gas optimization well enough. Highly recommend for any solidity dev looking to go low-level.
0
0
14
@AmadiMichaels
Michael Amadi
6 months
@Amxx The proxy <0x3419875B4D3Bca7F3FddA2dB7a476A79fD31B4fE> (selfdestructable) calls another selfdestructable contract <0xDDA114b26B07Ce6a14675F035adA6725f2DBe0b8> that stores the implementation address of each function signature. Currently, all function sigs point to one contract
1
1
13
@AmadiMichaels
Michael Amadi
1 year
Building with Foundry and Hardhat together is so powerful⚡️. More tooling interoperability is best!
3
1
12
@AmadiMichaels
Michael Amadi
3 months
EOF-Solidity feature requests: 1) Native support for Code Section types: Defined as a struct of 4 fields: bytecode, num of inputs, num of outputs and max stack height. This is to be defined at the contract level and must be known at compile time so that it can be validated and
1
0
13
@AmadiMichaels
Michael Amadi
7 months
Solidity Trivia 0: Without looking at it's bytecode, does this contract have a revert path? and if so how can you trigger it?
Tweet media one
3
0
13
@AmadiMichaels
Michael Amadi
2 years
@0xCygaar Unchecked block on line 16 Solidity represents 1 ether as 1e18 in uint and multiplying in an unchecked block that users have access to manipulate is dangerous To be specific, a user that inputs 115792089237316195423570985008687907853269984665640564039458 will be pay 1 ether.
1
0
13
@AmadiMichaels
Michael Amadi
8 months
Some 100% stateDiff/lock/paranoid testing Any thoughts? Had to write some helper functions to simplify working with accountAccess struct. Link to the repo is in the comments
Tweet media one
Tweet media two
Tweet media three
Tweet media four
@AmadiMichaels
Michael Amadi
8 months
@lucasmanuel_eth Was literally thinking through how a test model based on stateDiff would work some days ago Basically get all storage writes and assert that they're what's expected, in the order expected and no extra write happen outside what's expected Was thinking of naming it lock tests lol
1
0
3
1
0
12
@AmadiMichaels
Michael Amadi
11 months
TIL this is possible in solidity Don't know why I'll want to represent bytes this way, but it is possible
Tweet media one
4
0
11
@AmadiMichaels
Michael Amadi
2 years
2
0
11
@AmadiMichaels
Michael Amadi
3 months
Improved it a bit. Here's an example of parsing a factory contract that creates another contract. This example is cool because it shows how nested container sections are encoded. - The first command parses the factory contracts eof bytecode - The second command copies the
@AmadiMichaels
Michael Amadi
3 months
Spent the evening making an EOF bytecode parser with some header invariant validation based on the specs. Also using this to get back into rust. Here's an example output when run with EOF bytecode: 0xef0001010004020001000304000400008000013050fe0bad60a7 Repo link in comments
Tweet media one
2
1
18
1
1
11
@AmadiMichaels
Michael Amadi
2 years
@mande_eth @libevm CALLVALUE returns 0 if no wei is sent. But if the function is payable however, you can use RETURNDATASIZE. It is more optimized because PUSH1 0x00 costs 3 gas while the two formers cost 2 gas. Note that returndatasize will not be 0 if an external call returning data has been made
1
0
11
@AmadiMichaels
Michael Amadi
1 year
Also, tip to have in mind when using custom errors: reverting with a custom error that has 2 + n fixed sized parameters is equivalent in gas costs as reverting with a string of length: 4 + (n × 32) bytes
@optimizoor
vectorized.eth
1 year
I don't like using args in custom errors. Ugly. Inconsistent. Bloat.
11
0
34
0
1
10
@AmadiMichaels
Michael Amadi
1 year
Interestingly, If you surround the xx function in an unchecked block just like xxx below, it will return true if sq is 256 because 2**256 in an unchecked block is == 0 and subtracting 1 from 0 in an unchecked block also is == uint256 max
Tweet media one
0
0
11
@AmadiMichaels
Michael Amadi
2 years
@devtooligan Named imports helps to avoid having multiple-import error from the compiler due to inheriting 2 .sol files that have the same import like ownable.sol, address.sol, strings.sol etc
1
0
10
@AmadiMichaels
Michael Amadi
2 years
@0xCygaar Sorry guys, miscalculated this. Here's the correct calculations Inputting 115792089237316195423570985008687907853269984665640564039458 will require you pay 0.415992086870360064 ether
1
0
10
@AmadiMichaels
Michael Amadi
9 months
@GalloDaSballo If the contract is verified the `[0]` would be parameter names
Tweet media one
2
0
10
@AmadiMichaels
Michael Amadi
1 year
And this isn't even an exaggeration, with enough practice you'll literally be able to look at any solidity line of code and turn that into opcodes by just looking at it! Even the solidity docs and it's patterns begin to make more sense after you've practiced huff long enough
0
1
9
@AmadiMichaels
Michael Amadi
2 years
When you deploy a contract, the runtime code is stored in the 'code' data location of the EVM and persisted across nodes. At this point it has read only access and cannot change... With create2 and self destruct however it can... A metamorphic contract:
1
1
10
@AmadiMichaels
Michael Amadi
8 months
25/25 This list isn't exhaustive though, my github sheds more light to what I've worked on / I'm working on: This year, i'm looking to go even harder and contribute more to the space. To end this, it's coming quite late but Happy new year everyone !
1
0
9