Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/docker build #28902

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

accounts/usbwallet @karalabe
accounts/scwallet @gballet
accounts/abi @gballet @MariusVanDerWijden
cmd/clef @holiman
consensus @karalabe
core/ @karalabe @holiman @rjl493456442
eth/ @karalabe @holiman @rjl493456442
eth/catalyst/ @gballet
eth/tracers/ @s1na
graphql/ @s1na
les/ @zsfelfoldi @rjl493456442
light/ @zsfelfoldi @rjl493456442
node/ @fjl
p2p/ @fjl @zsfelfoldi
rpc/ @fjl @holiman
p2p/simulations @fjl
p2p/protocols @fjl
p2p/testing @fjl
signer/ @holiman
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# they will be requested for review when someone opens a pull request.
* @ferranbt @Ruteri @metachris @dmarzzz @lthibault
28 changes: 28 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run unit tests on Linux

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

env:
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20', '1.21.x' ]
# goarch: [amd64, arm64]

steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Run unit tests
run: go test -short ./accounts ./cmd/geth ./core ./core/types ./core/vm ./eth/... ./internal/ethapi/... ./miner ./params ./suave/...
23 changes: 0 additions & 23 deletions .github/workflows/go.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# .github/workflows/release.yml
name: release

on:
workflow_dispatch:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup dependencies
uses: actions/setup-go@v2

- name: Login to Docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.FLASHBOTS_DOCKERHUB_USERNAME }}
password: ${{ secrets.FLASHBOTS_DOCKERHUB_TOKEN }}

- name: Log tag name
run: echo "Build for tag ${{ github.ref_name }}"

- name: Create release
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
111 changes: 111 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
env:
- CGO_ENABLED=1
builds:
- id: suave-execution-geth-darwin-amd64
binary: suave-execution-geth
main: ./cmd/geth
goarch:
- amd64
goos:
- darwin
env:
- CC=o64-clang
- CXX=o64-clang++
flags:
- -trimpath
- id: suave-execution-geth-darwin-arm64
binary: suave-execution-geth
main: ./cmd/geth
goarch:
- arm64
goos:
- darwin
env:
- CC=oa64-clang
- CXX=oa64-clang++
flags:
- -trimpath
- id: suave-execution-geth-linux-amd64
binary: suave-execution-geth
main: ./cmd/geth
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goarch:
- amd64
goos:
- linux
flags:
- -trimpath
ldflags:
- -extldflags "-Wl,-z,stack-size=0x800000 --static"
tags:
- netgo
- osusergo
- id: suave-execution-geth-linux-arm64
binary: suave-execution-geth
main: ./cmd/geth
goarch:
- arm64
goos:
- linux
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
flags:
- -trimpath
ldflags:
- -extldflags "-Wl,-z,stack-size=0x800000 --static"
tags:
- netgo
- osusergo
- id: suave-execution-geth-windows-amd64
binary: suave-execution-geth
main: ./cmd/geth
goarch:
- amd64
goos:
- windows
env:
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
flags:
- -trimpath
- -buildmode=exe

archives:
- id: w/version
builds:
- suave-execution-geth-darwin-amd64
- suave-execution-geth-darwin-arm64
- suave-execution-geth-linux-amd64
- suave-execution-geth-linux-arm64
- suave-execution-geth-windows-amd64
name_template: "suave-execution-geth_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
files:
- none*

dockers:
- dockerfile: ./Dockerfile.suave
use: buildx
goarch: amd64
goos: linux
build_flag_templates:
- --platform=linux/amd64
image_templates:
- "flashbots/suave-execution-geth:{{ .ShortCommit }}"
- "flashbots/suave-execution-geth:{{ .Tag }}"
- "flashbots/suave-execution-geth:latest"

checksum:
name_template: "checksums.txt"

release:
draft: true
header: |
# 🚀 Features
# 🎄 Enhancements
# 🐞 Notable bug fixes
# 🎠 Community
7 changes: 7 additions & 0 deletions Dockerfile.suave
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM debian:bullseye
LABEL "org.opencontainers.image.source"="https://github.com/flashbots/suave-execution-geth"

COPY ./suave-execution-geth /bin/

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["suave-execution-geth"]
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@ devtools:
env GOBIN= go install ./cmd/abigen
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'

