Skip to content
Open
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
2 changes: 2 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
branches:
- main

permissions: read-all

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand Down
File renamed without changes.
58 changes: 58 additions & 0 deletions .github/workflows/mega-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
name: MegaLinter

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

permissions: read-all

env: # Comment env block if you don't want to apply fixes
# Apply linter fixes configuration
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
APPLY_FIXES_EVENT: none # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
# MegaLinter
- name: MegaLinter
id: ml
# deployed v8.3.0, https://github.com/oxsecurity/megalinter/releases/tag/v8.3.0
uses: oxsecurity/megalinter@1fc052d03c7a43c78fe0fee19c9d648b749e0c01
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload MegaLinter artifacts
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log

File renamed without changes.
18 changes: 18 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Configuration file for MegaLinter
# See all available variables at https://megalinter.io/configuration/ and in linters documentation

DISABLE_LINTERS:
- GO_GOLANGCI_LINT
- SPELL_CSPELL
- SPELL_LYCHEE

DISABLE_ERRORS_LINTERS:
- COPYPASTE_JSCPD
- REPOSITORY_DEVSKIM
- REPOSITORY_KICS

EMAIL_REPORTER: false
FILEIO_REPORTER: false
MARKDOWN_SUMMARY_REPORTER: true
SHOW_ELAPSED_TIME: true
23 changes: 16 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@ FROM golang:1.21-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

# Set the working directory
WORKDIR /go-ethereum

# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download
COPY go.mod .
COPY go.sum .
RUN go mod download

ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
# Add source code and build
COPY . .
RUN go run build/ci.go install -static ./cmd/geth

# Pull Geth into a second stage deploy alpine container
FROM alpine:latest
FROM alpine:3.21

# Install ca-certificates, create a user to run the service
RUN apk add --no-cache ca-certificates && \
adduser -D -g '' appuser

USER appuser

RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
Expand Down
70 changes: 6 additions & 64 deletions eth/block-validation/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ type ProfBundleRequest struct {
}

type ProfSimResp struct {
Value *uint256.Int
ExecutionPayload *builderApiDeneb.ExecutionPayloadAndBlobsBundle
Value *big.Int
FinalizedBlock string
}

func serializeBlock(block *types.Block) (string, error) {
Expand All @@ -259,55 +259,6 @@ func serializeBlock(block *types.Block) (string, error) {
return hex.EncodeToString(buf.Bytes()), nil
}

func (api *BlockValidationAPI) AppendProfBundle(params *ProfSimReq) (*ProfSimResp, error) {
var err error
log.Info("PROF simulation called!")
log.Info(params.PbsPayload.String())

payload := params.PbsPayload.ExecutionPayload
blobsBundle := params.PbsPayload.BlobsBundle
profTransactionString := params.ProfBundle.Transactions
// convert hex prof transaction to bytes
profTransactionBytes := make([][]byte, len(profTransactionString))
for i, tx := range profTransactionString {
profTransactionBytes[i], _ = hex.DecodeString(tx[2:]) // remove 0x // ignore error as it is prevalidated
}

log.Info("blobs bundle", "blobs", len(blobsBundle.Blobs), "commits", len(blobsBundle.Commitments), "proofs", len(blobsBundle.Proofs))

block, err := engine.ExecutionPayloadV3ToBlockProf(payload, profTransactionBytes, blobsBundle, params.ParentBeaconBlockRoot)
if err != nil {
return nil, err
}

// Serialize the block
blockData, err := serializeBlock(block)
if err != nil {
return nil, fmt.Errorf("failed to serialize block: %v", err)
}

profValidationResp, err := api.ValidateProfBlock(blockData, params.ProposerFeeRecipient, params.RegisteredGasLimit)
if err != nil {
log.Error("invalid payload", "hash", block.Hash, "number", block.NumberU64(), "parentHash", block.ParentHash, "err", err)
return nil, err
}

//TODO: this final check shouldn't be needed
profBlock, err := engine.ExecutionPayloadV3ToBlock(profValidationResp.ExecutionPayload.ExecutionPayload, profValidationResp.ExecutionPayload.BlobsBundle, params.ParentBeaconBlockRoot)
if err != nil {
log.Error("invalid profBlock", "err", err)
return nil, err
}

log.Info("PROF Append Result", "Value", profValidationResp.Value.String(), "ExecutionPayload", profValidationResp.ExecutionPayload, "blockhash", profBlock.Hash().String(), "transactionroot", profBlock.TxHash().String())

// // no need to validate blobs bundle for prof block as prof transactions do not support blobs
// // ret := map[string]interface{}{}

return profValidationResp, nil

}

func (api *BlockValidationAPI) ValidateBuilderSubmissionV3(params *BuilderBlockValidationRequestV3) error {
// TODO: fuzztest, make sure the validation is sound

Expand All @@ -334,7 +285,6 @@ func (api *BlockValidationAPI) ValidateBuilderSubmissionV3(params *BuilderBlockV
return nil
}

// TODO : invalid profTransactions are not being filtered out currently, change the validateProfBlock method to pluck out the invalid transactions, blockhash would also change in that case
func (api *BlockValidationAPI) ValidateProfBlock(blockData string, proposerFeeRecipient common.Address, registeredGasLimit uint64) (*ProfSimResp, error) {
log.Info("VaPrBl: ValidateProfBlock called!")

Expand Down Expand Up @@ -384,23 +334,15 @@ func (api *BlockValidationAPI) ValidateProfBlock(blockData string, proposerFeeRe
return nil, err
}
profBlockFinal := profBlock.WithSeal(header)
log.Info("validated prof block", "number", profBlockFinal.NumberU64(), "parentHash", profBlockFinal.ParentHash())

valueBig := value.ToBig()
log.Info("Validated prof block", "number", profBlockFinal.NumberU64(), "parentHash", profBlockFinal.ParentHash())
log.Info("VaPrBl: valueBig", "valueBig", fmt.Sprintf("%+v", value.ToBig()))

log.Info("VaPrBl: valueBig", "valueBig", fmt.Sprintf("%+v", valueBig))

executableData := engine.BlockToExecutableData(profBlockFinal, valueBig, []*types.BlobTxSidecar{})

payload, err := getDenebPayload(executableData)
serializedBlock, err := serializeBlock(profBlockFinal)
if err != nil {
log.Error("could not format execution payload", "err", err)
return nil, err
}

log.Info("VaPrBl: payload", "payload", fmt.Sprintf("%+v", payload))

return &ProfSimResp{value, payload}, nil
return &ProfSimResp{value.ToBig(), serializedBlock}, nil
}

func (api *BlockValidationAPI) validateBlock(block *types.Block, msg *builderApiV1.BidTrace, registeredGasLimit uint64) error {
Expand Down
Loading