Merge branch 'main' of github.com:berachain/bera-geth into update-main

Use static linking for arm64 and amd64 build binaries
This commit is contained in:
Cal Bera 2025-06-30 11:44:34 -07:00
commit add9a4ff34
34 changed files with 805 additions and 392 deletions

View file

@ -1,27 +0,0 @@
on:
workflow_dispatch:
### Note we cannot use cron-triggered builds right now, Gitea seems to have
### a few bugs in that area. So this workflow is scheduled using an external
### triggering mechanism and workflow_dispatch.
#
# schedule:
# - cron: '0 15 * * *'
jobs:
azure-cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Run cleanup script
run: |
go run build/ci.go purge -store gethstore/builds -days 14
env:
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}

View file

@ -1,46 +0,0 @@
on:
push:
tags:
- "v*"
workflow_dispatch:
### Note we cannot use cron-triggered builds right now, Gitea seems to have
### a few bugs in that area. So this workflow is scheduled using an external
### triggering mechanism and workflow_dispatch.
#
# schedule:
# - cron: '0 16 * * *'
jobs:
ppa:
name: PPA Upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Show environment
run: |
env
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install deb toolchain
run: |
apt-get update
apt-get -yq --no-install-suggests --no-install-recommends install devscripts debhelper dput fakeroot
- name: Add launchpad to known_hosts
run: |
echo '|1|7SiYPr9xl3uctzovOTj4gMwAC1M=|t6ReES75Bo/PxlOPJ6/GsGbTrM0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0aKz5UTUndYgIGG7dQBV+HaeuEZJ2xPHo2DS2iSKvUL4xNMSAY4UguNW+pX56nAQmZKIZZ8MaEvSj6zMEDiq6HFfn5JcTlM80UwlnyKe8B8p7Nk06PPQLrnmQt5fh0HmEcZx+JU9TZsfCHPnX7MNz4ELfZE6cFsclClrKim3BHUIGq//t93DllB+h4O9LHjEUsQ1Sr63irDLSutkLJD6RXchjROXkNirlcNVHH/jwLWR5RcYilNX7S5bIkK8NlWPjsn/8Ua5O7I9/YoE97PpO6i73DTGLh5H9JN/SITwCKBkgSDWUt61uPK3Y11Gty7o2lWsBjhBUm2Y38CBsoGmBw==' >> ~/.ssh/known_hosts
- name: Run ci.go
run: |
go run build/ci.go debsrc -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>"
env:
PPA_SIGNING_KEY: ${{ secrets.PPA_SIGNING_KEY }}
PPA_SSH_KEY: ${{ secrets.PPA_SSH_KEY }}

View file