release:
docker run \
--rm \
-e CGO_ENABLED=1 \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(HOME)/.docker/config.json:/root/.docker/config.json \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:v1.21 \
release --clean
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`suave-execution-geth` is a minimal fork of geth which implements the [SUAVE Execution Namespace](suave-execution-geth). The namespace is turned on by default for http and ipc.

## Go Ethereum

Official Golang execution layer implementation of the Ethereum protocol.
Expand Down
4 changes: 2 additions & 2 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ func defaultNodeConfig() node.Config {
cfg := node.DefaultConfig
cfg.Name = clientIdentifier
cfg.Version = params.VersionWithCommit(git.Commit, git.Date)
cfg.HTTPModules = append(cfg.HTTPModules, "eth")
cfg.WSModules = append(cfg.WSModules, "eth")
cfg.HTTPModules = append(cfg.HTTPModules, "eth", "suavex")
cfg.WSModules = append(cfg.WSModules, "eth", "suavex")
cfg.IPCPath = "geth.ipc"
return cfg
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/geth/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
)

const (
ipcAPIs = "admin:1.0 clique:1.0 debug:1.0 engine:1.0 eth:1.0 miner:1.0 net:1.0 rpc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "eth:1.0 net:1.0 rpc:1.0 web3:1.0"
ipcAPIs = "admin:1.0 clique:1.0 debug:1.0 engine:1.0 eth:1.0 miner:1.0 net:1.0 rpc:1.0 suavex:1.0 txpool:1.0 web3:1.0"
httpAPIs = "eth:1.0 net:1.0 rpc:1.0 suavex:1.0 web3:1.0"
)

// spawns geth with the given command line args, using a set of flags to minimise
Expand Down
95 changes: 95 additions & 0 deletions core/types/sbundle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package types

import (
"encoding/json"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)

// Simplified Share Bundle Type for PoC

type SBundle struct {
BlockNumber *big.Int `json:"blockNumber,omitempty"` // if BlockNumber is set it must match DecryptionCondition!
MaxBlock *big.Int `json:"maxBlock,omitempty"`
Txs Transactions `json:"txs"`
RevertingHashes []common.Hash `json:"revertingHashes,omitempty"`
RefundPercent *int `json:"percent,omitempty"`
}

type RpcSBundle struct {
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
MaxBlock *hexutil.Big `json:"maxBlock,omitempty"`
Txs []hexutil.Bytes `json:"txs"`
RevertingHashes []common.Hash `json:"revertingHashes,omitempty"`
RefundPercent *int `json:"percent,omitempty"`
}

func (s *SBundle) MarshalJSON() ([]byte, error) {
txs := []hexutil.Bytes{}
for _, tx := range s.Txs {
txBytes, err := tx.MarshalBinary()
if err != nil {
return nil, err
}
txs = append(txs, txBytes)
}

var blockNumber *hexutil.Big
if s.BlockNumber != nil {
blockNumber = new(hexutil.Big)
*blockNumber = hexutil.Big(*s.BlockNumber)
}

return json.Marshal(&RpcSBundle{
BlockNumber: blockNumber,
Txs: txs,
RevertingHashes: s.RevertingHashes,
RefundPercent: s.RefundPercent,
})
}

func (s *SBundle) UnmarshalJSON(data []byte) error {
var rpcSBundle RpcSBundle
if err := json.Unmarshal(data, &rpcSBundle); err != nil {
return err
}

var txs Transactions
for _, txBytes := range rpcSBundle.Txs {
var tx Transaction
err := tx.UnmarshalBinary(txBytes)
if err != nil {
return err
}

txs = append(txs, &tx)
}

s.BlockNumber = (*big.Int)(rpcSBundle.BlockNumber)
s.MaxBlock = (*big.Int)(rpcSBundle.MaxBlock)
s.Txs = txs
s.RevertingHashes = rpcSBundle.RevertingHashes
s.RefundPercent = rpcSBundle.RefundPercent

return nil
}

type RPCMevShareBundle struct {
Version string `json:"version"`
Inclusion struct {
Block string `json:"block"`
MaxBlock string `json:"maxBlock"`
} `json:"inclusion"`
Body []struct {
Tx string `json:"tx"`
CanRevert bool `json:"canRevert"`
} `json:"body"`
Validity struct {
Refund []struct {
BodyIdx int `json:"bodyIdx"`
Percent int `json:"percent"`
} `json:"refund"`
} `json:"validity"`
}
Loading