Skip to content

Commit

Permalink
propagate OutOfGas to outer call if caused by proof size check or MBI…
Browse files Browse the repository at this point in the history
…P5 (#2950)

* update frontier pin

* add tests

* add snapshot & +1 block delay

* test: add gas estimation to babe-lottery3

* appease linter

---------

Co-authored-by: Pablo Labarta <pablitolabarta@gmail.com>
  • Loading branch information
librelois and pLabarta authored Sep 16, 2024
1 parent c3f63cf commit 55688c4
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 32 deletions.
53 changes: 27 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions test/contracts/src/BloatedContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.24;

contract BloatedContract {
string public constant HUGE =
"0009029190000120068200810084000002900009444026015071899001591001260845208240017000684720039550000028098850000070600000600003552005936017007053807100000041771580000244664000088007500007700000400000096706200270000267100001000969750000067700056830092002978180072930092092021000644480200750000008400830389708783012663109400001023405538004655400240000045404920000006600110094000113481000525400601812000000056007306626044000042720008605282710425473000027800233400300002500009102903167660730097009598200220053180002052169775049488200700750005660079099422811952047000025490610000097000342400467600000770830040000980026218502900078170000000620450000054000081000003552008290356000000000800003250415214008770723805244741000088000000000592636380007300084062950000018000000008777510000420180307006800190005410046470000416500004200291992003400000111189020270874000700000009900079000040000006000000010006712810006797000500210000067655604000004308300005800111313000032039850411100369100031870182209200019820120611924838009009678000920000000001855000308001341017097640019016027860099820094005600000330202920000615900060680004007000003612660000024005355620550005065000540002100041072059005000003907461062035012000096000028720026611364106886000000999800000001476288954000075200296302389837609535878931960004309600800000290000039000949095033429466000669329005000019420460820075940423086032007000361302000000060627242000320032000000002104000000950780090025075000000075250000990410503708408505037000000700000024090000083063002900144304000004200037007762004203857170057020062273802992604900120068910000750008806400093095005947000990000420088566045090000000015360410000081117690150530002403100036011830000000042051081800105000001066087053027074000009425610442298002698000156609707815450000439406500026330071080007653001100550630637749000000178000005304485000890000052110954284820000000035130";
string store = "";

function doSomething() public {
store = HUGE;
}
}
33 changes: 33 additions & 0 deletions test/contracts/src/SubCallOOG.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.3;

interface IBloatedContract {
function doSomething() external;
}

interface ILooper {
function incrementalLoop(uint256 n) external;
}

contract SubCallOOG {
event SubCallSucceed();
event SubCallFail();

function subCallPov(address[] memory addresses) public {
for (uint256 i = 0; i < addresses.length; i++) {
try IBloatedContract(addresses[i]).doSomething() {
emit SubCallSucceed();
} catch (bytes memory) {
emit SubCallFail();
}
}
}

function subCallLooper(address target, uint256 n) public {
try ILooper(target).incrementalLoop(n) {
emit SubCallSucceed();
} catch (bytes memory) {
emit SubCallFail();
}
}
}
Loading

0 comments on commit 55688c4

Please sign in to comment.