@ -1,147 +0,0 @@
on:
push:
branches:
- "master"
tags:
- "v*"
jobs:
linux-intel:
name: Linux Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install cross toolchain
run: |
apt-get update
apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
- name: Build (amd64)
run: |
go run build/ci.go install -static -arch amd64 -dlgo
- name: Create/upload archive (amd64)
run: |
go run build/ci.go archive -arch amd64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
rm -f build/bin/*
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
- name: Build (386)
run: |
go run build/ci.go install -static -arch 386 -dlgo
- name: Create/upload archive (386)
run: |
go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
rm -f build/bin/*
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
linux-arm:
name: Linux Build (arm)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install cross toolchain
run: |
apt-get update
apt-get -yq --no-install-suggests --no-install-recommends install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
ln -s /usr/include/asm-generic /usr/include/asm
- name: Build (arm64)
run: |
go run build/ci.go install -static -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
- name: Create/upload archive (arm64)
run: |
go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
rm -fr build/bin/*
env:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
- name: Run build (arm5)
run: |
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env:
GOARM: "5"
- name: Create/upload archive (arm5)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
env:
GOARM: "5"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
- name: Run build (arm6)
run: |
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env:
GOARM: "6"
- name: Create/upload archive (arm6)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
rm -fr build/bin/*
env:
GOARM: "6"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
- name: Run build (arm7)
run: |
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env:
GOARM: "7"
- name: Create/upload archive (arm7)
run: |
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
rm -fr build/bin/*
env:
GOARM: "7"
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
docker:
name: Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Run docker build
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
go run build/ci.go dockerx -platform linux/amd64,linux/arm64,linux/riscv64 -upload

31
.github/CODEOWNERS vendored
View file

@ -1,33 +1,4 @@
# Lines starting with '#' are comments. # Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners. # Each line is a file pattern followed by one or more owners.
accounts/usbwallet/ @gballet * @calbera
accounts/scwallet/ @gballet
accounts/abi/ @gballet @MariusVanDerWijden
beacon/engine/ @MariusVanDerWijden @lightclient @fjl
beacon/light/ @zsfelfoldi
beacon/merkle/ @zsfelfoldi
beacon/types/ @zsfelfoldi @fjl
beacon/params/ @zsfelfoldi @fjl
cmd/evm/ @MariusVanDerWijden @lightclient
core/state/ @rjl493456442
crypto/ @gballet @jwasinger @fjl
core/ @rjl493456442
eth/ @rjl493456442
eth/catalyst/ @MariusVanDerWijden @lightclient @fjl @jwasinger
eth/tracers/ @s1na
ethclient/ @fjl
ethdb/ @rjl493456442
event/ @fjl
trie/ @rjl493456442
triedb/ @rjl493456442
core/tracing/ @s1na
graphql/ @s1na
internal/ethapi/ @fjl @s1na @lightclient
internal/era/ @lightclient
miner/ @MariusVanDerWijden @fjl @rjl493456442
node/ @fjl
p2p/ @fjl @zsfelfoldi
rlp/ @fjl
params/ @fjl @karalabe @gballet @rjl493456442 @zsfelfoldi
rpc/ @fjl

View file

@ -21,7 +21,7 @@ Please make sure your contributions adhere to our coding guidelines:
(i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
* Code must be documented adhering to the official Go * Code must be documented adhering to the official Go
[commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
* Pull requests need to be based on and opened against the `master` branch. * Pull requests need to be based on and opened against the `main` branch.
* Commit messages should be prefixed with the package(s) they modify. * Commit messages should be prefixed with the package(s) they modify.
* E.g. "eth, rpc: make trace configs optional" * E.g. "eth, rpc: make trace configs optional"

11
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

BIN
.github/meta/bera-geth.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,5 +1,5 @@
# Number of days of inactivity before an Issue is closed for lack of response # Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 30 daysUntilClose: 366
# Label requiring a response # Label requiring a response
responseRequiredLabel: "need:more-information" responseRequiredLabel: "need:more-information"
# Comment to post when closing an Issue for lack of response. Set to `false` to disable # Comment to post when closing an Issue for lack of response. Set to `false` to disable

View file

@ -1,16 +1,16 @@
name: i386 linux tests name: CI
on: on:
push: push:
branches: [ master ] branches: [ main ]
pull_request: pull_request:
branches: [ master ] branches: [ main ]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
lint: lint:
name: Lint name: Lint
runs-on: self-hosted runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -32,8 +32,9 @@ jobs:
go run build/ci.go check_generate go run build/ci.go check_generate
go run build/ci.go check_baddeps go run build/ci.go check_baddeps
build: tests:
runs-on: self-hosted name: Tests
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Go - name: Set up Go

43
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name: Docker
on:
push:
tags:
- "v1.*"
branches:
- "main"
jobs:
docker:
name: Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multi-arch images to GHCR
run: |
go run build/ci.go dockerx -platform linux/amd64,linux/arm64 -hub ghcr.io/berachain/bera-geth -upload

13
.github/workflows/release.asc vendored Normal file
View file

@ -0,0 +1,13 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEaFNE5RYJKwYBBAHaRw8BAQdAzKOuVGKVlxDTv29pw/g7reYDWw0d7Lma13oe
vBBggee0G2JlcmEtZ2V0aC1saW51eC1zaWduaW5nLWtleYiTBBMWCgA7FiEECD2r
J1G161Sj6o/AVxC/N/yI0gUFAmhTROUCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC
HgcCF4AACgkQVxC/N/yI0gVTYwD+KiFp07+KNJ/eUlsc2j6Utz9zU7aHKEEh4LNF
uahgRC4A/i1+QkR9oo14o3lbg8yWPnI5v8QQwBd7i3GNExxPXrsMuDgEaFNE5RIK
KwYBBAGXVQEFAQEHQF1SxadHSBJud54oIYyHxq/r8GFmPyahf4ISUI/62X4BAwEI
B4h4BBgWCgAgFiEECD2rJ1G161Sj6o/AVxC/N/yI0gUFAmhTROUCGwwACgkQVxC/
N/yI0gV08QEAhpMEKbnYk9GzBSvRdgtHaYeLLqUtTp1W7Ug+RUO4338A/RWO27B8
8mAF2WACCu8lLErv5V/YI3rkDiu/MSit+p0A
=Ubr7
-----END PGP PUBLIC KEY BLOCK-----

226
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,226 @@
name: Release
on:
push:
tags:
- "v1.*"
jobs:
extract-version:
name: Extract Version
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}
linux-intel:
name: Linux Build (intel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install cross toolchain
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
- name: Build (amd64)
run: |
go run build/ci.go install -static -arch amd64 -dlgo
- name: Create archive (amd64)
run: |
go run build/ci.go archive -arch amd64 -type tar
- name: Upload artifacts (amd64)
uses: actions/upload-artifact@v4
with:
name: bera-geth-linux-amd64-archives
path: |
bera-geth-linux-amd64-*.tar.gz
bera-geth-alltools-linux-amd64-*.tar.gz
- name: Cleanup bin
run: rm -f build/bin/*
linux-arm:
name: Linux Build (arm)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install cross toolchain
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
sudo ln -s /usr/include/asm-generic /usr/include/asm
- name: Build (arm64)
run: |
go run build/ci.go install -static -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
- name: Create archive (arm64)
run: |
go run build/ci.go archive -arch arm64 -type tar
- name: Upload artifacts (arm64)
uses: actions/upload-artifact@v4
with:
name: bera-geth-linux-arm64-archives
path: |
bera-geth-linux-arm64-*.tar.gz
bera-geth-alltools-linux-arm64-*.tar.gz
- name: Cleanup bin
run: rm -fr build/bin/*
draft-release:
name: Draft Release
needs: [extract-version, linux-intel, linux-arm]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # This is necessary for generating the changelog
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Generate full changelog
id: changelog
run: |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create release draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Debug: Show what was downloaded
echo "Contents of artifacts directory:"
ls -la ./artifacts/ || echo "Artifacts directory not found"
# Move all artifacts to current directory
if [ -d "./artifacts" ]; then
find ./artifacts -name "*.tar.gz" -exec mv {} . \;
else
echo "Warning: No artifacts directory found"
fi
# List available files for debugging
echo "Available files:"
ls -la *.tar.gz || echo "No tar.gz files found"
# Get actual archive names
GETH_AMD64=$(ls bera-geth-linux-amd64-*.tar.gz 2>/dev/null | grep -v alltools | head -1)
GETH_ARM64=$(ls bera-geth-linux-arm64-*.tar.gz 2>/dev/null | grep -v alltools | head -1)
GETH_ALLTOOLS_AMD64=$(ls bera-geth-alltools-linux-amd64-*.tar.gz 2>/dev/null | head -1)
GETH_ALLTOOLS_ARM64=$(ls bera-geth-alltools-linux-arm64-*.tar.gz 2>/dev/null | head -1)
echo "Found archives:"
echo " AMD64: ${GETH_AMD64:-NOT FOUND}"
echo " ARM64: ${GETH_ARM64:-NOT FOUND}"
echo " Alltools AMD64: ${GETH_ALLTOOLS_AMD64:-NOT FOUND}"
echo " Alltools ARM64: ${GETH_ALLTOOLS_ARM64:-NOT FOUND}"
# For tag builds, use the actual tag
RELEASE_TAG="${{ env.VERSION }}"
echo "Release tag: $RELEASE_TAG"
echo "GitHub ref: ${{ github.ref }}"
echo "GitHub SHA: ${{ github.sha }}"
# The tag should already exist since it triggered this workflow
# We just need to ensure gh release uses it correctly
body=$(cat <<- 'ENDBODY'
![image](https://raw.githubusercontent.com/berachain/bera-geth/main/.github/meta/bera-geth.png)
## Summary
Add a summary, including:
- Critical bug fixes
- New features
- Any breaking changes (and what to expect)
## Update Priority
This table provides priorities for which classes of users should update particular components.
| User Class | Priority |
|----------------------|-----------------|
| Payload Builders | <TODO> |
| Non-Payload Builders | <TODO> |
## All Changes
${{ steps.changelog.outputs.CHANGELOG }}
## Binaries
| System | Architecture | Binary | Notes |
|:---:|:---:|:---:|:---|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [GETH_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_AMD64_PLACEHOLDER) | Most Linux systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [GETH_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ARM64_PLACEHOLDER) | 64-bit ARM systems |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [GETH_ALLTOOLS_AMD64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ALLTOOLS_AMD64_PLACEHOLDER) | All tools bundle (amd64) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [GETH_ALLTOOLS_ARM64_PLACEHOLDER](https://github.com/${{ github.repository }}/releases/download/RELEASE_TAG_PLACEHOLDER/GETH_ALLTOOLS_ARM64_PLACEHOLDER) | All tools bundle (arm64) |
| **System** | **Option** | - | **Resource** |
| <img src="https://simpleicons.org/icons/docker.svg" style="width: 32px;"/> | Docker | | [ghcr.io/berachain/bera-geth](https://ghcr.io/berachain/bera-geth) |
### Installation
The archives contain the geth binary and license file. Extract and run:
```bash
tar -xzf GETH_AMD64_PLACEHOLDER
./geth
```
The **alltools** archives additionally contain:
- `abigen` - Source code generator for Ethereum contracts
- `evm` - Developer utility for the Ethereum Virtual Machine
- `rlpdump` - Developer utility for RLP data
- `clef` - Ethereum account management tool
ENDBODY
)
# Replace placeholders with actual filenames and release tag
body="${body//GETH_AMD64_PLACEHOLDER/$GETH_AMD64}"
body="${body//GETH_ARM64_PLACEHOLDER/$GETH_ARM64}"
body="${body//GETH_ALLTOOLS_AMD64_PLACEHOLDER/$GETH_ALLTOOLS_AMD64}"
body="${body//GETH_ALLTOOLS_ARM64_PLACEHOLDER/$GETH_ALLTOOLS_ARM64}"
body="${body//RELEASE_TAG_PLACEHOLDER/$RELEASE_TAG}"
# Create assets array for gh release
assets=()
for asset in bera-geth-*.tar.gz; do
if [ -f "$asset" ]; then
assets+=("$asset")
fi
done
# Create the release with the actual tag
# Using --target with GITHUB_SHA ensures we create the release at the right commit
echo "$body" | gh release create "$RELEASE_TAG" \
--draft \
--title "Bera Geth $RELEASE_TAG" \
-F - \
"${assets[@]}"

22
CHANGELOG.md Normal file
View file

@ -0,0 +1,22 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.TBD.0]
### Added
- Add support for the Berachain mainnet (`--berachain`) and Bepolia networks
(`--bepolia`)
- Add support for configuring the Prague1 fork on Berachain networks.
### Changed
- BRIP-2: Allowed configuration of the `MinimumBaseFeeWei`. For Berachain, this will be set as 1 gwei. (https://github.com/berachain/bera-geth/pull/2)
- BRIP-2: Allowed configuration of the `BaseFeeChangeDenominator`. For Berachain, this will be set as 48 (a 6x increase corresponding to 6x faster block times). (https://github.com/berachain/bera-geth/pull/2)
- [WIP] Updated release GH workflow to publish tarballs and push built images to GHCR.
- Removed support for appveyor, gitea, travis, circleci.

145
CLAUDE.md Normal file
View file

@ -0,0 +1,145 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is **bera-geth**, Berachain's fork of go-ethereum that implements the Berachain blockchain network. Key differences from upstream:
- **Custom base fee mechanism**: 1 gwei minimum with 6x faster adjustments via Prague1 fork
- **Networks**: Berachain mainnet (Chain ID 80094) and Bepolia testnet (Chain ID 80069)
- **Optimized for faster block times** while maintaining Ethereum compatibility
## Development Commands
### Building
```bash
make geth # Build main geth binary
make all # Build all executables
make evm # Build EVM utility
```
### Testing
```bash
make test # Run all tests
go test ./path/to/package # Run specific package tests
go test -run TestName # Run specific test
```
### Code Quality
```bash
make lint # Run linters
make fmt # Format code with gofmt
```
### Development Tools
```bash
make devtools # Install development dependencies
```
### Cleaning
```bash
make clean # Clean build artifacts
```
## Codebase Architecture
### Core Components
**Core Blockchain Logic** (`/core/`)
- `blockchain.go` - Main blockchain state management
- `state_processor.go` - Transaction execution
- `types/` - Core data structures (blocks, transactions, receipts)
- `vm/` - Ethereum Virtual Machine implementation
- `txpool/` - Transaction pool management
**Consensus Layer** (`/consensus/`)
- `beacon/` - Proof-of-stake consensus (primary)
- `misc/eip1559/` - Base fee calculation with Berachain modifications
- `clique/` - Proof-of-authority for testing
**Network Protocol** (`/eth/`)
- `backend.go` - Main Ethereum service
- `downloader/` - Block/state synchronization
- `protocols/` - Network protocol handlers
**P2P Networking** (`/p2p/`)
- `discover/` - Node discovery protocols
- `rlpx/` - Encrypted communication
### Key Entry Points
**Main Binary**: `/cmd/geth/main.go`
- CLI application setup
- Network selection logic
- Node initialization
**Other Executables**: `/cmd/`
- `clef/` - Account management
- `abigen/` - ABI binding generator
- `evm/` - Standalone EVM executor
### Configuration Management
**Chain Configs**: `/params/config.go`
- Network parameters and fork schedules
- Berachain/Bepolia network definitions
- Prague1 fork configuration
**Network Discovery**: `/params/bootnodes.go`
- Bootstrap nodes for peer discovery
### Berachain-Specific Modifications
**Base Fee Changes** (`/consensus/misc/eip1559/eip1559.go:116-121`)
- Prague1 fork enforces 1 gwei minimum base fee
- BaseFeeChangeDenominator set to 48 (6x faster adjustment)
**Network Configurations** (`/params/config.go:77-99, 107-129`)
- BerachainChainConfig with Chain ID 80094
- BepoliaChainConfig with Chain ID 80069
- Custom Prague1 fork activation parameters
### Test Organization
Tests follow Go conventions with `*_test.go` files alongside source code:
- Unit tests in package directories
- Integration tests in `/tests/`
- Consensus tests for Ethereum specification compliance
- EVM operation tests in `/core/vm/testdata/`
### Build System
**Primary Build**: `/build/ci.go`
- Cross-platform compilation
- Docker image building
- Release packaging
**Simple Builds**: `/Makefile`
- Development-focused targets
- Requires Go 1.23+ and C compiler
## Development Workflow
1. **Architecture Understanding**: The codebase follows Ethereum's layered architecture (consensus → state → networking → application)
2. **Testing Strategy**: Always run tests after changes with `make test`
3. **Code Style**: Use `make fmt` and `make lint` before committing
4. **Network Testing**: Use `--bepolia` flag for testnet development
5. **Debugging**: Use `./build/bin/geth --help` for comprehensive CLI options
## Network-Specific Usage
### Berachain Mainnet
```bash
./build/bin/geth --berachain
```
### Bepolia Testnet
```bash
./build/bin/geth --bepolia
```
### Development Mode
```bash
./build/bin/geth --dev
```

View file

@ -9,18 +9,18 @@ FROM golang:1.24-alpine AS builder
RUN apk add --no-cache gcc musl-dev linux-headers git RUN apk add --no-cache gcc musl-dev linux-headers git
# Get dependencies - will also be cached if we won't change go.mod/go.sum # Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/ COPY go.mod /bera-geth/
COPY go.sum /go-ethereum/ COPY go.sum /bera-geth/
RUN cd /go-ethereum && go mod download RUN cd /bera-geth && go mod download
ADD . /go-ethereum ADD . /bera-geth
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth RUN cd /bera-geth && go run build/ci.go install -static ./cmd/geth
# Pull Geth into a second stage deploy alpine container # Pull Geth into a second stage deploy alpine container
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/ COPY --from=builder /bera-geth/build/bin/geth /usr/local/bin/
EXPOSE 8545 8546 30303 30303/udp EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"] ENTRYPOINT ["geth"]

View file

@ -9,25 +9,25 @@ FROM golang:1.24-alpine AS builder
RUN apk add --no-cache gcc musl-dev linux-headers git RUN apk add --no-cache gcc musl-dev linux-headers git
# Get dependencies - will also be cached if we won't change go.mod/go.sum # Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/ COPY go.mod /bera-geth/
COPY go.sum /go-ethereum/ COPY go.sum /bera-geth/
RUN cd /go-ethereum && go mod download RUN cd /bera-geth && go mod download
ADD . /go-ethereum ADD . /bera-geth
# This is not strictly necessary, but it matches the "Dockerfile" steps, thus # This is not strictly necessary, but it matches the "Dockerfile" steps, thus
# makes it so that under certain circumstances, the docker layer can be cached, # makes it so that under certain circumstances, the docker layer can be cached,
# and the builder can jump to the next (build all) command, with the go cache fully loaded. # and the builder can jump to the next (build all) command, with the go cache fully loaded.
# #
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth RUN cd /bera-geth && go run build/ci.go install -static ./cmd/geth
RUN cd /go-ethereum && go run build/ci.go install -static RUN cd /bera-geth && go run build/ci.go install -static
# Pull all binaries into a second stage deploy alpine container # Pull all binaries into a second stage deploy alpine container
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/ COPY --from=builder /bera-geth/build/bin/* /usr/local/bin/
EXPOSE 8545 8546 30303 30303/udp EXPOSE 8545 8546 30303 30303/udp

View file

@ -1,59 +0,0 @@
clone_depth: 5
version: "{branch}.{build}"
image:
- Ubuntu
- Visual Studio 2019
environment:
matrix:
- GETH_ARCH: amd64
GETH_MINGW: 'C:\msys64\mingw64'
- GETH_ARCH: 386
GETH_MINGW: 'C:\msys64\mingw32'
install:
- git submodule update --init --depth 1 --recursive
- go version
for:
# Linux has its own script without -arch and -cc.
# The linux builder also runs lint.
- matrix:
only:
- image: Ubuntu
build_script:
- go run build/ci.go lint
- go run build/ci.go check_generate
- go run build/ci.go check_baddeps
- go run build/ci.go install -dlgo
test_script:
- go run build/ci.go test -dlgo -short
# linux/386 is disabled.
- matrix:
exclude:
- image: Ubuntu
GETH_ARCH: 386
# Windows builds for amd64 + 386.
- matrix:
only:
- image: Visual Studio 2019
environment:
# We use gcc from MSYS2 because it is the most recent compiler version available on
# AppVeyor. Note: gcc.exe only works properly if the corresponding bin/ directory is
# contained in PATH.
GETH_CC: '%GETH_MINGW%\bin\gcc.exe'
PATH: '%GETH_MINGW%\bin;C:\Program Files (x86)\NSIS\;%PATH%'
build_script:
- 'echo %GETH_ARCH%'
- 'echo %GETH_CC%'
- '%GETH_CC% --version'
- go run build/ci.go install -dlgo -arch %GETH_ARCH% -cc %GETH_CC%
after_build:
# Upload builds. Note that ci.go makes this a no-op PR builds.
- go run build/ci.go archive -arch %GETH_ARCH% -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go nsis -arch %GETH_ARCH% -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
test_script:
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short

View file

@ -572,9 +572,9 @@ func doArchive(cmdline []string) {
var ( var (
env = build.Env() env = build.Env()
basegeth = archiveBasename(*arch, version.Archive(env.Commit)) basegeth = archiveBasename(*arch, version.Archive(env.Tag, env.Commit))
geth = "geth-" + basegeth + ext geth = "bera-geth-" + basegeth + ext
alltools = "geth-alltools-" + basegeth + ext alltools = "bera-geth-alltools-" + basegeth + ext
) )
maybeSkipArchive(env) maybeSkipArchive(env)
if err := build.WriteArchive(geth, gethArchiveFiles); err != nil { if err := build.WriteArchive(geth, gethArchiveFiles); err != nil {
@ -650,17 +650,17 @@ func maybeSkipArchive(env build.Environment) {
log.Printf("skipping archive creation because this is a PR build") log.Printf("skipping archive creation because this is a PR build")
os.Exit(0) os.Exit(0)
} }
if env.Branch != "master" && !strings.HasPrefix(env.Tag, "v1.") { if env.Branch != "main" && !strings.HasPrefix(env.Tag, "v1.") {
log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag) log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
os.Exit(0) os.Exit(0)
} }
} }
// Builds the docker images and optionally uploads them to Docker Hub. // Builds the docker images and optionally uploads them to GHCR.
func doDockerBuildx(cmdline []string) { func doDockerBuildx(cmdline []string) {
var ( var (
platform = flag.String("platform", "", `Push a multi-arch docker image for the specified architectures (usually "linux/amd64,linux/arm64")`) platform = flag.String("platform", "", `Push a multi-arch docker image for the specified architectures (usually "linux/amd64,linux/arm64")`)
hubImage = flag.String("hub", "ethereum/client-go", `Where to upload the docker image`) hubImage = flag.String("hub", "ghcr.io/berachain/bera-geth", `Where to upload the docker image`)
upload = flag.Bool("upload", false, `Whether to trigger upload`) upload = flag.Bool("upload", false, `Whether to trigger upload`)
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
@ -679,21 +679,17 @@ func doDockerBuildx(cmdline []string) {
build.MustRun(auther) build.MustRun(auther)
} }
// Retrieve the version infos to build and push to the following paths: // Retrieve the version infos to build and push to the following paths:
// - ethereum/client-go:latest - Pushes to the master branch, Geth only // - ethereum/client-go:latest - Pushes to the main branch, Geth only
// - ethereum/client-go:stable - Version tag publish on GitHub, Geth only // - ethereum/client-go:alltools-latest - Pushes to the main branch, Geth & tools
// - ethereum/client-go:alltools-latest - Pushes to the master branch, Geth & tools
// - ethereum/client-go:alltools-stable - Version tag publish on GitHub, Geth & tools
// - ethereum/client-go:release-<major>.<minor> - Version tag publish on GitHub, Geth only
// - ethereum/client-go:alltools-release-<major>.<minor> - Version tag publish on GitHub, Geth & tools
// - ethereum/client-go:v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth only // - ethereum/client-go:v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth only
// - ethereum/client-go:alltools-v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth & tools // - ethereum/client-go:alltools-v<major>.<minor>.<patch> - Version tag publish on GitHub, Geth & tools
var tags []string var tags []string
switch { switch {
case env.Branch == "master": case env.Branch == "main":
tags = []string{"latest"} tags = []string{"latest"}
case strings.HasPrefix(env.Tag, "v1."): case strings.HasPrefix(env.Tag, "v1."):
tags = []string{"stable", fmt.Sprintf("release-%v", version.Family), "v" + version.Semantic} tags = []string{env.Tag}
} }
// Need to create a mult-arch builder // Need to create a mult-arch builder
check := exec.Command("docker", "buildx", "inspect", "multi-arch-builder") check := exec.Command("docker", "buildx", "inspect", "multi-arch-builder")
@ -1097,7 +1093,7 @@ func doWindowsInstaller(cmdline []string) {
if env.Commit != "" { if env.Commit != "" {
ver[2] += "-" + env.Commit[:8] ver[2] += "-" + env.Commit[:8]
} }
installer, err := filepath.Abs("geth-" + archiveBasename(*arch, version.Archive(env.Commit)) + ".exe") installer, err := filepath.Abs("geth-" + archiveBasename(*arch, version.Archive(env.Tag, env.Commit)) + ".exe")
if err != nil { if err != nil {
log.Fatalf("Failed to convert installer file path: %v", err) log.Fatalf("Failed to convert installer file path: %v", err)
} }

View file

@ -1,32 +0,0 @@
machine:
services:
- docker
dependencies:
cache_directories:
- "~/.ethash" # Cache the ethash DAG generated by hive for consecutive builds
- "~/.docker" # Cache all docker images manually to avoid lengthy rebuilds
override:
# Restore all previously cached docker images
- mkdir -p ~/.docker
- for img in `ls ~/.docker`; do docker load -i ~/.docker/$img; done
# Pull in and hive, restore cached ethash DAGs and do a dry run
- go get -u github.com/karalabe/hive
- (cd ~/.go_workspace/src/github.com/karalabe/hive && mkdir -p workspace/ethash/ ~/.ethash)
- (cd ~/.go_workspace/src/github.com/karalabe/hive && cp -r ~/.ethash/. workspace/ethash/)
- (cd ~/.go_workspace/src/github.com/karalabe/hive && hive --docker-noshell --client=NONE --test=. --sim=. --loglevel=6)
# Cache all the docker images and the ethash DAGs
- for img in `docker images | grep -v "^<none>" | tail -n +2 | awk '{print $1}'`; do docker save $img > ~/.docker/`echo $img | tr '/' ':'`.tar; done
- cp -r ~/.go_workspace/src/github.com/karalabe/hive/workspace/ethash/. ~/.ethash
test:
override:
# Build Geth and move into a known folder
- make geth
- cp ./build/bin/geth $HOME/geth
# Run hive and move all generated logs into the public artifacts folder
- (cd ~/.go_workspace/src/github.com/karalabe/hive && hive --docker-noshell --client=go-ethereum:local --override=$HOME/geth --test=. --sim=.)
- cp -r ~/.go_workspace/src/github.com/karalabe/hive/workspace/logs/* $CIRCLE_ARTIFACTS

View file

@ -236,6 +236,10 @@ func ethFilter(args []string) (nodeFilter, error) {
filter = forkid.NewStaticFilter(params.HoleskyChainConfig, core.DefaultHoleskyGenesisBlock().ToBlock()) filter = forkid.NewStaticFilter(params.HoleskyChainConfig, core.DefaultHoleskyGenesisBlock().ToBlock())
case "hoodi": case "hoodi":
filter = forkid.NewStaticFilter(params.HoodiChainConfig, core.DefaultHoodiGenesisBlock().ToBlock()) filter = forkid.NewStaticFilter(params.HoodiChainConfig, core.DefaultHoodiGenesisBlock().ToBlock())
case "berachain":
filter = forkid.NewStaticFilter(params.BerachainChainConfig, core.DefaultBerachainGenesisBlock().ToBlock())
case "bepolia":
filter = forkid.NewStaticFilter(params.BepoliaChainConfig, core.DefaultBepoliaGenesisBlock().ToBlock())
default: default:
return nil, fmt.Errorf("unknown network %q", args[0]) return nil, fmt.Errorf("unknown network %q", args[0])
} }

View file

@ -479,6 +479,10 @@ func importHistory(ctx *cli.Context) error {
network = "holesky" network = "holesky"
case ctx.Bool(utils.HoodiFlag.Name): case ctx.Bool(utils.HoodiFlag.Name):
network = "hoodi" network = "hoodi"
case ctx.Bool(utils.BerachainFlag.Name):
network = "berachain"
case ctx.Bool(utils.BepoliaFlag.Name):
network = "bepolia"
} }
} else { } else {
// No network flag set, try to determine network based on files // No network flag set, try to determine network based on files
@ -715,6 +719,10 @@ func downloadEra(ctx *cli.Context) error {
case ctx.IsSet(utils.MainnetFlag.Name): case ctx.IsSet(utils.MainnetFlag.Name):
case ctx.IsSet(utils.SepoliaFlag.Name): case ctx.IsSet(utils.SepoliaFlag.Name):
network = "sepolia" network = "sepolia"
case ctx.IsSet(utils.BerachainFlag.Name):
network = "berachain"
case ctx.IsSet(utils.BepoliaFlag.Name):
network = "bepolia"
default: default:
return fmt.Errorf("unsupported network, no known era1 checksums") return fmt.Errorf("unsupported network, no known era1 checksums")
} }

View file

@ -285,6 +285,9 @@ func main() {
func prepare(ctx *cli.Context) { func prepare(ctx *cli.Context) {
// If we're running a known preset, log it for convenience. // If we're running a known preset, log it for convenience.
switch { switch {
case ctx.IsSet(utils.MainnetFlag.Name):
log.Info("Starting Geth on Berachain mainnet...")
case ctx.IsSet(utils.SepoliaFlag.Name): case ctx.IsSet(utils.SepoliaFlag.Name):
log.Info("Starting Geth on Sepolia testnet...") log.Info("Starting Geth on Sepolia testnet...")
@ -294,15 +297,20 @@ func prepare(ctx *cli.Context) {
case ctx.IsSet(utils.HoodiFlag.Name): case ctx.IsSet(utils.HoodiFlag.Name):
log.Info("Starting Geth on Hoodi testnet...") log.Info("Starting Geth on Hoodi testnet...")
case !ctx.IsSet(utils.NetworkIdFlag.Name): case ctx.IsSet(utils.BepoliaFlag.Name):
log.Info("Starting Geth on Ethereum mainnet...") log.Info("Starting Geth on Bepolia testnet...")
case !ctx.IsSet(utils.NetworkIdFlag.Name), ctx.IsSet(utils.BerachainFlag.Name):
log.Info("Starting Geth on Berachain mainnet...")
} }
// If we're a full node on mainnet without --cache specified, bump default cache allowance
// If we're a full node on Berachain mainnet without --cache specified, bump default cache allowance
if !ctx.IsSet(utils.CacheFlag.Name) && !ctx.IsSet(utils.NetworkIdFlag.Name) { if !ctx.IsSet(utils.CacheFlag.Name) && !ctx.IsSet(utils.NetworkIdFlag.Name) {
// Make sure we're not on any supported preconfigured testnet either // Make sure we're not on any supported preconfigured testnet either
if !ctx.IsSet(utils.HoleskyFlag.Name) && if !ctx.IsSet(utils.HoleskyFlag.Name) &&
!ctx.IsSet(utils.SepoliaFlag.Name) && !ctx.IsSet(utils.SepoliaFlag.Name) &&
!ctx.IsSet(utils.HoodiFlag.Name) && !ctx.IsSet(utils.HoodiFlag.Name) &&
!ctx.IsSet(utils.BepoliaFlag.Name) &&
!ctx.IsSet(utils.DeveloperFlag.Name) { !ctx.IsSet(utils.DeveloperFlag.Name) {
// Nope, we're really on mainnet. Bump that cache up! // Nope, we're really on mainnet. Bump that cache up!
log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096) log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096)

View file

@ -139,7 +139,7 @@ var (
} }
NetworkIdFlag = &cli.Uint64Flag{ NetworkIdFlag = &cli.Uint64Flag{
Name: "networkid", Name: "networkid",
Usage: "Explicitly set network id (integer)(For testnets: use --sepolia, --holesky, --hoodi instead)", Usage: "Explicitly set network id (integer)(Testnet: use --bepolia)(For Ethereum: use --mainnet, --sepolia, etc.)",
Value: ethconfig.Defaults.NetworkId, Value: ethconfig.Defaults.NetworkId,
Category: flags.EthCategory, Category: flags.EthCategory,
} }
@ -163,6 +163,17 @@ var (
Usage: "Hoodi network: pre-configured proof-of-stake test network", Usage: "Hoodi network: pre-configured proof-of-stake test network",
Category: flags.EthCategory, Category: flags.EthCategory,
} }
// Berachain
BerachainFlag = &cli.BoolFlag{
Name: "berachain",
Usage: "Berachain mainnet",
Category: flags.EthCategory,
}
BepoliaFlag = &cli.BoolFlag{
Name: "bepolia",
Usage: "Bepolia network: pre-configured proof-of-stake test network",
Category: flags.EthCategory,
}
// Dev mode // Dev mode
DeveloperFlag = &cli.BoolFlag{ DeveloperFlag = &cli.BoolFlag{
Name: "dev", Name: "dev",
@ -449,7 +460,7 @@ var (
// Performance tuning settings // Performance tuning settings
CacheFlag = &cli.IntFlag{ CacheFlag = &cli.IntFlag{
Name: "cache", Name: "cache",
Usage: "Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode)", Usage: "Megabytes of memory allocated to internal caching (default = 4096 berachain mainnet full node, 128 light mode)",
Value: 1024, Value: 1024,
Category: flags.PerfCategory, Category: flags.PerfCategory,
} }

View file

@ -37,6 +37,8 @@ var (
Flags: []cli.Flag{ Flags: []cli.Flag{
testSepoliaFlag, testSepoliaFlag,
testMainnetFlag, testMainnetFlag,
testBepoliaFlag,
testBerachainFlag,
filterQueryFileFlag, filterQueryFileFlag,
filterErrorFileFlag, filterErrorFileFlag,
}, },

View file

@ -85,6 +85,16 @@ var (
Usage: "Use test cases for mainnet network", Usage: "Use test cases for mainnet network",
Category: flags.TestingCategory, Category: flags.TestingCategory,
} }
testBepoliaFlag = &cli.BoolFlag{
Name: "bepolia",
Usage: "Use test cases for bepolia network",
Category: flags.TestingCategory,
}
testBerachainFlag = &cli.BoolFlag{
Name: "berachain",
Usage: "Use test cases for berachain mainnet network",
Category: flags.TestingCategory,
}
) )
// testConfig holds the parameters for testing. // testConfig holds the parameters for testing.
@ -117,10 +127,13 @@ func validateHistoryPruneErr(err error, blockNum uint64, historyPruneBlock *uint
return err return err
} }
// TODO(bera): Add test filter & history queries for Berachain mainnet & Bepolia in queries/ folder
func testConfigFromCLI(ctx *cli.Context) (cfg testConfig) { func testConfigFromCLI(ctx *cli.Context) (cfg testConfig) {
flags.CheckExclusive(ctx, testMainnetFlag, testSepoliaFlag) flags.CheckExclusive(ctx, testMainnetFlag, testSepoliaFlag, testBerachainFlag, testBepoliaFlag)
if (ctx.IsSet(testMainnetFlag.Name) || ctx.IsSet(testSepoliaFlag.Name)) && ctx.IsSet(filterQueryFileFlag.Name) { if (ctx.IsSet(testMainnetFlag.Name) || ctx.IsSet(testSepoliaFlag.Name) || ctx.IsSet(testBerachainFlag.Name) || ctx.IsSet(testBepoliaFlag.Name)) &&
exit(filterQueryFileFlag.Name + " cannot be used with " + testMainnetFlag.Name + " or " + testSepoliaFlag.Name) ctx.IsSet(filterQueryFileFlag.Name) {
exit(filterQueryFileFlag.Name + " cannot be used with " + testMainnetFlag.Name + " or " +
testSepoliaFlag.Name + "or" + testBerachainFlag.Name + " or " + testBepoliaFlag.Name)
} }
// configure ethclient // configure ethclient
@ -142,6 +155,20 @@ func testConfigFromCLI(ctx *cli.Context) (cfg testConfig) {
cfg.historyPruneBlock = new(uint64) cfg.historyPruneBlock = new(uint64)
*cfg.historyPruneBlock = history.PrunePoints[params.SepoliaGenesisHash].BlockNumber *cfg.historyPruneBlock = history.PrunePoints[params.SepoliaGenesisHash].BlockNumber
cfg.traceTestFile = "queries/trace_sepolia.json" cfg.traceTestFile = "queries/trace_sepolia.json"
case ctx.Bool(testBerachainFlag.Name):
cfg.fsys = builtinTestFiles
cfg.filterQueryFile = "queries/filter_queries_berachain.json"
cfg.historyTestFile = "queries/history_berachain.json"
cfg.historyPruneBlock = new(uint64)
*cfg.historyPruneBlock = history.PrunePoints[params.BerachainGenesisHash].BlockNumber
cfg.traceTestFile = "queries/trace_berachain.json"
case ctx.Bool(testBepoliaFlag.Name):
cfg.fsys = builtinTestFiles
cfg.filterQueryFile = "queries/filter_queries_bepolia.json"
cfg.historyTestFile = "queries/history_bepolia.json"
cfg.historyPruneBlock = new(uint64)
*cfg.historyPruneBlock = history.PrunePoints[params.BepoliaGenesisHash].BlockNumber
cfg.traceTestFile = "queries/trace_bepolia.json"
default: default:
cfg.fsys = os.DirFS(".") cfg.fsys = os.DirFS(".")
cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name) cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)

View file

@ -54,6 +54,21 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
// CalcBaseFee calculates the basefee of the header. // CalcBaseFee calculates the basefee of the header.
func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
calculatedBaseFee := calcBaseFee(config, parent)
// Starting at the Prague1 fork, the base fee must be at least the minimum base fee.
if config.IsPrague1(parent.Number, parent.Time) {
minBaseFee := new(big.Int).SetUint64(config.Berachain.Prague1.MinimumBaseFeeWei)
if calculatedBaseFee.Cmp(minBaseFee) < 0 {
calculatedBaseFee = minBaseFee
}
}
return calculatedBaseFee
}
// calcBaseFee calculates the basefee of the header in wei.
func calcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
// If the current block is the first EIP-1559 block, return the InitialBaseFee. // If the current block is the first EIP-1559 block, return the InitialBaseFee.
if !config.IsLondon(parent.Number) { if !config.IsLondon(parent.Number) {
return new(big.Int).SetUint64(params.InitialBaseFee) return new(big.Int).SetUint64(params.InitialBaseFee)
@ -76,7 +91,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
num.SetUint64(parent.GasUsed - parentGasTarget) num.SetUint64(parent.GasUsed - parentGasTarget)
num.Mul(num, parent.BaseFee) num.Mul(num, parent.BaseFee)
num.Div(num, denom.SetUint64(parentGasTarget)) num.Div(num, denom.SetUint64(parentGasTarget))
num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator())) num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator(parent.Number, parent.Time)))
if num.Cmp(common.Big1) < 0 { if num.Cmp(common.Big1) < 0 {
return num.Add(parent.BaseFee, common.Big1) return num.Add(parent.BaseFee, common.Big1)
} }
@ -87,7 +102,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
num.SetUint64(parentGasTarget - parent.GasUsed) num.SetUint64(parentGasTarget - parent.GasUsed)
num.Mul(num, parent.BaseFee) num.Mul(num, parent.BaseFee)
num.Div(num, denom.SetUint64(parentGasTarget)) num.Div(num, denom.SetUint64(parentGasTarget))
num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator())) num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator(parent.Number, parent.Time)))
baseFee := num.Sub(parent.BaseFee, num) baseFee := num.Sub(parent.BaseFee, num)
if baseFee.Cmp(common.Big0) < 0 { if baseFee.Cmp(common.Big0) < 0 {

View file

@ -223,6 +223,10 @@ func getGenesisState(db ethdb.Database, blockhash common.Hash) (alloc types.Gene
genesis = DefaultHoleskyGenesisBlock() genesis = DefaultHoleskyGenesisBlock()
case params.HoodiGenesisHash: case params.HoodiGenesisHash:
genesis = DefaultHoodiGenesisBlock() genesis = DefaultHoodiGenesisBlock()
case params.BerachainGenesisHash:
genesis = DefaultBerachainGenesisBlock()
case params.BepoliaGenesisHash:
genesis = DefaultBepoliaGenesisBlock()
} }
if genesis != nil { if genesis != nil {
return genesis.Alloc, nil return genesis.Alloc, nil
@ -438,6 +442,10 @@ func (g *Genesis) chainConfigOrDefault(ghash common.Hash, stored *params.ChainCo
return params.SepoliaChainConfig return params.SepoliaChainConfig
case ghash == params.HoodiGenesisHash: case ghash == params.HoodiGenesisHash:
return params.HoodiChainConfig return params.HoodiChainConfig
case ghash == params.BerachainGenesisHash:
return params.BerachainChainConfig
case ghash == params.BepoliaGenesisHash:
return params.BepoliaChainConfig
default: default:
return stored return stored
} }
@ -644,6 +652,32 @@ func DefaultHoodiGenesisBlock() *Genesis {
} }
} }
// DefaultBerachainGenesisBlock returns the Berachain main net genesis block.
func DefaultBerachainGenesisBlock() *Genesis {
return &Genesis{
Config: params.BerachainChainConfig,
Nonce: 0x1234,
ExtraData: []byte{},
GasLimit: 0x1c9c380,
Difficulty: big.NewInt(0x01),
Timestamp: 1737381600,
Alloc: decodePrealloc(berachainAllocData),
}
}
// DefaultBepoliaGenesisBlock returns the Bepolia network genesis block.
func DefaultBepoliaGenesisBlock() *Genesis {
return &Genesis{
Config: params.BepoliaChainConfig,
Nonce: 0x1234,
ExtraData: []byte{},
GasLimit: 0x1c9c380,
Difficulty: big.NewInt(0x01),
Timestamp: 1739976735,
Alloc: decodePrealloc(bepoliaAllocData),
}
}
// DeveloperGenesisBlock returns the 'geth --dev' genesis block. // DeveloperGenesisBlock returns the 'geth --dev' genesis block.
func DeveloperGenesisBlock(gasLimit uint64, faucet *common.Address) *Genesis { func DeveloperGenesisBlock(gasLimit uint64, faucet *common.Address) *Genesis {
// Override the default period to the user requested one // Override the default period to the user requested one

File diff suppressed because one or more lines are too long

View file

@ -84,6 +84,15 @@ func testSetupGenesis(t *testing.T, scheme string) {
wantHash: params.MainnetGenesisHash, wantHash: params.MainnetGenesisHash,
wantConfig: params.MainnetChainConfig, wantConfig: params.MainnetChainConfig,
}, },
{
name: "berachain block in DB, genesis == nil",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
DefaultBerachainGenesisBlock().MustCommit(db, triedb.NewDatabase(db, newDbConfig(scheme)))
return SetupGenesisBlock(db, triedb.NewDatabase(db, newDbConfig(scheme)), nil)
},
wantHash: params.BerachainGenesisHash,
wantConfig: params.BerachainChainConfig,
},
{ {
name: "custom block in DB, genesis == nil", name: "custom block in DB, genesis == nil",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) { fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
@ -103,6 +112,15 @@ func testSetupGenesis(t *testing.T, scheme string) {
}, },
wantErr: &GenesisMismatchError{Stored: customghash, New: params.SepoliaGenesisHash}, wantErr: &GenesisMismatchError{Stored: customghash, New: params.SepoliaGenesisHash},
}, },
{
name: "custom block in DB, genesis == bepolia",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
tdb := triedb.NewDatabase(db, newDbConfig(scheme))
customg.Commit(db, tdb)
return SetupGenesisBlock(db, tdb, DefaultBepoliaGenesisBlock())
},
wantErr: &GenesisMismatchError{Stored: customghash, New: params.BepoliaGenesisHash},
},
{ {
name: "custom block in DB, genesis == hoodi", name: "custom block in DB, genesis == hoodi",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) { fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
@ -188,6 +206,8 @@ func TestGenesisHashes(t *testing.T) {
{DefaultSepoliaGenesisBlock(), params.SepoliaGenesisHash}, {DefaultSepoliaGenesisBlock(), params.SepoliaGenesisHash},
{DefaultHoleskyGenesisBlock(), params.HoleskyGenesisHash}, {DefaultHoleskyGenesisBlock(), params.HoleskyGenesisHash},
{DefaultHoodiGenesisBlock(), params.HoodiGenesisHash}, {DefaultHoodiGenesisBlock(), params.HoodiGenesisHash},
{DefaultBerachainGenesisBlock(), params.BerachainGenesisHash},
{DefaultBepoliaGenesisBlock(), params.BepoliaGenesisHash},
} { } {
// Test via MustCommit // Test via MustCommit
db := rawdb.NewMemoryDatabase() db := rawdb.NewMemoryDatabase()

View file

@ -47,7 +47,7 @@ var FullNodeGPO = gasprice.Config{
IgnorePrice: gasprice.DefaultIgnorePrice, IgnorePrice: gasprice.DefaultIgnorePrice,
} }
// Defaults contains default settings for use on the Ethereum main net. // Defaults contains default settings for use on the Ethereum and Berachain main net.
var Defaults = Config{ var Defaults = Config{
HistoryMode: history.KeepAll, HistoryMode: history.KeepAll,
SyncMode: SnapSync, SyncMode: SnapSync,

View file

@ -98,6 +98,14 @@ func Env() Environment {
isPR := os.Getenv("GITHUB_HEAD_REF") != "" isPR := os.Getenv("GITHUB_HEAD_REF") != ""
tag := "" tag := ""
branch := "" branch := ""
if reftype == "" {
gref := os.Getenv("GITHUB_REF")
if strings.HasPrefix(gref, "refs/heads/") {
reftype = "branch"
} else if strings.HasPrefix(gref, "refs/tags/") {
reftype = "tag"
}
}
switch { switch {
case isPR: case isPR:
branch = os.Getenv("GITHUB_BASE_REF") branch = os.Getenv("GITHUB_BASE_REF")
@ -106,6 +114,18 @@ func Env() Environment {
case reftype == "tag": case reftype == "tag":
tag = os.Getenv("GITHUB_REF_NAME") tag = os.Getenv("GITHUB_REF_NAME")
} }
// Fallback: If tag or branch is still empty, derive from GITHUB_REF.
if tag == "" && branch == "" {
if gref := os.Getenv("GITHUB_REF"); gref != "" {
if strings.HasPrefix(gref, "refs/tags/") {
tag = strings.TrimPrefix(gref, "refs/tags/")
} else if strings.HasPrefix(gref, "refs/heads/") {
branch = strings.TrimPrefix(gref, "refs/heads/")
}
}
}
return Environment{ return Environment{
CI: true, CI: true,
Name: "github-actions", Name: "github-actions",
@ -126,7 +146,7 @@ func Env() Environment {
// LocalEnv returns build environment metadata gathered from git. // LocalEnv returns build environment metadata gathered from git.
func LocalEnv() Environment { func LocalEnv() Environment {
env := applyEnvFlags(Environment{Name: "local", Repo: "ethereum/go-ethereum"}) env := applyEnvFlags(Environment{Name: "local", Repo: "berachain/bera-geth"})
head := readGitFile("HEAD") head := readGitFile("HEAD")
if fields := strings.Fields(head); len(fields) == 2 { if fields := strings.Fields(head); len(fields) == 2 {

View file

@ -57,8 +57,8 @@ func WithCommit(gitCommit, gitDate string) string {
// Archive holds the textual version string used for Geth archives. e.g. // Archive holds the textual version string used for Geth archives. e.g.
// "1.8.11-dea1ce05" for stable releases, or "1.8.13-unstable-21c059b6" for unstable // "1.8.11-dea1ce05" for stable releases, or "1.8.13-unstable-21c059b6" for unstable
// releases. // releases.
func Archive(gitCommit string) string { func Archive(tag, gitCommit string) string {
vsn := Semantic vsn := tag
if version.Meta != "stable" { if version.Meta != "stable" {
vsn += "-" + version.Meta vsn += "-" + version.Meta
} }

View file

@ -32,6 +32,10 @@ var (
HoleskyGenesisHash = common.HexToHash("0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4") HoleskyGenesisHash = common.HexToHash("0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4")
SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9") SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
HoodiGenesisHash = common.HexToHash("0xbbe312868b376a3001692a646dd2d7d1e4406380dfd86b98aa8a34d1557c971b") HoodiGenesisHash = common.HexToHash("0xbbe312868b376a3001692a646dd2d7d1e4406380dfd86b98aa8a34d1557c971b")
// Berachain
BerachainGenesisHash = common.HexToHash("0xd57819422128da1c44339fc7956662378c17e2213e669b427ac91cd11dfcfb38")
BepoliaGenesisHash = common.HexToHash("0x0207661de38f0e54ba91c8286096e72486784c79dc6a9681fc486b38335c042f")
) )
func newUint64(val uint64) *uint64 { return &val } func newUint64(val uint64) *uint64 { return &val }
@ -158,6 +162,80 @@ var (
Prague: DefaultPragueBlobConfig, Prague: DefaultPragueBlobConfig,
}, },
} }
// BerachainChainConfig is the chain parameters to run a node on the Berachain network.
BerachainChainConfig = &ChainConfig{
ChainID: big.NewInt(80094),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: big.NewInt(0),
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
PragueTime: newUint64(1749056400),
DepositContractAddress: common.HexToAddress("0x4242424242424242424242424242424242424242"),
Ethash: new(EthashConfig),
BlobScheduleConfig: &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Prague: DefaultBerachainPragueBlobConfig,
},
Berachain: BerachainConfig{
Prague1: Prague1Config{
Time: newUint64(999999999999999),
MinimumBaseFeeWei: 1000000000, // 1 gwei
BaseFeeChangeDenominator: 48, // 6x increase from the default
},
},
}
// BepoliaChainConfig contains the chain parameters to run a node on the Bepolia test network.
BepoliaChainConfig = &ChainConfig{
ChainID: big.NewInt(80069),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: big.NewInt(0),
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
PragueTime: newUint64(1746633600),
DepositContractAddress: common.HexToAddress("0x4242424242424242424242424242424242424242"),
Ethash: new(EthashConfig),
BlobScheduleConfig: &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Prague: DefaultBerachainPragueBlobConfig,
},
Berachain: BerachainConfig{
Prague1: Prague1Config{
Time: newUint64(999999999999999),
MinimumBaseFeeWei: 1000000000, // 1 gwei
BaseFeeChangeDenominator: 48, // 6x increase from the default
},
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced // AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus. // and accepted by the Ethereum core developers into the Ethash consensus.
AllEthashProtocolChanges = &ChainConfig{ AllEthashProtocolChanges = &ChainConfig{
@ -353,6 +431,13 @@ var (
Max: 9, Max: 9,
UpdateFraction: 5007716, UpdateFraction: 5007716,
} }
// DefaultBerachainPragueBlobConfig is the default blob configuration for the Prague fork
// on Berachain networks.
DefaultBerachainPragueBlobConfig = &BlobConfig{
Target: 3,
Max: 6,
UpdateFraction: 3338477,
}
// DefaultOsakaBlobConfig is the default blob configuration for the Osaka fork. // DefaultOsakaBlobConfig is the default blob configuration for the Osaka fork.
DefaultOsakaBlobConfig = &BlobConfig{ DefaultOsakaBlobConfig = &BlobConfig{
Target: 6, Target: 6,
@ -435,6 +520,46 @@ type ChainConfig struct {
Ethash *EthashConfig `json:"ethash,omitempty"` Ethash *EthashConfig `json:"ethash,omitempty"`
Clique *CliqueConfig `json:"clique,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"`
BlobScheduleConfig *BlobScheduleConfig `json:"blobSchedule,omitempty"` BlobScheduleConfig *BlobScheduleConfig `json:"blobSchedule,omitempty"`
// Berachain config
Berachain BerachainConfig `json:"berachain,omitempty"`
}
// BerachainConfig is the berachain config.
type BerachainConfig struct {
// Prague1 fork values.
Prague1 Prague1Config `json:"prague1,omitempty"`
}
// String implements the stringer interface.
func (o *BerachainConfig) String() string {
banner := "berachain"
if o.Prague1.Time != nil {
banner += fmt.Sprintf("(%s)", o.Prague1)
}
return banner
}
// Prague1Config is the config values for the Prague1 fork on Berachain.
type Prague1Config struct {
// Time is the time of the Prague1 fork.
Time *uint64 `json:"time,omitempty"` // Prague1 switch time (0 = already on prague1, nil = no fork)
// BaseFeeChangeDenominator is the base fee change denominator.
BaseFeeChangeDenominator uint64 `json:"baseFeeChangeDenominator,omitempty"`
// MinimumBaseFeeWei is the minimum base fee in wei.
MinimumBaseFeeWei uint64 `json:"minimumBaseFeeWei,omitempty"`
}
// String implements the stringer interface.
func (c Prague1Config) String() string {
banner := "prague1"
if c.Time != nil {
banner += fmt.Sprintf(
"(time: %v, baseFeeChangeDenominator: %v, minimumBaseFeeWei: %v)",
*c.Time, c.BaseFeeChangeDenominator, c.MinimumBaseFeeWei,
)
}
return banner
} }
// EthashConfig is the consensus engine configs for proof-of-work based sealing. // EthashConfig is the consensus engine configs for proof-of-work based sealing.
@ -525,6 +650,9 @@ func (c *ChainConfig) Description() string {
if c.PragueTime != nil { if c.PragueTime != nil {
banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime) banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime)
} }
if c.Berachain.Prague1.Time != nil {
banner += fmt.Sprintf(" - Prague1: @%-10v\n", *c.Berachain.Prague1.Time)
}
if c.OsakaTime != nil { if c.OsakaTime != nil {
banner += fmt.Sprintf(" - Osaka: @%-10v\n", *c.OsakaTime) banner += fmt.Sprintf(" - Osaka: @%-10v\n", *c.OsakaTime)
} }
@ -644,6 +772,12 @@ func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.PragueTime, time) return c.IsLondon(num) && isTimestampForked(c.PragueTime, time)
} }
// IsPrague1 returns whether time is either equal to the Prague1 fork time or greater.
// NOTE: Prague1 is a Berachain fork and must be on Ethereum's Prague fork.
func (c *ChainConfig) IsPrague1(num *big.Int, time uint64) bool {
return c.IsPrague(num, time) && isTimestampForked(c.Berachain.Prague1.Time, time)
}
// IsOsaka returns whether time is either equal to the Osaka fork time or greater. // IsOsaka returns whether time is either equal to the Osaka fork time or greater.
func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool { func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time) return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time)
@ -727,6 +861,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "shanghaiTime", timestamp: c.ShanghaiTime}, {name: "shanghaiTime", timestamp: c.ShanghaiTime},
{name: "cancunTime", timestamp: c.CancunTime, optional: true}, {name: "cancunTime", timestamp: c.CancunTime, optional: true},
{name: "pragueTime", timestamp: c.PragueTime, optional: true}, {name: "pragueTime", timestamp: c.PragueTime, optional: true},
{name: "prague1Time", timestamp: c.Berachain.Prague1.Time, optional: true},
{name: "osakaTime", timestamp: c.OsakaTime, optional: true}, {name: "osakaTime", timestamp: c.OsakaTime, optional: true},
{name: "verkleTime", timestamp: c.VerkleTime, optional: true}, {name: "verkleTime", timestamp: c.VerkleTime, optional: true},
} { } {
@ -872,6 +1007,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) { if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) {
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime) return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime)
} }
if isForkTimestampIncompatible(c.Berachain.Prague1.Time, newcfg.Berachain.Prague1.Time, headTimestamp) {
return newTimestampCompatError("Prague1 fork timestamp", c.Berachain.Prague1.Time, newcfg.Berachain.Prague1.Time)
}
if isForkTimestampIncompatible(c.OsakaTime, newcfg.OsakaTime, headTimestamp) { if isForkTimestampIncompatible(c.OsakaTime, newcfg.OsakaTime, headTimestamp) {
return newTimestampCompatError("Osaka fork timestamp", c.OsakaTime, newcfg.OsakaTime) return newTimestampCompatError("Osaka fork timestamp", c.OsakaTime, newcfg.OsakaTime)
} }
@ -882,7 +1020,12 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
} }
// BaseFeeChangeDenominator bounds the amount the base fee can change between blocks. // BaseFeeChangeDenominator bounds the amount the base fee can change between blocks.
func (c *ChainConfig) BaseFeeChangeDenominator() uint64 { func (c *ChainConfig) BaseFeeChangeDenominator(num *big.Int, time uint64) uint64 {
// Starting at the Prague1 fork, we use the Berachain base fee change denominator.
if c.IsPrague1(num, time) {
return c.Berachain.Prague1.BaseFeeChangeDenominator
}
return DefaultBaseFeeChangeDenominator return DefaultBaseFeeChangeDenominator
} }

View file

@ -39,6 +39,7 @@ const (
Shanghai Shanghai
Cancun Cancun
Prague Prague
Prague1
Osaka Osaka
) )
@ -71,5 +72,6 @@ var forkToString = map[Fork]string{
Shanghai: "Shanghai", Shanghai: "Shanghai",
Cancun: "Cancun", Cancun: "Cancun",
Prague: "Prague", Prague: "Prague",
Prague1: "Prague1",
Osaka: "Osaka", Osaka: "Osaka",
} }