Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
CAPtheorem committed Jun 20, 2021
1 parent 233e8ae commit 27ba9a1
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 407 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sync-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Bring the stack up
working-directory: ./ops
run: docker-compose up -d && ./scripts/wait-for-verifier.sh
run: docker-compose up -d && ./scripts/wait-for-sequencer.sh

- name: Run the sync tests
working-directory: ./integration-tests
Expand Down
47 changes: 34 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<div align="center">
<a href="https://community.optimism.io"><img alt="Optimism" src="https://user-images.githubusercontent.com/14298799/122151157-0b197500-ce2d-11eb-89d8-6240e3ebe130.png" width=280></a>
<br />
<h1> The Optimism Monorepo</h1>
</div>
<p align="center">
<img src="https://user-images.githubusercontent.com/14298799/122151157-0b197500-ce2d-11eb-89d8-6240e3ebe130.png" width=280>
<p>

# <h1 align="center"> The Optimism Monorepo </h1>

[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/typescript%20/%20contracts/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/ts-packages.yml?query=branch%3Amaster)
[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/integration/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/integration.yml?query=branch%3Amaster)
[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/geth%20unit%20tests/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/geth.yml?query=branch%3Amaster)
<a href="https://github.com/ethereum-optimism/optimism/actions/workflows/ts-packages.yml?query=branch%3Amaster"><img src="https://github.com/ethereum-optimism/optimism/workflows/typescript%20/%20contracts/badge.svg" /></a>
<a href="https://github.com/ethereum-optimism/optimism/actions/workflows/integration.yml?query=branch%3Amaster"><img src="https://github.com/ethereum-optimism/optimism/workflows/integration/badge.svg" /></a>
<a href="https://github.com/ethereum-optimism/optimism/actions/workflows/geth.yml?query=branch%3Amaster"><img src="https://github.com/ethereum-optimism/optimism/workflows/geth%20unit%20tests/badge.svg" /></a>
</p>

## TL;DR

