66 "encoding/binary"
77 "fmt"
88 "math/big"
9- "strings"
109
1110 txfuzz "github.com/MariusVanDerWijden/tx-fuzz"
1211 "github.com/MariusVanDerWijden/tx-fuzz/helper"
@@ -28,6 +27,8 @@ func main() {
2827 test2935 ()
2928 test7002 ()
3029 test7251 ()
30+ test7702BlobTxs ()
31+ test7702NormalTxs () // flakey
3132}
3233
3334func testTouchContracts () {
@@ -192,30 +193,6 @@ func testBLS(prec int, input []byte) {
192193 helper .Exec (addr , input , false )
193194}
194195
195- /*
196- pragma solidity >=0.7.0 <0.9.0;
197-
198- contract BlobCaller {
199- bool _ok;
200- bytes out;
201-
202- fallback (bytes calldata _input) external returns (bytes memory _output) {
203- address precompile = address(0x0A);
204- (bool ok, bytes memory output) = precompile.call{gas: 500000}(_input);
205- _output = output;
206- // Store return values to trigger sstore
207- _ok = ok;
208- out = output;
209- }
210- }
211- */
212- func deployPrecompileCaller (precompile string ) (common.Address , error ) {
213- bytecode1 := "6080604052348015600e575f80fd5b506104568061001c5f395ff3fe608060405234801561000f575f80fd5b505f3660605f60"
214- bytecode2 := "90505f808273ffffffffffffffffffffffffffffffffffffffff1661c35087876040516100459291906100fe565b5f604051808303815f8787f1925050503d805f811461007f576040519150601f19603f3d011682016040523d82523d5f602084013e610084565b606091505b5091509150809350815f806101000a81548160ff02191690831515021790555080600190816100b39190610350565b50505050915050805190602001f35b5f81905092915050565b828183375f83830152505050565b5f6100e583856100c2565b93506100f28385846100cc565b82840190509392505050565b5f61010a8284866100da565b91508190509392505050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061019157607f821691505b6020821081036101a4576101a361014d565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026102067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826101cb565b61021086836101cb565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61025461024f61024a84610228565b610231565b610228565b9050919050565b5f819050919050565b61026d8361023a565b6102816102798261025b565b8484546101d7565b825550505050565b5f90565b610295610289565b6102a0818484610264565b505050565b5b818110156102c3576102b85f8261028d565b6001810190506102a6565b5050565b601f821115610308576102d9816101aa565b6102e2846101bc565b810160208510156102f1578190505b6103056102fd856101bc565b8301826102a5565b50505b505050565b5f82821c905092915050565b5f6103285f198460080261030d565b1980831691505092915050565b5f6103408383610319565b9150826002028217905092915050565b61035982610116565b67ffffffffffffffff81111561037257610371610120565b5b61037c825461017a565b6103878282856102c7565b5f60209050601f8311600181146103b8575f84156103a6578287015190505b6103b08582610335565b865550610417565b601f1984166103c6866101aa565b5f5b828110156103ed578489015182556001820191506020850194506020810190506103c8565b8683101561040a5784890151610406601f891682610319565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220bc28435cfa3208db8cae33e216a1ff54a6e5dce073695cad36274cc363055c5564736f6c63430008190033"
215- // The byte in between bytecode1 and bytecode2 denotes the precompile which we want to call
216- return helper .Deploy (fmt .Sprintf ("%v%v%v" , bytecode1 , precompile , bytecode2 ))
217- }
218-
219196// makeTxWithValue creates a transaction invoking addr, sending eth along with calldata.
220197func makeTxWithValue (addr common.Address , value * big.Int , data []byte ) * types.Transaction {
221198 ctx := context .Background ()
@@ -319,16 +296,6 @@ func do7702Calls(addr common.Address) {
319296 helper .ExecAuth (addr , []byte {}, list )
320297}
321298
322- func deploy7702Proxy () (common.Address , error ) {
323- // See: https://raw.githubusercontent.com/ethereum/hive/refs/heads/master/cmd/hivechain/contracts/deployer.eas
324- deployer := "600d380380600d6000396000f3"
325- // See: https://gist.github.com/lightclient/7742e84fde4962f32928c6177eda7523
326- bytecode := "5f54808060ff1c15600e575f5ffd5b15606f57337300000000000000000000000000000000000010921415605557507f80000000000000000000000000000000000000000000000000000000000000005f555f5ff35b5f365f5f37365f345f945af45b3d5f3e5f3d91606d57fd5bf35b465f5260805f60203760405f205f5260205f60805f737a40026a3b9a41754a95eec8c92c6b99886f440c5afa505f51301460a7575f5ffd5b5f35805f555f608036038060805f375f345f945af1606256"
327- // replace placeholder address
328- bytecode = strings .Replace (bytecode , "0x7a40026A3b9A41754a95EeC8c92C6B99886f440C" , txfuzz .ADDR , 1 )
329- return helper .Deploy (fmt .Sprintf ("%v%v" , deployer , bytecode ))
330- }
331-
332299func test2935 () {
333300 fmt .Println ("EIP-2935" )
334301 contr , err := deploy2935Caller ()
@@ -372,30 +339,12 @@ func test2935() {
372339 currentBlock - 8192 ,
373340 currentBlock - 256 ,
374341 currentBlock - 255 ,
342+ currentBlock - 20000 ,
375343 }
376344 for _ , number := range blocknumbers {
377- helper .Exec (addr , binary .BigEndian .AppendUint64 ([]byte {}, number ), false )
345+ input := make ([]byte , 32 )
346+ binary .BigEndian .PutUint64 (input [24 :], number )
347+ helper .Exec (addr , input , false )
378348 }
379349 }
380350}
381-
382- /*
383- pragma solidity >=0.7.0 <0.9.0;
384-
385- contract EIP2935Caller {
386- bool _ok;
387- bytes out;
388- fallback (bytes calldata _input) external returns (bytes memory _output) {
389- address contrAddr = address(0x0AAE40965E6800cD9b1f4b05ff21581047E3F91e);
390- (bool ok, bytes memory output) = contrAddr.call{gas: 500000}(_input);
391- _output = output;
392- // Store return values to trigger sstore
393- _ok = ok;
394- out = output;
395- }
396- }
397- */
398- func deploy2935Caller () (common.Address , error ) {
399- bytecode1 := "6080604052348015600e575f80fd5b506104698061001c5f395ff3fe608060405234801561000f575f80fd5b505f3660605f730aae40965e6800cd9b1f4b05ff21581047e3f91e90505f808273ffffffffffffffffffffffffffffffffffffffff166207a1208787604051610059929190610112565b5f604051808303815f8787f1925050503d805f8114610093576040519150601f19603f3d011682016040523d82523d5f602084013e610098565b606091505b5091509150809350815f806101000a81548160ff02191690831515021790555080600190816100c79190610364565b50505050915050805190602001f35b5f81905092915050565b828183375f83830152505050565b5f6100f983856100d6565b93506101068385846100e0565b82840190509392505050565b5f61011e8284866100ee565b91508190509392505050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806101a557607f821691505b6020821081036101b8576101b7610161565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261021a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826101df565b61022486836101df565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61026861026361025e8461023c565b610245565b61023c565b9050919050565b5f819050919050565b6102818361024e565b61029561028d8261026f565b8484546101eb565b825550505050565b5f90565b6102a961029d565b6102b4818484610278565b505050565b5b818110156102d7576102cc5f826102a1565b6001810190506102ba565b5050565b601f82111561031c576102ed816101be565b6102f6846101d0565b81016020851015610305578190505b610319610311856101d0565b8301826102b9565b50505b505050565b5f82821c905092915050565b5f61033c5f1984600802610321565b1980831691505092915050565b5f610354838361032d565b9150826002028217905092915050565b61036d8261012a565b67ffffffffffffffff81111561038657610385610134565b5b610390825461018e565b61039b8282856102db565b5f60209050601f8311600181146103cc575f84156103ba578287015190505b6103c48582610349565b86555061042b565b601f1984166103da866101be565b5f5b82811015610401578489015182556001820191506020850194506020810190506103dc565b8683101561041e578489015161041a601f89168261032d565b8355505b6001600288020188555050505b50505050505056fea264697066735822122033feaed59f5038b726e0ad09706fc2b959f0781cd00f5b4961c7ce6a676215f764736f6c634300081a0033"
400- return helper .Deploy (bytecode1 )
401- }
0 commit comments