implement the gas opcode (#136)

This commit is contained in:
Cyrill Leutwiler
2024-12-18 17:19:32 +01:00
committed by GitHub
parent 55ec0988e8
commit 14a598e840
8 changed files with 417 additions and 373 deletions
+8 -8
View File
@@ -1,10 +1,10 @@
{
"Baseline": 1126,
"Computation": 2405,
"DivisionArithmetics": 14486,
"ERC20": 22755,
"Events": 1620,
"FibonacciIterative": 1670,
"Flipper": 2005,
"SHA1": 16832
"Baseline": 1115,
"Computation": 2394,
"DivisionArithmetics": 14470,
"ERC20": 22747,
"Events": 1609,
"FibonacciIterative": 1659,
"Flipper": 1994,
"SHA1": 16817
}
+32
View File
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
/* runner.json
{
"differential": false,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "GasLeft"
}
}
}
},
{
"VerifyCall": {
"success": true
}
}
]
}
*/
contract GasLeft {
constructor() payable {
assert(gasleft() > gasleft());
assert(gasleft() > 0 && gasleft() < 0xffffffffffffffff);
}
}
+1
View File
@@ -47,6 +47,7 @@ test_spec!(transaction, "Transaction", "Transaction.sol");
test_spec!(block_hash, "BlockHash", "BlockHash.sol");
test_spec!(delegate, "Delegate", "Delegate.sol");
test_spec!(gas_price, "GasPrice", "GasPrice.sol");
test_spec!(gas_left, "GasLeft", "GasLeft.sol");
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
vec![Instantiate {