Commit b3bfb3c7 authored by Mark Tyneway's avatar Mark Tyneway

resource-metering: change params

parent 4f96e19c
......@@ -397,17 +397,15 @@ RLPWriter_writeUint_Test:test_writeUint_smallint_succeeds() (gas: 7280)
RLPWriter_writeUint_Test:test_writeUint_zero_succeeds() (gas: 7749)
ResolvedDelegateProxy_Test:test_fallback_addressManagerNotSet_reverts() (gas: 605906)
ResolvedDelegateProxy_Test:test_fallback_delegateCallBar_reverts() (gas: 24783)
ResourceMeteringCustom_Test:test_meter_generateArtifact_succeeds() (gas: 1042150946)
ResourceMetering_Test:test_meter_initialBaseFee_succeeds() (gas: 7245)
ResourceMetering_Test:test_meter_initialBaseFee_succeeds() (gas: 7025)
ResourceMetering_Test:test_meter_initialResourceParams_succeeds() (gas: 8983)
ResourceMetering_Test:test_meter_minBaseFeeLessThanMaxBaseFee_succeeds() (gas: 6420)
ResourceMetering_Test:test_meter_updateNoGasDelta_succeeds() (gas: 2008226)
ResourceMetering_Test:test_meter_updateOneEmptyBlock_succeeds() (gas: 18645)
ResourceMetering_Test:test_meter_minBaseFeeLessThanMaxBaseFee_succeeds() (gas: 6194)
ResourceMetering_Test:test_meter_updateNoGasDelta_succeeds() (gas: 4008242)
ResourceMetering_Test:test_meter_updateOneEmptyBlock_succeeds() (gas: 18441)
ResourceMetering_Test:test_meter_updateParamsNoChange_succeeds() (gas: 14005)
ResourceMetering_Test:test_meter_updateTenEmptyBlocks_succeeds() (gas: 21651)
ResourceMetering_Test:test_meter_updateTwoEmptyBlocks_succeeds() (gas: 21607)
ResourceMetering_Test:test_meter_useMaxWithMaxBaseFee_succeeds() (gas: 29466331)
ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 8017710)
ResourceMetering_Test:test_meter_updateTenEmptyBlocks_succeeds() (gas: 21243)
ResourceMetering_Test:test_meter_updateTwoEmptyBlocks_succeeds() (gas: 21199)
ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 20017420)
ResourceMetering_Test:test_meter_useMoreThanMax_reverts() (gas: 16142)
SafeCall_call_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 2075873614)
SafeCall_call_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 753665282)
......
......@@ -29,13 +29,14 @@ abstract contract ResourceMetering is Initializable {
/**
* @notice Maximum amount of the resource that can be used within this block.
* This value cannot be larger than the L2 block gas limit.
*/
int256 public constant MAX_RESOURCE_LIMIT = 8_000_000;
int256 public constant MAX_RESOURCE_LIMIT = 20_000_000;
/**
* @notice Along with the resource limit, determines the target resource limit.
*/
int256 public constant ELASTICITY_MULTIPLIER = 4;
int256 public constant ELASTICITY_MULTIPLIER = 5;
/**
* @notice Target amount of the resource that should be used within this block.
......@@ -50,22 +51,21 @@ abstract contract ResourceMetering is Initializable {
/**
* @notice Minimum base fee value, cannot go lower than this.
*/
int256 public constant MINIMUM_BASE_FEE = 10_000;
int256 public constant MINIMUM_BASE_FEE = 1 gwei;
/**
* @notice Maximum base fee value, cannot go higher than this.
* This value must be small enough to allow a user to request the
* MAX_RESOURCE_LIMIT when the base fee is at its max value.
* Setting this value too large can result in more gas being
* consumed than the L1 block gas limit.
* It is possible for the MAXIMUM_BASE_FEE to raise to a value
* that is so large it will consume the entire gas limit of
* an L1 block.
*/
int256 public constant MAXIMUM_BASE_FEE = int256(uint256((type(uint32).max / 7) * 6));
int256 public constant MAXIMUM_BASE_FEE = int256(uint256((type(uint128).max)));
/**
* @notice Initial base fee value. This value must be smaller than the
* MAXIMUM_BASE_FEE.
*/
uint128 public constant INITIAL_BASE_FEE = 1_000_000_000;
uint128 public constant INITIAL_BASE_FEE = 1 gwei;
/**
* @notice EIP-1559 style gas parameters.
......@@ -89,10 +89,12 @@ abstract contract ResourceMetering is Initializable {
// Run the underlying function.
_;
// Run the metering function.
_metered(_amount, initialGas);
}
/**
* @notice An internal function that holds all of the logic for metering a resource.
*
* @param _amount Amount of the resource requested.
......
......@@ -32,7 +32,7 @@ contract SetPrevBaseFee_Test is Portal_Initializer {
// In order to achieve this we make no assertions, and handle everything else in the setUp()
// function.
contract GasBenchMark_OptimismPortal is Portal_Initializer {
uint128 INITIAL_BASE_FEE;
uint128 internal INITIAL_BASE_FEE;
// Reusable default values for a test withdrawal
Types.WithdrawalTransaction _defaultTx;
......@@ -124,7 +124,7 @@ contract GasBenchMark_OptimismPortal is Portal_Initializer {
}
contract GasBenchMark_L1CrossDomainMessenger is Messenger_Initializer {
uint128 INITIAL_BASE_FEE;
uint128 internal INITIAL_BASE_FEE;
function setUp() public virtual override {
super.setUp();
......@@ -153,7 +153,7 @@ contract GasBenchMark_L1CrossDomainMessenger is Messenger_Initializer {
}
contract GasBenchMark_L1StandardBridge_Deposit is Bridge_Initializer {
uint128 INITIAL_BASE_FEE;
uint128 internal INITIAL_BASE_FEE;
function setUp() public virtual override {
super.setUp();
......
......@@ -20,7 +20,7 @@ fuzz_runs = 16
no_match_contract = 'EchidnaFuzz'
fs_permissions = [
{ 'access'='read-write', 'path'='./' },
{ 'access'='read-write', 'path'='./.resource-metering.csv' },
]
[profile.ci]
......
......@@ -28,7 +28,7 @@
"test": "yarn build:differential && yarn build:fuzz && forge test",
"coverage": "yarn build:differential && yarn build:fuzz && forge coverage",
"coverage:lcov": "yarn build:differential && yarn build:fuzz && forge coverage --report lcov",
"gas-snapshot": "yarn build:differential && yarn build:fuzz && forge snapshot --no-match-test 'testDiff|testFuzz|invariant|ResourceMeteringCustom'",
"gas-snapshot": "yarn build:differential && yarn build:fuzz && forge snapshot --no-match-test 'testDiff|testFuzz|invariant|generateArtifact'",
"storage-snapshot": "./scripts/storage-snapshot.sh",
"validate-spacers": "hardhat compile && hardhat validate-spacers",
"slither": "./scripts/slither.sh",
......
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