Commit b937dc66 authored by Kevin Chen's avatar Kevin Chen

fault-detector: Update documentation to remove mention of legacy networks.

parent cd23d53a
......@@ -17,10 +17,7 @@ yarn build
## Running the service
Copy `.env.example` into a new file named `.env`, then set the environment variables listed there. Additional env setting are listed on `--help`. If running the fault detector against
a custom op chain, the necessary contract addresses must also be set associated with the op-chain.
- Bedrock: `OptimismPortal`
- Legacy: `StateCommitmentChain`
a custom op chain, the `OptimismPortal` contract addresses must also be set associated with the op-chain.
Once your environment variables or flags have been set, run the service via:
......@@ -40,13 +37,11 @@ yarn start
The `fault-detector` detects differences between the transaction results generated by your local Optimism node and the transaction results actually published to Ethereum.
Currently, transaction results take the form of [the root of the Optimism state trie](https://medium.com/@eiki1212/ethereum-state-trie-architecture-explained-a30237009d4e).
- Post bedrock upgrade, the state root of the block is published to the [`L2OutputOracle`](https://github.com/ethereum-optimism/optimism/blob/39b7262cc3ffd78cd314341b8512b2683c1d9af7/packages/contracts-bedrock/contracts/L1/L2OutputOracle.sol) contract on Ethereum.
The state root of the block is published to the [`L2OutputOracle`](https://github.com/ethereum-optimism/optimism/blob/39b7262cc3ffd78cd314341b8512b2683c1d9af7/packages/contracts-bedrock/contracts/L1/L2OutputOracle.sol) contract on Ethereum.
- ***Note***: The service accepts the `OptimismPortal` as a flag instead of the `L2OutputOracle` for backwards compatibility with early versions of these contracts. The `L2OutputOracle`
is inferred from the portal contract.
- For pre-bedrock chains, the state root of the block is published to the [`StateCommitmentChain`](https://github.com/ethereum-optimism/optimism/blob/39b7262cc3ffd78cd314341b8512b2683c1d9af7/packages/contracts/contracts/L1/rollup/StateCommitmentChain.sol) contract on Ethereum.
We can therefore detect differences by, for each block, checking the state root of the given block as reported by an Optimism node and the state root as published to Ethereum.
In order for the fault detector to differentiate between bedrock and legacy chains, please make sure to specify `--bedrock`.
We export a series of Prometheus metrics that you can use to trigger alerting when issues are detected.
Check the list of available metrics via `yarn start --help`:
......@@ -62,9 +57,7 @@ Options:
--l2rpcprovider Provider for interacting with L2 (env: FAULT_DETECTOR__L2_RPC_PROVIDER)
--startbatchindex Batch index to start checking from. Setting it to -1 will cause the fault detector to find the first state batch index that has not yet passed the fault proof window (env: FAULT_DETECTOR__START_BATCH_INDEX, default value: -1)
--loopintervalms Loop interval in milliseconds (env: FAULT_DETECTOR__LOOP_INTERVAL_MS)
--bedrock Whether or not the service is running against a Bedrock chain (env: FAULT_DETECTOR__BEDROCK, default value: false)
--optimismportaladdress [Custom Bedrock Chains] Deployed OptimismPortal contract address. Used to retrieve necessary info for ouput verification (env: FAULT_DETECTOR__OPTIMISM_PORTAL_ADDRESS, default 0x0)
--statecommitmentchainaddress [Custom Legacy Chains] Deployed StateCommitmentChain contract address. Used to fetch necessary info for output verification. (env: FAULT_DETECTOR__STATE_COMMITMENT_CHAIN_ADDRESS, default 0x0)
--optimismportaladdress [Custom OP Chains] Deployed OptimismPortal contract address. Used to retrieve necessary info for ouput verification (env: FAULT_DETECTOR__OPTIMISM_PORTAL_ADDRESS, default 0x0)
--port Port for the app server (env: FAULT_DETECTOR__PORT)
--hostname Hostname for the app server (env: FAULT_DETECTOR__HOSTNAME)
......
......@@ -33,7 +33,6 @@ type Options = {
l2RpcProvider: Provider
startBatchIndex: number
optimismPortalAddress?: string
// Deprecated. Bedrock is the only version we support.
bedrock: boolean
stateCommitmentChainAddress?: string
}
......@@ -74,27 +73,27 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
startBatchIndex: {
validator: validators.num,
default: -1,
desc: 'Batch index to start checking from. For bedrock chains, this is the L2 height to start from',
desc: 'The L2 height to start from',
public: true,
},
optimismPortalAddress: {
validator: validators.str,
default: ethers.constants.AddressZero,
desc: 'Deployed OptimismPortal contract address. Used to retrieve necessary info for ouput verification ',
desc: '[Custom OP Chains] Deployed OptimismPortal contract address. Used to retrieve necessary info for ouput verification ',
public: true,
},
// Deprecated flags.
// Deprecated options.
bedrock: {
validator: validators.bool,
default: true,
desc: '[Deprecated, must be set to true] Whether or not the service is running against a Bedrock chain',
public: true,
public: false,
},
stateCommitmentChainAddress: {
validator: validators.str,
default: ethers.constants.AddressZero,
desc: '[Deprecated, must be set to 0x0] Deployed StateCommitmentChain contract address. Used to fetch necessary info for output verification.',
public: true,
public: false,
},
},
metricsSpec: {
......@@ -155,7 +154,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
if (!knownChainId && portalAddress === ethers.constants.AddressZero) {
this.logger.error('OptimismPortal contract unspecified')
throw new Error(
'--optimismportalcontractaddress needs to set for custom bedrock op chains'
'--optimismportalcontractaddress needs to set for custom op chains'
)
}
......@@ -411,7 +410,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
new Date(
(ethers.BigNumber.from(outputBlock.timestamp).toNumber() +
this.state.faultProofWindow) *
1000
1000
),
'mmmm dS, yyyy, h:MM:ss TT'
),
......
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