Commit c6e58a5c authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

Merge pull request #2756 from ethereum-optimism/develop

Develop -> Master
parents e2a3fa47 050859fd
---
'@eth-optimism/teleportr': patch
---
Fix panic
---
'@eth-optimism/common-ts': patch
---
Log server messages to logger instead of stdout
---
'@eth-optimism/common-ts': patch
---
Include default options in metadata metric
...@@ -508,18 +508,19 @@ jobs: ...@@ -508,18 +508,19 @@ jobs:
SEMGREP_BASELINE_REF: << parameters.diff_branch >> SEMGREP_BASELINE_REF: << parameters.diff_branch >>
SEMGREP_REPO_URL: << pipeline.project.git_url >> SEMGREP_REPO_URL: << pipeline.project.git_url >>
SEMGREP_BRANCH: << pipeline.git.branch >> SEMGREP_BRANCH: << pipeline.git.branch >>
SEMGREP_COMMIT: << pipeline.git.revision >>
# Change job timeout (default is 1800 seconds; set to 0 to disable) # Change job timeout (default is 1800 seconds; set to 0 to disable)
SEMGREP_TIMEOUT: 3000 SEMGREP_TIMEOUT: 3000
docker: docker:
- image: returntocorp/semgrep - image: returntocorp/semgrep
resource_class: xlarge
steps: steps:
- checkout - checkout
- run: - run:
name: "Set environment variables" # for PR comments and in-app hyperlinks to findings name: "Set environment variables" # for PR comments and in-app hyperlinks to findings
command: | command: |
echo 'export SEMGREP_COMMIT=$CIRCLE_SHA1' >> $BASH_ENV
echo 'export SEMGREP_PR_ID=${CIRCLE_PULL_REQUEST##*/}' >> $BASH_ENV echo 'export SEMGREP_PR_ID=${CIRCLE_PULL_REQUEST##*/}' >> $BASH_ENV
echo 'export SEMGREP_JOB_URL=$CIRCLE_BUILD_URL' >> $BASH_ENV echo 'export SEMGREP_JOB_URL=$CIRCLE_BUILD_URL' >> $BASH_ENV
echo 'export SEMGREP_REPO_NAME=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV echo 'export SEMGREP_REPO_NAME=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV
......
...@@ -20,4 +20,4 @@ tests/ ...@@ -20,4 +20,4 @@ tests/
l2geth/ l2geth/
packages/*/node_modules packages/*/node_modules
packages/*/test packages/*/test
\ No newline at end of file
...@@ -77,6 +77,12 @@ test-integration: ...@@ -77,6 +77,12 @@ test-integration:
./packages/contracts-bedrock/deployments/devnetL1 ./packages/contracts-bedrock/deployments/devnetL1
.PHONY: test-integration .PHONY: test-integration
# Remove the baseline-commit to generate a base reading & show all issues
semgrep:
$(eval DEV_REF := $(shell git rev-parse develop))
SEMGREP_REPO_NAME=ethereum-optimism/optimism semgrep ci --baseline-commit=$(DEV_REF)
.PHONY: semgrep
devnet-genesis: devnet-genesis:
bash ./ops-bedrock/devnet-genesis.sh bash ./ops-bedrock/devnet-genesis.sh
.PHONY: devnet-genesis .PHONY: devnet-genesis
...@@ -170,6 +170,8 @@ func TestL2OutputSubmitter(t *testing.T) { ...@@ -170,6 +170,8 @@ func TestL2OutputSubmitter(t *testing.T) {
// Wait for batch submitter to update L2 output oracle. // Wait for batch submitter to update L2 output oracle.
timeoutCh := time.After(15 * time.Second) timeoutCh := time.After(15 * time.Second)
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
for { for {
l2ooTimestamp, err := l2OutputOracle.LatestBlockTimestamp(&bind.CallOpts{}) l2ooTimestamp, err := l2OutputOracle.LatestBlockTimestamp(&bind.CallOpts{})
require.Nil(t, err) require.Nil(t, err)
...@@ -205,7 +207,7 @@ func TestL2OutputSubmitter(t *testing.T) { ...@@ -205,7 +207,7 @@ func TestL2OutputSubmitter(t *testing.T) {
select { select {
case <-timeoutCh: case <-timeoutCh:
t.Fatalf("State root oracle not updated") t.Fatalf("State root oracle not updated")
case <-time.After(time.Second): case <-ticker.C:
} }
} }
......
...@@ -155,11 +155,7 @@ export abstract class BaseServiceV2< ...@@ -155,11 +155,7 @@ export abstract class BaseServiceV2<
this.loop = params.loop !== undefined ? params.loop : true this.loop = params.loop !== undefined ? params.loop : true
this.state = {} as TServiceState this.state = {} as TServiceState
// Add default options to options spec. const stdOptionsSpec: OptionsSpec<StandardOptions> = {
;(params.optionsSpec as any) = {
...(params.optionsSpec || {}),
// Users cannot set these options.
loopIntervalMs: { loopIntervalMs: {
validator: validators.num, validator: validators.num,
desc: 'Loop interval in milliseconds', desc: 'Loop interval in milliseconds',
...@@ -177,6 +173,12 @@ export abstract class BaseServiceV2< ...@@ -177,6 +173,12 @@ export abstract class BaseServiceV2<
}, },
} }
// Add default options to options spec.
;(params.optionsSpec as any) = {
...(params.optionsSpec || {}),
...stdOptionsSpec,
}
// List of options that can safely be logged. // List of options that can safely be logged.
const publicOptionNames = Object.entries(params.optionsSpec) const publicOptionNames = Object.entries(params.optionsSpec)
.filter(([, spec]) => { .filter(([, spec]) => {
...@@ -348,7 +350,11 @@ export abstract class BaseServiceV2< ...@@ -348,7 +350,11 @@ export abstract class BaseServiceV2<
name: params.name, name: params.name,
version: params.version, version: params.version,
...publicOptionNames.reduce((acc, key) => { ...publicOptionNames.reduce((acc, key) => {
acc[key] = config.str(key) if (key in stdOptionsSpec) {
acc[key] = this.options[key].toString()
} else {
acc[key] = config.str(key)
}
return acc return acc
}, {}), }, {}),
}, },
...@@ -375,7 +381,17 @@ export abstract class BaseServiceV2< ...@@ -375,7 +381,17 @@ export abstract class BaseServiceV2<
app.use(bodyParser.urlencoded({ extended: true })) app.use(bodyParser.urlencoded({ extended: true }))
// Logging. // Logging.
app.use(morgan('short')) app.use(
morgan('short', {
stream: {
write: (str: string) => {
this.logger.info(`server log`, {
log: str,
})
},
},
})
)
// Metrics. // Metrics.
// Will expose a /metrics endpoint by default. // Will expose a /metrics endpoint by default.
......
...@@ -352,6 +352,9 @@ func (d *Driver) SendTransaction( ...@@ -352,6 +352,9 @@ func (d *Driver) SendTransaction(
subCtx, cancel := context.WithTimeout(ctx, 10*time.Second) subCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel() defer cancel()
err := d.cfg.L2Client.SendTransaction(subCtx, tx) err := d.cfg.L2Client.SendTransaction(subCtx, tx)
if err == nil {
return err
}
if !IsRetryableError(err) { if !IsRetryableError(err) {
d.metrics.FailedTXSubmissions.WithLabelValues("permanent").Inc() d.metrics.FailedTXSubmissions.WithLabelValues("permanent").Inc()
return backoff.Permanent(err) return backoff.Permanent(err)
......
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