Skip to content

Commit

Permalink
fix(exec,plg): remove command line hack (sphinx-labs#416)
Browse files Browse the repository at this point in the history
Removes the command line hack that was needed to fix a bug that was
later fixed in upstream BaseServiceV2.

Co-authored-by: sam-goldman <106038229+sam-goldman@users.noreply.github.com>
  • Loading branch information
smartcontracts and sam-goldman authored Jan 27, 2023
1 parent 1b08f02 commit ed17785
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-cheetahs-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/executor': patch
---

Updates the executor to use the latest version of BaseServiceV2.
5 changes: 5 additions & 0 deletions .changeset/silly-trainers-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/plugins': patch
---

Removes a hack for a bug that was fixed in upstream BaseServiceV2.
2 changes: 1 addition & 1 deletion packages/executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@chugsplash/contracts": "^0.4.1",
"@chugsplash/core": "^0.4.1",
"@eth-optimism/common-ts": "^0.6.0",
"@eth-optimism/common-ts": "^0.7.1",
"@eth-optimism/core-utils": "^0.9.3",
"dotenv": "^16.0.3",
"ethers": "^5.6.8",
Expand Down
17 changes: 12 additions & 5 deletions packages/executor/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as dotenv from 'dotenv'
dotenv.config()
import { BaseServiceV2, Logger, validators } from '@eth-optimism/common-ts'
import {
BaseServiceV2,
StandardOptions,
Logger,
validators,
} from '@eth-optimism/common-ts'
import { ethers } from 'ethers'
import {
ChugSplashManagerABI,
Expand Down Expand Up @@ -40,15 +45,17 @@ export class ChugSplashExecutor extends BaseServiceV2<
ExecutorMetrics,
ExecutorState
> {
constructor(options?: Partial<ExecutorOptions>) {
constructor(options?: Partial<ExecutorOptions & StandardOptions>) {
super({
name: 'chugsplash-executor',
// eslint-disable-next-line @typescript-eslint/no-var-requires
version: require('../package.json').version,
loop: true,
loopIntervalMs: 5000,
port: parseInt(process.env.EXECUTOR_PORT, 10),
options,
options: {
loopIntervalMs: 5000,
port: parseInt(process.env.EXECUTOR_PORT, 10),
...options,
},
optionsSpec: {
url: {
desc: 'Target deployment network access url',
Expand Down
27 changes: 0 additions & 27 deletions packages/plugins/src/env.ts

This file was deleted.

14 changes: 3 additions & 11 deletions packages/plugins/src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ import { ChugSplashExecutorType } from '@chugsplash/core'
import { ChugSplashExecutor } from '@chugsplash/executor'
import { providers } from 'ethers'

import { addCommandLineArgs, removeFlagsFromCommandLineArgs } from './env'

export const initializeExecutor = async (
provider: providers.JsonRpcProvider
): Promise<ChugSplashExecutorType> => {
// We must remove the command line arguments that begin with '--' from the process.argv array,
// or else the BaseServiceV2 (inherited by the executor) will throw an error when we instantiate
// it.
const removed = removeFlagsFromCommandLineArgs()

// Instantiate the executor.
const executor = new ChugSplashExecutor()
const executor = new ChugSplashExecutor({
useArgv: false,
})

// Setup the executor.
await executor.setup(
Expand All @@ -26,8 +21,5 @@ export const initializeExecutor = async (
provider
)

// Add the command line args back to the array.
addCommandLineArgs(removed)

return executor as any as ChugSplashExecutorType
}
1 change: 0 additions & 1 deletion packages/plugins/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './hardhat'
export * from './env'
export * from './sample-project'
47 changes: 46 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@eth-optimism/common-ts@^0.6.0", "@eth-optimism/common-ts@^0.6.7":
"@eth-optimism/common-ts@^0.6.7":
version "0.6.7"
resolved "https://registry.yarnpkg.com/@eth-optimism/common-ts/-/common-ts-0.6.7.tgz#f63f0e14e609215c255675183168fbaa7c641722"
integrity sha512-zEJ/T58FU41tM+6hrQZvoZUec0Ce9cDJa3/Kd6jvzOfSiRjclIAHLk4BQYuFhNOx6pDNWlbuiNrBxpsWW4HCNg==
Expand All @@ -495,6 +495,29 @@
prom-client "^13.1.0"
qs "^6.10.5"

"@eth-optimism/common-ts@^0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@eth-optimism/common-ts/-/common-ts-0.7.1.tgz#42dd78051e7c45d40f133598c9d43bb0c02ce9b1"
integrity sha512-SNaOhoj9lYutcmGpJQJJfZiZii54eoiSB1kM8XVmbIwyhgaTkmuB8IhHOiDbzGB3QXUtbGZjDJmi6LruKkN/CA==
dependencies:
"@eth-optimism/core-utils" "0.12.0"
"@sentry/node" "^6.3.1"
bcfg "^0.1.7"
body-parser "^1.20.0"
commander "^9.0.0"
dotenv "^16.0.0"
envalid "^7.2.2"
ethers "^5.7.0"
express "^4.17.1"
express-prom-bundle "^6.4.1"
lodash "^4.17.21"
morgan "^1.10.0"
pino "^6.11.3"
pino-multi-stream "^5.3.0"
pino-sentry "^0.7.0"
prom-client "^13.1.0"
qs "^6.10.5"

"@eth-optimism/contracts-bedrock@^0.8.0":
version "0.8.3"
resolved "https://registry.yarnpkg.com/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.8.3.tgz#a73302b57a61d9516abf80c136bf8298327178d5"
Expand Down Expand Up @@ -537,6 +560,28 @@
bufio "^1.0.7"
chai "^4.3.4"

"@eth-optimism/core-utils@0.12.0":
version "0.12.0"
resolved "https://registry.yarnpkg.com/@eth-optimism/core-utils/-/core-utils-0.12.0.tgz#6337e4599a34de23f8eceb20378de2a2de82b0ea"
integrity sha512-qW+7LZYCz7i8dRa7SRlUKIo1VBU8lvN0HeXCxJR+z+xtMzMQpPds20XJNCMclszxYQHkXY00fOT6GvFw9ZL6nw==
dependencies:
"@ethersproject/abi" "^5.7.0"
"@ethersproject/abstract-provider" "^5.7.0"
"@ethersproject/address" "^5.7.0"
"@ethersproject/bignumber" "^5.7.0"
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/constants" "^5.7.0"
"@ethersproject/contracts" "^5.7.0"
"@ethersproject/hash" "^5.7.0"
"@ethersproject/keccak256" "^5.7.0"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/providers" "^5.7.0"
"@ethersproject/rlp" "^5.7.0"
"@ethersproject/transactions" "^5.7.0"
"@ethersproject/web" "^5.7.0"
bufio "^1.0.7"
chai "^4.3.4"

"@eth-optimism/core-utils@^0.10.1":
version "0.10.1"
resolved "https://registry.yarnpkg.com/@eth-optimism/core-utils/-/core-utils-0.10.1.tgz#44515fbca627532a24c6fd433395f00be8525832"
Expand Down

0 comments on commit ed17785

Please sign in to comment.