Skip to content

Commit

Permalink
op-signer: add to this repo (#51)
Browse files Browse the repository at this point in the history
* op-signer: add to this repo

* circleci: add op-signer jobs/workflows

* ops: update tag service to include op-signer

* readme: add op-signer one sentence description

* ci: add op-signer option to github action

* ops: add op-signer min version
  • Loading branch information
bitwiseguy authored Sep 10, 2024
1 parent 7f8095c commit 75b02df
Show file tree
Hide file tree
Showing 34 changed files with 2,502 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ workflows:
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
mapping: |
op-conductor-mon/.* run-build-op-conductor-mon true
op-signer/.* run-build-op-signer true
op-ufm/.* run-build-op-ufm true
proxyd/.* run-build-proxyd true
.circleci/.* run-all true
Expand Down
58 changes: 58 additions & 0 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ parameters:
run-build-op-conductor-mon:
type: boolean
default: false
run-build-op-signer:
type: boolean
default: false
run-build-op-ufm:
type: boolean
default: false
Expand Down Expand Up @@ -76,6 +79,7 @@ jobs:
command: |
echo "Configuration Results:"
echo "run-build-op-conductor-mon: << pipeline.parameters.run-build-op-conductor-mon >>"
echo "run-build-op-signer: << pipeline.parameters.run-build-op-signer >>"
echo "run-build-op-ufm: << pipeline.parameters.run-build-op-ufm >>"
echo "run-build-proxyd: << pipeline.parameters.run-build-proxyd >>"
echo "run-all: << pipeline.parameters.run-all >>"
Expand All @@ -100,6 +104,12 @@ jobs:
echo "op-conductor-mon tag regex match: false"
fi
if [[ $CURRENT_TAG =~ ^op-signer/v.* ]]; then
echo "op-signer tag regex match: true"
else
echo "op-signer tag regex match: false"
fi
if [[ $CURRENT_TAG =~ ^op-ufm/v.* ]]; then
echo "op-ufm tag regex match: true"
else
Expand Down Expand Up @@ -408,6 +418,22 @@ workflows:
docker_name: op-conductor-mon
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
op-signer:
when:
or: [<< pipeline.parameters.run-build-op-signer >>, << pipeline.parameters.run-all >>]
jobs:
- go-lint:
name: op-signer-lint
module: op-signer
- go-test:
name: op-signer-tests
module: op-signer
- docker-build:
name: op-signer-docker-build
docker_file: op-signer/Dockerfile
docker_name: op-signer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
op-ufm:
when:
or: [<< pipeline.parameters.run-build-op-ufm >>, << pipeline.parameters.run-all >>]
Expand Down Expand Up @@ -455,6 +481,38 @@ workflows:
only: /^(proxyd|ufm-[a-z0-9\-]*|op-[a-z0-9\-]*)\/v.*/
branches:
ignore: /.*/
- docker-build:
name: op-signer-docker-build
filters:
tags:
only: /^op-signer\/v.*/
docker_name: op-signer
docker_tags: <<pipeline.git.revision>>
docker_context: .
docker_file: op-signer/Dockerfile
context:
- oplabs-gcr-release
requires:
- hold
- docker-publish:
name: op-signer-docker-publish
docker_name: op-signer
docker_tags: <<pipeline.git.revision>>
context:
- oplabs-gcr-release
requires:
- op-signer-docker-build
- docker-tag-op-stack-release:
name: docker-tag-op-signer-release
filters:
tags:
only: /^op-signer\/v.*/
branches:
ignore: /.*/
context:
- oplabs-gcr-release
requires:
- op-signer-docker-publish
- docker-build:
name: op-ufm-docker-build
filters:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tag-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
required: true
type: choice
options:
- op-signer
- op-ufm
- proxyd
prerelease:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ This repository is an extension of the [Optimism monorepo](https://github.com/et

## Components
- op-conductor-mon: Monitors multiple op-conductor instances and provides a unified interface for reporting metrics.
- op-signer: Thin gateway that supports `eth_signTransaction` RPC endpoint to sign ethereum tx payloads using private key stored in KMS
- op-ufm: User facing monitoring creates transactions at regular intervals and observe transaction propagation across different RPC providers.
37 changes: 37 additions & 0 deletions op-signer/.air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "bin"

[build]
args_bin = []
bin = "./bin/op-signer"
cmd = "make build"
delay = 1000
exclude_dir = ["bin"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
4 changes: 4 additions & 0 deletions op-signer/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export OP_SIGNER_LOG_LEVEL=debug
export OP_SIGNER_LOG_COLOR=true
export OP_SIGNER_RPC_PORT=8080
export OP_SIGNER_METRICS_ENABLED=true
2 changes: 2 additions & 0 deletions op-signer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
tls/
1 change: 1 addition & 0 deletions op-signer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @eth-optimism/signer
18 changes: 18 additions & 0 deletions op-signer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.21.3-alpine3.18 as builder

COPY ./op-signer /app

WORKDIR /app
RUN apk --no-cache add make jq bash git alpine-sdk
RUN make build

FROM alpine:3.18
RUN apk --no-cache add ca-certificates

RUN addgroup -S app && adduser -S app -G app
USER app
WORKDIR /app

COPY --from=builder /app/bin/op-signer /app

ENTRYPOINT ["/app/op-signer"]
37 changes: 37 additions & 0 deletions op-signer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
GITCOMMIT := $(shell git rev-parse HEAD)
GITDATE := $(shell git show -s --format='%ct')
VERSION := v0.0.0

LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

all: build

docker:
docker build ../ -f Dockerfile -t op-signer:latest

build:
env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-signer ./cmd

clean:
rm ./bin/op-signer

generate:
[ '$(shell mockgen --version)' = 'v1.6.0' ] || go install github.com/golang/mock/[email protected]
go generate ./...

test: generate
go test -v ./...

lint:
golangci-lint run ./...

.PHONY: \
build \
clean \
test \
generate \
lint \
docker
14 changes: 14 additions & 0 deletions op-signer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @eth-optimism/signer

Signer service and client library

## Setup

Install go1.18

```bash
make build

source .env.example # (or copy to .envrc if using direnv)
./bin/signer
```
Loading

0 comments on commit 75b02df

Please sign in to comment.