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

core: add deneb as default #2734

Merged
merged 21 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Config options can be found in README here: https://github.com/golangci/golangci-lint-action
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck -show=stacks -test ./...
2 changes: 1 addition & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-python@v2
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: pre-commit/[email protected]

- name: notify failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fetch-depth: 0 # Disable shallow checkout
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- run: go run . --help > cli-reference.txt
- run: go run testutil/genchangelog/main.go
- uses: softprops/action-gh-release@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -78,7 +78,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
go-version: '1.21.5'

- name: "Verify PR"
run: go run github.com/obolnetwork/charon/testutil/verifypr
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 5m
go: "1.21.4"
go: "1.21.5"
linters-settings:
cyclop:
max-complexity: 15
Expand Down Expand Up @@ -99,7 +99,7 @@ linters-settings:
- "github.com/gogo/protobuf/proto" # Prefer google.golang.org/protobuf
- "github.com/prometheus/client_golang/prometheus/promauto" # Prefer ./app/promauto
staticcheck:
go: "1.21.4"
go: "1.21.5"
checks:
- "all"
- "-SA1019" # Ignoring since github.com/drand/kyber/sign/bls uses Proof Of Possession as does Ethereum.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Container for building Go binary.
FROM golang:1.21.4-bullseye AS builder
FROM golang:1.21.5-bullseye AS builder
# Install dependencies
RUN apt-get update && apt-get install -y build-essential git
# Prep and copy source
Expand Down
11 changes: 6 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
SyntheticBlockProposals bool
BuilderAPI bool
SimnetBMockFuzz bool
TestnetConfig eth2util.Network

TestConfig TestConfig
}
Expand Down Expand Up @@ -145,6 +146,10 @@
life.RegisterStop(lifecycle.StopPrivkeyLock, lifecycle.HookFuncMin(lockSvc.Close))
}

if conf.TestnetConfig.IsNonZero() {
eth2util.AddTestNetwork(conf.TestnetConfig)
}

Check warning on line 151 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L149-L151

Added lines #L149 - L151 were not covered by tests

if err := wireTracing(life, conf); err != nil {
return err
}
Expand Down Expand Up @@ -529,10 +534,6 @@
sched core.Scheduler, p2pKey *k1.PrivateKey, deadlineFunc func(duty core.Duty) (time.Time, bool),
mutableConf *mutableConfig,
) error {
if !featureset.Enabled(featureset.Priority) {
return nil
}

cons, ok := coreCons.(*consensus.Component)
if !ok {
// Priority protocol not supported for leader cast.
Expand Down Expand Up @@ -607,7 +608,7 @@
recaster.Subscribe(callback)
}

if !builderAPI || !featureset.Enabled(featureset.PreGenRegistrations) {
if !builderAPI {

Check warning on line 611 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L611

Added line #L611 was not covered by tests
return nil
}

Expand Down
58 changes: 57 additions & 1 deletion app/eth2wrap/synthproposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
eth2bellatrix "github.com/attestantio/go-eth2-client/api/v1/bellatrix"
eth2capella "github.com/attestantio/go-eth2-client/api/v1/capella"
eth2deneb "github.com/attestantio/go-eth2-client/api/v1/deneb"
eth2spec "github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/bellatrix"
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/deneb"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
shuffle "github.com/protolambda/eth2-shuffle"
"go.uber.org/zap"
Expand Down Expand Up @@ -197,6 +199,14 @@
proposal.Capella.ProposerIndex = vIdx
proposal.Capella.Body.ExecutionPayload.FeeRecipient = feeRecipient
proposal.Capella.Body.ExecutionPayload.Transactions = fraction(proposal.Capella.Body.ExecutionPayload.Transactions)
case eth2spec.DataVersionDeneb:
proposal.Deneb = &eth2deneb.BlockContents{}
proposal.Deneb.Block = signedBlock.Deneb.Message
proposal.Deneb.Block.Body.Graffiti = GetSyntheticGraffiti()
proposal.Deneb.Block.Slot = slot
proposal.Deneb.Block.ProposerIndex = vIdx
proposal.Deneb.Block.Body.ExecutionPayload.FeeRecipient = feeRecipient
proposal.Deneb.Block.Body.ExecutionPayload.Transactions = fraction(proposal.Deneb.Block.Body.ExecutionPayload.Transactions)

Check warning on line 209 in app/eth2wrap/synthproposer.go

View check run for this annotation

Codecov / codecov/patch

app/eth2wrap/synthproposer.go#L202-L209

Added lines #L202 - L209 were not covered by tests
default:
return nil, errors.New("unsupported proposal version")
}
Expand Down Expand Up @@ -274,6 +284,8 @@
graffiti = block.Bellatrix.Message.Body.Graffiti
case eth2spec.DataVersionCapella:
graffiti = block.Capella.Message.Body.Graffiti
case eth2spec.DataVersionDeneb:
graffiti = block.Deneb.SignedBlindedBlock.Message.Body.Graffiti

Check warning on line 288 in app/eth2wrap/synthproposer.go

View check run for this annotation

Codecov / codecov/patch

app/eth2wrap/synthproposer.go#L287-L288

Added lines #L287 - L288 were not covered by tests
default:
return false
}
Expand All @@ -293,6 +305,8 @@
graffiti = block.Bellatrix.Message.Body.Graffiti
case eth2spec.DataVersionCapella:
graffiti = block.Capella.Message.Body.Graffiti
case eth2spec.DataVersionDeneb:
graffiti = block.Deneb.SignedBlock.Message.Body.Graffiti

