chore(audit): address some minor nits (#37)

* chore(audit): address some minor nits

* lint
This commit is contained in:
Cal Bera 2025-07-28 11:38:25 -07:00 committed by GitHub
parent c5e00a6e5b
commit 3dc61aece5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 195 deletions

View file

@ -1,179 +0,0 @@
on:
push:
branches:
- "master"
tags:
- "v*"
workflow_dispatch:
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 }}
windows:
name: Windows Build
runs-on: "win-11"
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
# Note: gcc.exe only works properly if the corresponding bin/ directory is
# contained in PATH.
- name: "Build (amd64)"
shell: cmd
run: |
set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_MINGW%\bin\gcc.exe
env:
GETH_MINGW: 'C:\msys64\mingw64'
- name: "Build (386)"
shell: cmd
run: |
set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch 386 -cc %GETH_MINGW%\bin\gcc.exe
env:
GETH_MINGW: 'C:\msys64\mingw32'
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

View file

@ -93,13 +93,13 @@ func (tx *PoLTx) gas() uint64 { return tx.GasLimit }
func (tx *PoLTx) gasPrice() *big.Int { return tx.GasPrice } func (tx *PoLTx) gasPrice() *big.Int { return tx.GasPrice }
func (tx *PoLTx) gasTipCap() *big.Int { return tx.GasPrice } func (tx *PoLTx) gasTipCap() *big.Int { return tx.GasPrice }
func (tx *PoLTx) gasFeeCap() *big.Int { return tx.GasPrice } func (tx *PoLTx) gasFeeCap() *big.Int { return tx.GasPrice }
func (*PoLTx) value() *big.Int { return new(big.Int) } func (*PoLTx) value() *big.Int { return common.Big0 }
func (tx *PoLTx) nonce() uint64 { return tx.Nonce } func (tx *PoLTx) nonce() uint64 { return tx.Nonce }
func (tx *PoLTx) to() *common.Address { return &tx.To } func (tx *PoLTx) to() *common.Address { return &tx.To }
// No-op: PoLTx is originated from the system address and carries no signature. // No-op: PoLTx is originated from the system address and carries no signature.
func (*PoLTx) rawSignatureValues() (v, r, s *big.Int) { func (*PoLTx) rawSignatureValues() (v, r, s *big.Int) {
return nil, nil, nil return common.Big0, common.Big0, common.Big0
} }
func (*PoLTx) setSignatureValues(chainID, v, r, s *big.Int) { func (*PoLTx) setSignatureValues(chainID, v, r, s *big.Int) {

View file

@ -122,7 +122,7 @@ func TestPoLTx_RawSignatureValues(t *testing.T) {
t.Fatalf("failed to create PoL tx: %v", err) t.Fatalf("failed to create PoL tx: %v", err)
} }
v, r, s := tx.RawSignatureValues() v, r, s := tx.RawSignatureValues()
if v != nil || r != nil || s != nil { if v.Sign() != 0 || r.Sign() != 0 || s.Sign() != 0 {
t.Fatalf("expected nil signature values, have v=%v r=%v s=%v", v, r, s) t.Fatalf("expected 0 signature values, have v=%v r=%v s=%v", v, r, s)
} }
} }

View file

@ -279,7 +279,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3P11(update engine.ForkchoiceStateV1,
return engine.STATUS_INVALID, attributesErr("missing beacon root") return engine.STATUS_INVALID, attributesErr("missing beacon root")
case params.ProposerPubkey == nil: case params.ProposerPubkey == nil:
return engine.STATUS_INVALID, attributesErr("missing proposer pubkey") return engine.STATUS_INVALID, attributesErr("missing proposer pubkey")
case !api.checkFork(params.Timestamp, forks.Prague1): case !api.checkFork(params.Timestamp, forks.Prague1, forks.Osaka):
return engine.STATUS_INVALID, unsupportedForkErr("fcuV3P11 must only be called for prague1 payloads") return engine.STATUS_INVALID, unsupportedForkErr("fcuV3P11 must only be called for prague1 payloads")
} }
} }
@ -720,7 +720,7 @@ func (api *ConsensusAPI) NewPayloadV4P11(params engine.ExecutableData, versioned
return invalidStatus, paramsErr("nil executionRequests post-prague") return invalidStatus, paramsErr("nil executionRequests post-prague")
case proposerPubkey == nil: case proposerPubkey == nil:
return invalidStatus, paramsErr("nil proposerPubkey post-prague1") return invalidStatus, paramsErr("nil proposerPubkey post-prague1")
case !api.checkFork(params.Timestamp, forks.Prague1): case !api.checkFork(params.Timestamp, forks.Prague1, forks.Osaka):
return invalidStatus, unsupportedForkErr("newPayloadV4P11 must only be called for prague1 payloads") return invalidStatus, unsupportedForkErr("newPayloadV4P11 must only be called for prague1 payloads")
} }
requests := convertRequests(executionRequests) requests := convertRequests(executionRequests)

View file

@ -336,23 +336,20 @@ func (miner *Miner) commitBlobTransaction(env *environment, tx *types.Transactio
// applyTransaction runs the transaction. If execution fails, state and gas pool are reverted. // applyTransaction runs the transaction. If execution fails, state and gas pool are reverted.
func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*types.Receipt, error) { func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*types.Receipt, error) {
var ( var (
gasPool = env.gasPool
blockGasUsed = &env.header.GasUsed
snap = env.state.Snapshot() snap = env.state.Snapshot()
gasBefore uint64 gp = env.gasPool.Gas()
) )
// Berachain: PoL tx does not consume gas.
// Berachain: PoL tx does not consume any block gas.
blockGasUsed := &env.header.GasUsed
if tx.Type() == types.PoLTxType { if tx.Type() == types.PoLTxType {
gasPool = nil
blockGasUsed = new(uint64) blockGasUsed = new(uint64)
} }
if gasPool != nil {
gasBefore = gasPool.Gas()
}
receipt, err := core.ApplyTransaction(env.evm, env.gasPool, env.state, env.header, tx, blockGasUsed) receipt, err := core.ApplyTransaction(env.evm, env.gasPool, env.state, env.header, tx, blockGasUsed)
if err != nil { if err != nil {
env.state.RevertToSnapshot(snap) env.state.RevertToSnapshot(snap)
env.gasPool.SetGas(gasBefore) env.gasPool.SetGas(gp)
} }
return receipt, err return receipt, err
} }