// After hitting a reset error, it reset derivation, and drops the old L1 chain
sequencer.ActL2PipelineFull(t)
sequencer.ActL2PipelineFull(t)
require.Zero(t,sequencer.SyncStatus().UnsafeL2.L1Origin.Number,"back to genesis block with good L1 origin, drop old unsafe L2 chain with bad L1 origins")
// Can build new L2 blocks with good L1 origin
// Can build new L2 blocks with good L1 origin
sequencer.ActBuildToL1HeadUnsafe(t)
sequencer.ActBuildToL1HeadUnsafe(t)
require.Equal(t,newStatus.HeadL1.Hash,sequencer.SyncStatus().UnsafeL2.L1Origin.Hash,"build L2 chain with new correct L1 origins")
require.Equal(t,newStatus.HeadL1.Hash,sequencer.SyncStatus().UnsafeL2.L1Origin.Hash,"build L2 chain with new correct L1 origins")
require.Equal(t,refB1,eq.SafeL2Head(),"L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for")
require.Equal(t,refB,eq.Origin(),"Expecting to be set back derivation L1 progress to B")
require.Equal(t,refA1,eq.Finalized(),"A1 is recognized as finalized before we run any steps")
// First step after reset will do a fork choice update
require.Equal(t,refB1,eq.SafeL2Head(),"L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for")
require.Equal(t,refB,eq.Origin(),"Expecting to be set back derivation L1 progress to B")
require.Equal(t,refA1,eq.Finalized(),"A1 is recognized as finalized before we run any steps")
// First step after reset will do a fork choice update
The typescript sdk provides a clean [wagmi](https://wagmi.sh/) based interface for reading and writing to the attestation station
The typescript sdk provides a clean [wagmi](https://wagmi.sh/) based interface for reading and writing to the attestation station
### See [sdk docs]() for usage instructions
### See [sdk docs](https://github.com/ethereum-optimism/optimism/blob/develop/packages/atst/docs/sdk.md) for usage instructions
## atst cli
## atst cli
The cli provides a convenient cli for interacting with the attestation station contract
The cli provides a convenient cli for interacting with the attestation station contract
TODO put a gif here of using it

## React instructions
## React API
For react hooks we recomend using the [wagmi cli](https://wagmi.sh/cli/getting-started) with the [etherscan plugin](https://wagmi.sh/cli/plugins/etherscan) and [react plugin](https://wagmi.sh/cli/plugins/react) to automatically generate react hooks around the attestation station. See [example/react](http://todo.todo.todo) for an example.
For react hooks we recomend using the [wagmi cli](https://wagmi.sh/cli/getting-started) with the [etherscan plugin](https://wagmi.sh/cli/plugins/etherscan) and [react plugin](https://wagmi.sh/cli/plugins/react) to automatically generate react hooks around the attestation station.
Use `parseAttestationBytes` and `stringifyAttestationBytes` to parse and stringify attestations before passing them into wagmi hooks.
Use `createKey` and `createValue` to convert your raw keys and values into bytes that can be used in the attestation station contract calls
Use `parseString`, `parseBool`, `parseAddress` and `parseNumber` to convert values returned by attestation station to their correct data type.
For convenience we also export the hooks here.
`useAttestationStationAttestation` - Reads attestations with useContractRead
`useAttestationStationVersion` - Reads attestation version
`useAttestationStationAttest` - Wraps useContractWrite with attestation station abi calling attest
`usePrepareAttestationStationAttest` - Wraps usePrepare with attestation station abi calling attest
`useAttestationStationAttestationCreatedEvent` - Wraps useContractEvents for Created events
Also some more hooks exported by the cli but these are likely the only ones you need.
## Contributing
## Contributing
Please see our [contributing.md](/docs/contributing.md). No contribution is too small.
Please see our [contributing.md](docs/contributing.md). No contribution is too small.
Having your contribution denied feels bad. Please consider opening an issue before adding any new features or apis
Having your contribution denied feels bad. Please consider opening an issue before adding any new features or apis
## Check [Awesome ATST](https://todo.todo.todo) for awesome tools and examples around the attestation station
* Boolean: Whether to allow some of the calls to fail
* Defaults to false
*/
allowFailures,
})
})
```
```
### parseAttestationBytes
### Parsing bytes
Parses raw bytes from the attestation station based on the type.
These utilities for parsing bytes are provided:
Note: `readAttestation` and `readAttestations` already parse the bytes so this is only necessary if reading attestations directly from chain instead of through this sdkA
`parseAddress`
`parseNumber`
`parseBool`
`parseString`
Note: `readAttestation` and `readAttestations` already parse the bytes so this is only necessary if reading attestations directly from chain instead of through this utility
Set key, about, creator, or value to `null` to not include that filter
## Tutorial
For a tutorial on using the attestation station in general, see out tutorial as well as other Optimism related tutorials in our [optimism-tutorial](https://github.com/ethereum-optimism/optimism-tutorial/tree/main/ecosystem/attestation-station#key-values) repo
- cb19e2f9c: Moves `FINALIZATION_PERIOD_SECONDS` from the `OptimismPortal` to the `L2OutputOracle` & ensures the `CHALLENGER` key cannot delete finalized outputs.
- cb19e2f9c: Moves `FINALIZATION_PERIOD_SECONDS` from the `OptimismPortal` to the `L2OutputOracle` & ensures the `CHALLENGER` key cannot delete finalized outputs.