Expand All @@ -16,6 +17,10 @@ This is the primary place where [Optimism](https://optimism.io) works on stuff r

Extensive documentation is available [here](http://community.optimism.io/docs/).

## Community

* [Come hang on discord](https://discord.optimism.io)

## Directory Structure

* [`packages`](./packages): Contains all the typescript packages and contracts
Expand All @@ -34,9 +39,19 @@ as well as a docker-compose file for bringing up local testnets easily

## Development Quick Start

### Dependencies

You'll need the following:

* [Git](https://git-scm.com/downloads)
* [NodeJS](https://nodejs.org/en/download/)
* [Yarn](https://classic.yarnpkg.com/en/docs/install)
* [Docker](https://docs.docker.com/get-docker/)
* [Docker Compose](https://docs.docker.com/compose/install/)

### Setup

Clone the repository, open it, and install dependencies:
Clone the repository, open it, and install nodejs packages with `yarn`:

```bash
git clone [email protected]:ethereum-optimism/optimism.git
Expand All @@ -61,7 +76,7 @@ Use the above commands to recompile the packages.

If you want to run an Optimistic Ethereum node OR **if you want to run the integration tests**, you'll need to build the rest of the system.

```
```bash
cd ops
export COMPOSE_DOCKER_CLI_BUILD=1 # these environment variables significantly speed up build time
export DOCKER_BUILDKIT=1
Expand Down Expand Up @@ -102,7 +117,7 @@ docker-compose start batch_submitter
Source code changes can have an impact on more than one container.
**If you're unsure about which containers to rebuild, just rebuild them all**:

```
```bash
cd ops
docker-compose down
docker-compose build
Expand All @@ -111,7 +126,7 @@ docker-compose up

Finally, **if you're running into weird problems and nothing seems to be working**, run:

```
```bash
cd optimism
yarn clean
yarn build
Expand All @@ -125,7 +140,7 @@ docker-compose up
By default, the `docker-compose up` command will show logs from all services, and that
can be hard to filter through. In order to view the logs from a specific service, you can run:

```
```bash
docker-compose logs --follow <service name>
```

Expand Down Expand Up @@ -171,3 +186,9 @@ cd packages/contracts
pip3 install slither-analyzer
yarn test:slither
```

## License

Code forked from [`go-ethereum`](https://github.com/ethereum/go-ethereum) under the name [`l2geth`](https://github.com/ethereum-optimism/optimism/tree/master/l2geth) is licensed under the [GNU GPLv3](https://gist.github.com/kn9ts/cbe95340d29fc1aaeaa5dd5c059d2e60) in accordance with the [original license](https://github.com/ethereum/go-ethereum/blob/master/COPYING).

All other files within this repository are licensed under the [MIT License](https://github.com/ethereum-optimism/optimism/blob/master/LICENSE) unless stated otherwise.
10 changes: 0 additions & 10 deletions packages/message-relayer/src/exec/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ const main = async () => {
'from-l2-transaction-index',
parseInt(env.FROM_L2_TRANSACTION_INDEX, 10) || 0
)
const BLACKLIST_ENDPOINT = config.str(
'blacklist-endpoint',
env.BLACKLIST_ENDPOINT
) || ''
const BLACKLIST_POLLING_INTERVAL = config.uint(
'blacklist-polling-interval',
parseInt(env.BLACKLIST_POLLING_INTERVAL, 10) || 60000
)

if (!ADDRESS_MANAGER_ADDRESS) {
throw new Error('Must pass ADDRESS_MANAGER_ADDRESS')
Expand Down Expand Up @@ -114,8 +106,6 @@ const main = async () => {
l1StartOffset: L1_START_OFFSET,
getLogsInterval: GET_LOGS_INTERVAL,
logger,
blacklistEndpoint: BLACKLIST_ENDPOINT,
blacklistPollingInterval: BLACKLIST_POLLING_INTERVAL
})

await service.start()
Expand Down
37 changes: 0 additions & 37 deletions packages/message-relayer/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ interface MessageRelayerOptions {

// A custom metrics tracker to manage metrics; default undefined
metrics?: Metrics

// blacklist
blacklistEndpoint?: string

blacklistPollingInterval?: number
}

const optionSettings = {
Expand All @@ -60,7 +55,6 @@ const optionSettings = {
l2BlockOffset: { default: 1 },
l1StartOffset: { default: 0 },
getLogsInterval: { default: 2000 },
blacklistPollingInterval: { default: 60000 }
}

export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
Expand All @@ -78,8 +72,6 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
OVM_L1CrossDomainMessenger: Contract
OVM_L2CrossDomainMessenger: Contract
OVM_L2ToL1MessagePasser: Contract
blacklist: Array<any>
lastBlacklistPollingTimestamp: number
}

protected async _init(): Promise<void> {
Expand All @@ -89,7 +81,6 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
pollingInterval: this.options.pollingInterval,
l2BlockOffset: this.options.l2BlockOffset,
getLogsInterval: this.options.getLogsInterval,
blacklistPollingInterval: this.options.blacklistPollingInterval,
})
// Need to improve this, sorry.
this.state = {} as any
Expand Down Expand Up @@ -152,13 +143,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
this.state.lastFinalizedTxHeight = this.options.fromL2TransactionIndex || 0
this.state.nextUnfinalizedTxHeight =
this.options.fromL2TransactionIndex || 0
this.state.lastBlacklistPollingTimestamp = 0
}

protected async _start(): Promise<void> {
while (this.running) {
await sleep(this.options.pollingInterval)
await this._getBlacklist()

try {
// Check that the correct address is set in the address manager
Expand Down Expand Up @@ -233,11 +222,6 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
continue
}

if (this.state.blacklist.includes(message.target)) {
this.logger.info('Message not intended for target, skipping.')
continue
}

this.logger.info(
'Message not yet relayed. Attempting to generate a proof...'
)
Expand Down Expand Up @@ -566,25 +550,4 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
}
this.logger.info('Message successfully relayed to Layer 1!')
}

private async _getBlacklist(): Promise<void> {
try {
if (this.options.blacklistEndpoint) {
if (this.state.lastBlacklistPollingTimestamp === 0 ||
new Date().getTime() > this.state.lastBlacklistPollingTimestamp + this.options.blacklistPollingInterval
) {
const response = await fetch(this.options.blacklistEndpoint);
const blacklist = await response.json();
this.state.lastBlacklistPollingTimestamp = new Date().getTime();
this.state.blacklist = blacklist;
this.logger.info('Found the blacklist', { blacklist })
}
} else {
this.state.blacklist = [];
}
} catch {
this.logger.info('Failed to fetch the blacklist')
this.state.blacklist = [];
}
}
}
Loading

0 comments on commit 27ba9a1

Please sign in to comment.