From e027a0ab5b807c7fe92a9f2f0ecf0e7d63f822f7 Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Thu, 9 Jun 2022 10:29:42 -0700 Subject: [PATCH 1/5] Fix semgrep ignore file --- .semgrepignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semgrepignore b/.semgrepignore index a273ce80be93a..ad3a29a9c2885 100644 --- a/.semgrepignore +++ b/.semgrepignore @@ -20,4 +20,4 @@ tests/ l2geth/ packages/*/node_modules -packages/*/test \ No newline at end of file +packages/*/test From a48e67605280c02fe575ef9380c7945afbbb32cd Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Thu, 9 Jun 2022 11:48:23 -0700 Subject: [PATCH 2/5] updates --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 604b8c42071b3..a7ec8fbff4c4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -505,9 +505,10 @@ jobs: default: develop environment: # Scan changed files in PRs, block on new issues only (existing issues ignored) - SEMGREP_BASELINE_REF: << parameters.diff_branch >> + # SEMGREP_BASELINE_REF: << parameters.diff_branch >> SEMGREP_REPO_URL: << pipeline.project.git_url >> SEMGREP_BRANCH: << pipeline.git.branch >> + SEMGREP_COMMIT: << pipeline.git.revision >> # Change job timeout (default is 1800 seconds; set to 0 to disable) SEMGREP_TIMEOUT: 3000 @@ -519,10 +520,9 @@ jobs: - run: name: "Set environment variables" # for PR comments and in-app hyperlinks to findings 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_REPO_NAME=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV + echo 'export SEMGREP_REPO_NAME=$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV - run: name: "Semgrep scan" command: semgrep ci From f7e1278454eb04a5a3538b07b804687a204fca9e Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Thu, 9 Jun 2022 11:52:42 -0700 Subject: [PATCH 3/5] More resource --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a7ec8fbff4c4b..dbbcc71f488c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -515,6 +515,7 @@ jobs: docker: - image: returntocorp/semgrep + resource_class: xlarge steps: - checkout - run: From 077069e25a43018d3d87500ff8d4c815f19f7777 Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Thu, 9 Jun 2022 12:00:52 -0700 Subject: [PATCH 4/5] more updates --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbbcc71f488c2..b64e6c0af5274 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -505,7 +505,7 @@ jobs: default: develop environment: # Scan changed files in PRs, block on new issues only (existing issues ignored) - # SEMGREP_BASELINE_REF: << parameters.diff_branch >> + SEMGREP_BASELINE_REF: << parameters.diff_branch >> SEMGREP_REPO_URL: << pipeline.project.git_url >> SEMGREP_BRANCH: << pipeline.git.branch >> SEMGREP_COMMIT: << pipeline.git.revision >> @@ -521,9 +521,9 @@ jobs: - run: name: "Set environment variables" # for PR comments and in-app hyperlinks to findings command: | - 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_REPO_NAME=$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV + echo 'export SEMGREP_REPO_NAME=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV - run: name: "Semgrep scan" command: semgrep ci From 7f3f2730d45cd6aa8b1256103485a0e443da3959 Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Thu, 9 Jun 2022 12:01:34 -0700 Subject: [PATCH 5/5] Revert "Use ticker instead of time.After in select loop (#2621)" This reverts commit 710580705dea7d02ccc9cc3636c61e6df163d492. --- op-e2e/geth.go | 4 +--- op-proposer/service.go | 4 +--- op-proposer/txmgr/txmgr.go | 5 +---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/op-e2e/geth.go b/op-e2e/geth.go index b849e8f3a6811..ee92217f24806 100644 --- a/op-e2e/geth.go +++ b/op-e2e/geth.go @@ -27,8 +27,6 @@ import ( func waitForTransaction(hash common.Hash, client *ethclient.Client, timeout time.Duration) (*types.Receipt, error) { timeoutCh := time.After(timeout) - ticker := time.NewTicker(100 * time.Millisecond) - defer ticker.Stop() ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() for { @@ -42,7 +40,7 @@ func waitForTransaction(hash common.Hash, client *ethclient.Client, timeout time select { case <-timeoutCh: return nil, errors.New("timeout") - case <-ticker.C: + case <-time.After(100 * time.Millisecond): } } } diff --git a/op-proposer/service.go b/op-proposer/service.go index af0fdd549b9b8..530d30e69dfb2 100644 --- a/op-proposer/service.go +++ b/op-proposer/service.go @@ -101,12 +101,10 @@ func (s *Service) eventLoop() { defer s.wg.Done() name := s.cfg.Driver.Name() - ticker := time.NewTicker(s.cfg.PollInterval) - defer ticker.Stop() for { select { - case <-ticker.C: + case <-time.After(s.cfg.PollInterval): // Determine the range of L2 blocks that the submitter has not // processed, and needs to take action on. s.l.Info(name + " fetching current block range") diff --git a/op-proposer/txmgr/txmgr.go b/op-proposer/txmgr/txmgr.go index d41b064fb2e9a..f09b94dacbee6 100644 --- a/op-proposer/txmgr/txmgr.go +++ b/op-proposer/txmgr/txmgr.go @@ -205,15 +205,12 @@ func (m *SimpleTxManager) Send( wg.Add(1) go sendTxAsync() - ticker := time.NewTicker(m.cfg.ResubmissionTimeout) - defer ticker.Stop() - for { select { // Whenever a resubmission timeout has elapsed, bump the gas // price and publish a new transaction. - case <-ticker.C: + case <-time.After(m.cfg.ResubmissionTimeout): // Avoid republishing if we are waiting for confirmation on an // existing tx. This is primarily an optimization to reduce the // number of API calls we make, but also reduces the chances of