Commit 781ece27 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: lint

parent 9bc5a547
...@@ -229,9 +229,11 @@ contract ResourceMeteringCustom_Test is Test { ...@@ -229,9 +229,11 @@ contract ResourceMeteringCustom_Test is Test {
string internal outfile; string internal outfile;
// keccak256(abi.encodeWithSignature("Error(string)", "ResourceMetering: cannot buy more gas than available gas limit")) // keccak256(abi.encodeWithSignature("Error(string)", "ResourceMetering: cannot buy more gas than available gas limit"))
bytes32 internal cannotBuyMoreGas = 0x84edc668cfd5e050b8999f43ff87a1faaa93e5f935b20bc1dd4d3ff157ccf429; bytes32 internal cannotBuyMoreGas =
0x84edc668cfd5e050b8999f43ff87a1faaa93e5f935b20bc1dd4d3ff157ccf429;
// keccak256(abi.encodeWithSignature("Panic(uint256)", 0x11)) // keccak256(abi.encodeWithSignature("Panic(uint256)", 0x11))
bytes32 internal overflowErr = 0x1ca389f2c8264faa4377de9ce8e14d6263ef29c68044a9272d405761bab2db27; bytes32 internal overflowErr =
0x1ca389f2c8264faa4377de9ce8e14d6263ef29c68044a9272d405761bab2db27;
/** /**
* @notice Sets the initial block number to something sane for the * @notice Sets the initial block number to something sane for the
...@@ -245,7 +247,10 @@ contract ResourceMeteringCustom_Test is Test { ...@@ -245,7 +247,10 @@ contract ResourceMeteringCustom_Test is Test {
outfile = string.concat(vm.projectRoot(), "/.resource-metering.csv"); outfile = string.concat(vm.projectRoot(), "/.resource-metering.csv");
try vm.removeFile(outfile) {} catch {} try vm.removeFile(outfile) {} catch {}
vm.writeLine(outfile, "prevBaseFee,prevBoughtGas,prevBlockNumDiff,l1BaseFee,requestedGas,gasConsumed,ethPrice,usdCost,success"); vm.writeLine(
outfile,
"prevBaseFee,prevBoughtGas,prevBlockNumDiff,l1BaseFee,requestedGas,gasConsumed,ethPrice,usdCost,success"
);
} }
/** /**
...@@ -319,7 +324,9 @@ contract ResourceMeteringCustom_Test is Test { ...@@ -319,7 +324,9 @@ contract ResourceMeteringCustom_Test is Test {
vm.roll(block.number + prevBlockNumDiff); vm.roll(block.number + prevBlockNumDiff);
uint256 gasConsumed = 0; uint256 gasConsumed = 0;
try meter.use{ gas: 30_000_000 }(requestedGas) returns (uint256 _gasConsumed) { try meter.use{ gas: 30_000_000 }(requestedGas) returns (
uint256 _gasConsumed
) {
gasConsumed = _gasConsumed; gasConsumed = _gasConsumed;
} catch (bytes memory err) { } catch (bytes memory err) {
bytes32 hash = keccak256(err); bytes32 hash = keccak256(err);
...@@ -334,19 +341,29 @@ contract ResourceMeteringCustom_Test is Test { ...@@ -334,19 +341,29 @@ contract ResourceMeteringCustom_Test is Test {
// Compute the USD cost of the gas used, don't // Compute the USD cost of the gas used, don't
// worry too much about loss of precison under $1 // worry too much about loss of precison under $1
uint256 usdCost = gasConsumed * l1BaseFee * ethPrice / 1 ether; uint256 usdCost = (gasConsumed * l1BaseFee * ethPrice) / 1 ether;
vm.writeLine( vm.writeLine(
outfile, outfile,
string.concat( string.concat(
vm.toString(prevBaseFee), ",", vm.toString(prevBaseFee),
vm.toString(prevBoughtGas), ",", ",",
vm.toString(prevBlockNumDiff), ",", vm.toString(prevBoughtGas),
vm.toString(l1BaseFee), ",", ",",
vm.toString(requestedGas), ",", vm.toString(prevBlockNumDiff),
vm.toString(gasConsumed), ",", ",",
"$", vm.toString(ethPrice), ",", vm.toString(l1BaseFee),
"$", vm.toString(usdCost), ",", ",",
vm.toString(requestedGas),
",",
vm.toString(gasConsumed),
",",
"$",
vm.toString(ethPrice),
",",
"$",
vm.toString(usdCost),
",",
result result
) )
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment