mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-24 19:27:58 +00:00
the call gas clipping integration test
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8;
|
||||
|
||||
// Use a non-zero call gas that works with call gas clipping but not with a truncate.
|
||||
|
||||
/* runner.json
|
||||
{
|
||||
"differential": true,
|
||||
"actions": [
|
||||
{
|
||||
"Upload": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "Other"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Instantiate": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "CallGas"
|
||||
}
|
||||
},
|
||||
"data": "1000000000000000000000000000000000000000000000000000000000000001"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
contract Other {
|
||||
address public last;
|
||||
uint public foo;
|
||||
|
||||
fallback() external {
|
||||
last = msg.sender;
|
||||
foo += 1;
|
||||
}
|
||||
}
|
||||
|
||||
contract CallGas {
|
||||
constructor(uint _gas) payable {
|
||||
Other other = new Other();
|
||||
address(other).call{ gas: _gas }(hex"");
|
||||
assert(other.last() == address(this));
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ test_spec!(add_mod_mul_mod, "AddModMulModTester", "AddModMulMod.sol");
|
||||
test_spec!(memory_bounds, "MemoryBounds", "MemoryBounds.sol");
|
||||
test_spec!(selfdestruct, "Selfdestruct", "Selfdestruct.sol");
|
||||
test_spec!(clz, "CountLeadingZeros", "CountLeadingZeros.sol");
|
||||
test_spec!(call_gas, "CallGas", "CallGas.sol");
|
||||
|
||||
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
||||
vec![Instantiate {
|
||||
|
||||
Reference in New Issue
Block a user