Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cgewecke committed May 23, 2024
1 parent c9eca41 commit c0c335a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ const config: HardhatUserConfig = {

## Options

+ Option setups for common and advanced use cases can be seen in the [Config Examples][2] docs].
+ Option setups for common and advanced use cases can be seen in the [Config Examples][2] docs.
+ Get a [free tier Coinmarketcap API key][3] if you want price data

| Options | Type | Default | Description |
| :------------------------------ | :--------: | :--------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| checkGasDeltas | _bool_ | `false` | Compare gas values to previous results |
| currency | _string_ | `USD` | National currency to represent gas costs in. Exchange rates are loaded at runtime from the `coinmarketcap` api. Available currency codes can be found [here][5] |
| coinmarketcap | _string_ | - | [API key][3] to use when fetching live token price data |
| enabled | _bool_ | `true` | Produce gas reports with `hardhat test` |
Expand All @@ -85,13 +84,14 @@ const config: HardhatUserConfig = {
| includeIntrinsicGas | _bool_ | `true` | Include standard 21_000 + calldata bytes overhead in method gas usage data. (Setting to `false` can be useful for modelling contract infra that will never be called by an EOA) |
| L1 | _string_ | `ethereum` | Auto-configure reporter to emulate an L1 network. (See [supported networks][6]) |
| L2 | _string_ | - | Auto-configure reporter to emulate an L2 network (See [supported networks][6]) |
| L1Etherscan | _string_ | - | [API key][4] to use when fetching live gasPrice, baseFee, and blobBaseFee data from an L1 network. (Optional, see [Supported Networks][6]) |
| L2Etherscan | _string_ | - | [API key][4] to use when fetching live gasPrice data from an L2 network (Optional, see [Supported Networks][6]) |
| L1Etherscan | _string_ | - | [API key][4] to use when fetching live gasPrice and baseFee data from an L1 network. (Optional, see [Supported Networks][6]) |
| L2Etherscan | _string_ | - | [API key][4] to use when fetching live gasPrice and blobBaseFee data from an L2 network (Optional, see [Supported Networks][6]) |
| offline | _bool_ | `false` | Turn off remote calls to fetch data |
| optimismHardfork | _string_ | `ecotone` | Optimism hardfork to emulate L1 & L2 gas costs for. |
| proxyResolver | _Class_ | - | User-defined class which helps reporter identify contract targets of proxied calls. (See [Advanced Usage][7]) |
| remoteContracts | _Array_ | - | List of forked-network deployed contracts to track execution costs for.(See [Advanced Usage][8]) |
| reportPureAndViewMethods | _bool_ | `false` | Track gas usage for methods invoked via `eth_call`. (Incurs a performance penalty that can be significant for large test suites) |
| trackGasDeltas | _bool_ | `false` | Track and report changes in gas usage versus previous test run. (Useful for gas golfing) |
| :high_brightness: **DISPLAY** | | | |
| currencyDisplayPrecision | _number_ | `2` | Decimal precision to show nation state currency costs in |
| darkMode | _bool_ | `false` | Use colors better for dark backgrounds when printing to stdout |
Expand Down
11 changes: 11 additions & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ const config: HardhatUserConfig = {
}
```

### Gas Golfing
*...track changes in gas usage from test run to test run (conditionally, using an environment variable)*

```ts
const config: HardhatUserConfig = {
gasReporter: {
trackGasDeltas: process.env.GAS_GOLF === "true"
}
}
```

### Documentation

*...writing report in markdown format to file while displaying regular report on stdout*
Expand Down
11 changes: 9 additions & 2 deletions scripts/gen-options-md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ title,
"L1Etherscan",
"_string_",
"-",
"[API key][4] to use when fetching live gasPrice, baseFee, and blobBaseFee data " +
"[API key][4] to use when fetching live gasPrice and baseFee data " +
"from an L1 network. (Optional, see [Supported Networks][6])"
],
// L1Etherscan
[
"L2Etherscan",
"_string_",
"-",
"[API key][4] to use when fetching live gasPrice data from an L2 network " +
"[API key][4] to use when fetching live gasPrice and blobBaseFee data from an L2 network " +
"(Optional, see [Supported Networks][6])"
],
// offline
Expand Down Expand Up @@ -140,6 +140,13 @@ title,
"Track gas usage for methods invoked via `eth_call`. (Incurs a performance penalty that can be " +
"significant for large test suites)"
],
// trackGasDeltas
[
"trackGasDeltas",
"_bool_",
"`false`",
"Track and report changes in gas usage versus previous test run. (Useful for gas golfing)"
],
displaySubtitle,
// currencyDisplayPrecision
[
Expand Down

0 comments on commit c0c335a

Please sign in to comment.