Check warning on line 309 in app/eth2wrap/synthproposer.go

View check run for this annotation

Codecov / codecov/patch

app/eth2wrap/synthproposer.go#L308-L309

Added lines #L308 - L309 were not covered by tests
default:
return false
}
Expand Down Expand Up @@ -543,7 +557,49 @@
},
},
}
default: // TODO(xenowits): Add a case for deneb blinded block
case eth2spec.DataVersionDeneb:
resp = &eth2api.VersionedBlindedProposal{
Version: proposal.Version,
Deneb: &eth2deneb.BlindedBeaconBlock{
Slot: proposal.Deneb.Block.Slot,
ProposerIndex: proposal.Deneb.Block.ProposerIndex,
ParentRoot: proposal.Deneb.Block.ParentRoot,
StateRoot: proposal.Deneb.Block.StateRoot,
Body: &eth2deneb.BlindedBeaconBlockBody{
RANDAOReveal: proposal.Deneb.Block.Body.RANDAOReveal,
ETH1Data: proposal.Deneb.Block.Body.ETH1Data,
Graffiti: proposal.Deneb.Block.Body.Graffiti,
ProposerSlashings: proposal.Deneb.Block.Body.ProposerSlashings,
AttesterSlashings: proposal.Deneb.Block.Body.AttesterSlashings,
Attestations: proposal.Deneb.Block.Body.Attestations,
Deposits: proposal.Deneb.Block.Body.Deposits,
VoluntaryExits: proposal.Deneb.Block.Body.VoluntaryExits,
SyncAggregate: proposal.Deneb.Block.Body.SyncAggregate,
ExecutionPayloadHeader: &deneb.ExecutionPayloadHeader{
ParentHash: proposal.Deneb.Block.Body.ExecutionPayload.ParentHash,
FeeRecipient: proposal.Deneb.Block.Body.ExecutionPayload.FeeRecipient,
StateRoot: proposal.Deneb.Block.Body.ExecutionPayload.StateRoot,
ReceiptsRoot: proposal.Deneb.Block.Body.ExecutionPayload.ReceiptsRoot,
LogsBloom: proposal.Deneb.Block.Body.ExecutionPayload.LogsBloom,
PrevRandao: proposal.Deneb.Block.Body.ExecutionPayload.PrevRandao,
BlockNumber: proposal.Deneb.Block.Body.ExecutionPayload.BlockNumber,
GasLimit: proposal.Deneb.Block.Body.ExecutionPayload.GasLimit,
GasUsed: proposal.Deneb.Block.Body.ExecutionPayload.GasUsed,
Timestamp: proposal.Deneb.Block.Body.ExecutionPayload.Timestamp,
ExtraData: proposal.Deneb.Block.Body.ExecutionPayload.ExtraData,
BaseFeePerGas: proposal.Deneb.Block.Body.ExecutionPayload.BaseFeePerGas,
BlockHash: proposal.Deneb.Block.Body.ExecutionPayload.BlockHash,
TransactionsRoot: eth2p0.Root{},
WithdrawalsRoot: eth2p0.Root{},
BlobGasUsed: proposal.Deneb.Block.Body.ExecutionPayload.BlobGasUsed,
ExcessBlobGas: proposal.Deneb.Block.Body.ExecutionPayload.ExcessBlobGas,
},
BLSToExecutionChanges: proposal.Deneb.Block.Body.BLSToExecutionChanges,
BlobKZGCommitments: proposal.Deneb.Block.Body.BlobKZGCommitments,
},
},
}
default:

Check warning on line 602 in app/eth2wrap/synthproposer.go

View check run for this annotation

Codecov / codecov/patch

app/eth2wrap/synthproposer.go#L560-L602

Added lines #L560 - L602 were not covered by tests
return nil, errors.New("unsupported blinded proposal version")
}

Expand Down
2 changes: 1 addition & 1 deletion app/eth2wrap/synthproposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestSynthProposer(t *testing.T) {
}
require.Equal(t, eth2spec.DataVersionCapella, block.Version)

signed := testutil.RandomVersionedSignedProposal()
signed := testutil.RandomCapellaVersionedSignedProposal()
signed.Capella.Message = block.Capella
err = eth2Cl.SubmitProposal(ctx, signed)
require.NoError(t, err)
Expand Down
8 changes: 1 addition & 7 deletions app/featureset/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestConfig(t *testing.T) {
})
require.NoError(t, err)

require.True(t, featureset.Enabled(featureset.QBFTConsensus))
require.True(t, featureset.Enabled(featureset.MockAlpha))
}

func TestEnableForT(t *testing.T) {
Expand All @@ -46,9 +46,3 @@ func TestEnableForT(t *testing.T) {
featureset.DisableForT(t, testFeature)
require.False(t, featureset.Enabled(testFeature))
}

func TestQBFT(t *testing.T) {
setup(t)

require.True(t, featureset.Enabled(featureset.QBFTConsensus))
}
23 changes: 2 additions & 21 deletions app/featureset/featureset.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,19 @@ const (
type Feature string

const (
// QBFTConsensus introduces qbft consensus, see https://github.com/ObolNetwork/charon/issues/445.
QBFTConsensus Feature = "qbft_consensus"
// Priority enables the infosync component using the priority protocol.
Priority Feature = "priority"
// MockAlpha is a mock feature in alpha status for testing.
MockAlpha Feature = "mock_alpha"

// RelayDiscovery enables relay peer discovery and disables discv5:
// - If a direct connection to a peer is not possible then try to connect to it via all the provided bootnodes/relays.
// - Direct connections are either not possible since no addresses are known or the addresses do not work.
// - When connected via relay, libp2p's identify protocol detects the remote peer's addresses.
// - Those are added to the peer store so libp2p will try to use them.
RelayDiscovery Feature = "relay_discovery"

// QBFTTimersABTest enables a round-robin mixed timer selection for A/B testing
// the affects of different round timers.
QBFTTimersABTest Feature = "qbft_timers_ab_test"

// PreGenRegistrations enables broadcasting of pre-generated registrations if present in the lock file
// and --builder-api=true.
PreGenRegistrations Feature = "pre_gen_registrations"
)

var (
// state defines the current rollout status of each feature.
state = map[Feature]status{
QBFTConsensus: statusStable,
Priority: statusStable,
MockAlpha: statusAlpha,
RelayDiscovery: statusStable,
QBFTTimersABTest: statusAlpha,
PreGenRegistrations: statusStable,
MockAlpha: statusAlpha,
QBFTTimersABTest: statusAlpha,
// Add all features and there status here.
}

Expand Down
3 changes: 2 additions & 1 deletion app/featureset/featureset_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
func TestAllFeatureStatus(t *testing.T) {
// Add all features to this test
features := []Feature{
QBFTConsensus,
MockAlpha,
QBFTTimersABTest,
}

for _, feature := range features {
Expand Down
Loading
Loading