mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Compare commits
12 Commits
db-hdiff
...
v6.0.3-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafef8c7c8 | ||
|
|
0b3289361c | ||
|
|
c4abdef874 | ||
|
|
64cbaec326 | ||
|
|
63a0641957 | ||
|
|
2737ace5a8 | ||
|
|
9e3d73c1c2 | ||
|
|
325ec97355 | ||
|
|
eea53eb6dc | ||
|
|
6f9a93ac89 | ||
|
|
93a5fdd8f3 | ||
|
|
0251fd78e9 |
48
CHANGELOG.md
48
CHANGELOG.md
@@ -4,6 +4,54 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
|
||||
|
||||
## [v6.0.1](https://github.com/prysmaticlabs/prysm/compare/v6.0.0...v6.0.1) - 2025-05-02
|
||||
|
||||
This release fixes two bugs related to the `payload_attributes` [event stream](https://ethereum.github.io/beacon-APIs/#/Events/eventstream). If you are using or planning to use this endpoint, upgrading to version 6.0.1 is mandatory.
|
||||
Also, a reminder: like other Beacon API endpoints, when a node is syncing, it may return historical data as `finalized` or `head`. Until the node is fully synced to the head of the chain, you should avoid using this data, depending on your application's needs.
|
||||
|
||||
We currently recommend against using the `--enable-beacon-rest-api` flag on Mainnet. As you may have noticed, we put a deprecation notice on our gRPC code, in particular on gRPC-related flags. The reason for this is that we want to eventually remove gRPC and have REST HTTP as the standard way of communication between the validator client and the beacon node. That being said, the REST option is still unstable and thus marked as experimental in the flag's description (the flag is `--enable-beacon-rest-api`). Therefore we encourage everyone to keep using gRPC, which is currently the default. It is fine to test the REST option on testnets, but doing it on Mainnet can lead to missing attestations and even missing blocks.
|
||||
|
||||
**Updating to v6.0.0 or later is required for Pectra Mainnet!**
|
||||
|
||||
This patch release has a few important fixes from v6.0.0. Updating to this release is encouraged.
|
||||
|
||||
### Added
|
||||
|
||||
- `UpgradeToFulu` spectests. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15190)
|
||||
- PeerDAS related KZG wrappers. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15186)
|
||||
- Add light client p2p broadcaster functions. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15175)
|
||||
- Added immediate broadcasting of proposer slashings when equivocating blocks are detected during block processing. [[PR]](https://github.com/prysmaticlabs/prysm/pull/14693)
|
||||
- Added 2 new errors: `HeadStateErr` and `ErrCouldNotVerifyBlockHeader`. [[PR]](https://github.com/prysmaticlabs/prysm/pull/14693)
|
||||
- Implement pending consolidations Beacon API endpoint. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15219)
|
||||
- PeerDAS: Add needed proto files and corresponding generated code. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15187)
|
||||
- Add light client p2p validator and subscriber functions. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15214)
|
||||
|
||||
### Changed
|
||||
|
||||
- Refactored internal function `reValidateSubscriptions` to `pruneSubscriptions` in `beacon-chain/sync/subscriber.go` for improved clarity, addressing a TODO comment. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15160)
|
||||
- Updated geth to v1.15.9. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15216)
|
||||
- Removed the slot from `UpdateDuties`. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15223)
|
||||
- Update hoodie bootnodes. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15240)
|
||||
|
||||
### Fixed
|
||||
|
||||
- avoid nondeterministic default fork value when generate genesis. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15151)
|
||||
- `UpgradeToFulu`. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15190)
|
||||
- fixed underflow with balances in leaking edge case with expected withdrawals. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15191)
|
||||
- Fixes our generated ssz files to have the correct package name. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15199)
|
||||
- Fixes our blob sidecar by root request lists for electra. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15209)
|
||||
- Ensure that the `payload_attributes` event has a consistent view of the head state by passing the head block in the event and using stategen to retrieve the corresponding state. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15213)
|
||||
- Pass parent context to update duties when dependent roots change. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15221)
|
||||
- Process slots across epoch for payload attribute event. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15228)
|
||||
- extend the payload attribute computation deadline to the beginning of the proposal slot. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15230)
|
||||
|
||||
### Security
|
||||
|
||||
- Fix CVE-2025-22869. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15204)
|
||||
- Fix CVE-2025-22870. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15204)
|
||||
- Fix CVE-2025-22872. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15204)
|
||||
- Fix CVE-2025-30204. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15204)
|
||||
|
||||
## [v6.0.0](https://github.com/prysmaticlabs/prysm/compare/v5.3.2...v6.0.0) - 2025-04-21
|
||||
|
||||
This release introduces Mainnet support for the upcoming Electra + Prague (Pectra) fork. The fork is scheduled for mainnet epoch 364032 (May 7, 2025, 10:05:11 UTC). You MUST update Prysm Beacon Node, Prysm Validator Client, and your execution layer client to the Pectra ready release prior to the fork to stay on the correct chain.
|
||||
|
||||
@@ -271,7 +271,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-JljxS/if/t0qvGWcf5CgsX+72fj90yGTg/uEgC56y7U=",
|
||||
integrity = "sha256-cI+DJe3BXlZ0lr28w3USi2lnYOUUfdi/YZ3nJuRiiYU=",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@@ -287,7 +287,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-NRba2h4zqb2LAXyDPglHTtkT4gVyuwpY708XmwXKXV8=",
|
||||
integrity = "sha256-eBLWqO/RdcqsANmA/rwkJ4kI+LCL+Q0RmIDq6z85lYQ=",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@@ -303,7 +303,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-hpbtKUbc3NHtVcUPk/Zm+Hn57G2ijI9qvXJwl9hc/tM=",
|
||||
integrity = "sha256-ab0H0WTzhSwYJ2a+GHVbUMoNRActJw18EmX3o5hhDi0",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
|
||||
@@ -14,22 +14,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
EventHead = "head"
|
||||
EventBlock = "block"
|
||||
EventAttestation = "attestation"
|
||||
EventVoluntaryExit = "voluntary_exit"
|
||||
EventBlsToExecutionChange = "bls_to_execution_change"
|
||||
EventProposerSlashing = "proposer_slashing"
|
||||
EventAttesterSlashing = "attester_slashing"
|
||||
EventFinalizedCheckpoint = "finalized_checkpoint"
|
||||
EventChainReorg = "chain_reorg"
|
||||
EventContributionAndProof = "contribution_and_proof"
|
||||
EventLightClientFinalityUpdate = "light_client_finality_update"
|
||||
EventLightClientOptimisticUpdate = "light_client_optimistic_update"
|
||||
EventPayloadAttributes = "payload_attributes"
|
||||
EventBlobSidecar = "blob_sidecar"
|
||||
EventError = "error"
|
||||
EventConnectionError = "connection_error"
|
||||
EventHead = "head"
|
||||
|
||||
EventError = "error"
|
||||
EventConnectionError = "connection_error"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
11
beacon-chain/cache/committee.go
vendored
11
beacon-chain/cache/committee.go
vendored
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
||||
"github.com/OffchainLabs/prysm/v6/container/slice"
|
||||
mathutil "github.com/OffchainLabs/prysm/v6/math"
|
||||
"github.com/OffchainLabs/prysm/v6/monitoring/tracing/trace"
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
@@ -104,11 +105,16 @@ func (c *CommitteeCache) CompressCommitteeCache() {
|
||||
// Committee fetches the shuffled indices by slot and committee index. Every list of indices
|
||||
// represent one committee. Returns true if the list exists with slot and committee index. Otherwise returns false, nil.
|
||||
func (c *CommitteeCache) Committee(ctx context.Context, slot primitives.Slot, seed [32]byte, index primitives.CommitteeIndex) ([]primitives.ValidatorIndex, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "committeeCache.Committee")
|
||||
defer span.End()
|
||||
span.SetAttributes(trace.Int64Attribute("slot", int64(slot)), trace.Int64Attribute("index", int64(index))) // lint:ignore uintcast -- OK for tracing.
|
||||
|
||||
if err := c.checkInProgress(ctx, seed); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
obj, exists := c.CommitteeCache.Get(key(seed))
|
||||
span.SetAttributes(trace.BoolAttribute("cache_hit", exists))
|
||||
if exists {
|
||||
CommitteeCacheHit.Inc()
|
||||
} else {
|
||||
@@ -157,11 +163,14 @@ func (c *CommitteeCache) AddCommitteeShuffledList(ctx context.Context, committee
|
||||
|
||||
// ActiveIndices returns the active indices of a given seed stored in cache.
|
||||
func (c *CommitteeCache) ActiveIndices(ctx context.Context, seed [32]byte) ([]primitives.ValidatorIndex, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "committeeCache.ActiveIndices")
|
||||
defer span.End()
|
||||
|
||||
if err := c.checkInProgress(ctx, seed); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
obj, exists := c.CommitteeCache.Get(key(seed))
|
||||
|
||||
span.SetAttributes(trace.BoolAttribute("cache_hit", exists))
|
||||
if exists {
|
||||
CommitteeCacheHit.Inc()
|
||||
} else {
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
||||
"github.com/OffchainLabs/prysm/v6/encoding/bytesutil"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
"github.com/OffchainLabs/prysm/v6/time/slots"
|
||||
"github.com/pkg/errors"
|
||||
@@ -240,16 +239,3 @@ func verifyBlobCommitmentCount(slot primitives.Slot, body interfaces.ReadOnlyBea
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBlockPayloadHash returns the hash of the execution payload of the block
|
||||
func GetBlockPayloadHash(blk interfaces.ReadOnlyBeaconBlock) ([32]byte, error) {
|
||||
var payloadHash [32]byte
|
||||
if IsPreBellatrixVersion(blk.Version()) {
|
||||
return payloadHash, nil
|
||||
}
|
||||
payload, err := blk.Body().Execution()
|
||||
if err != nil {
|
||||
return payloadHash, err
|
||||
}
|
||||
return bytesutil.ToBytes32(payload.BlockHash()), nil
|
||||
}
|
||||
|
||||
@@ -119,6 +119,9 @@ func attestationCommittees(
|
||||
|
||||
// BeaconCommittees returns the list of all beacon committees for a given state at a given slot.
|
||||
func BeaconCommittees(ctx context.Context, state state.ReadOnlyBeaconState, slot primitives.Slot) ([][]primitives.ValidatorIndex, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "helpers.BeaconCommittees")
|
||||
defer span.End()
|
||||
|
||||
epoch := slots.ToEpoch(slot)
|
||||
activeCount, err := ActiveValidatorCount(ctx, state, epoch)
|
||||
if err != nil {
|
||||
@@ -245,6 +248,9 @@ func BeaconCommittee(
|
||||
slot primitives.Slot,
|
||||
committeeIndex primitives.CommitteeIndex,
|
||||
) ([]primitives.ValidatorIndex, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "helpers.BeaconCommittee")
|
||||
defer span.End()
|
||||
|
||||
committee, err := committeeCache.Committee(ctx, slot, seed, committeeIndex)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not interface with committee cache")
|
||||
@@ -439,6 +445,9 @@ func CommitteeIndices(committeeBits bitfield.Bitfield) []primitives.CommitteeInd
|
||||
// UpdateCommitteeCache gets called at the beginning of every epoch to cache the committee shuffled indices
|
||||
// list with committee index and epoch number. It caches the shuffled indices for the input epoch.
|
||||
func UpdateCommitteeCache(ctx context.Context, state state.ReadOnlyBeaconState, e primitives.Epoch) error {
|
||||
ctx, span := trace.StartSpan(ctx, "committeeCache.UpdateCommitteeCache")
|
||||
defer span.End()
|
||||
|
||||
seed, err := Seed(state, e, params.BeaconConfig().DomainBeaconAttester)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -102,6 +102,9 @@ func checkValidatorSlashable(activationEpoch, withdrawableEpoch primitives.Epoch
|
||||
// """
|
||||
// return [ValidatorIndex(i) for i, v in enumerate(state.validators) if is_active_validator(v, epoch)]
|
||||
func ActiveValidatorIndices(ctx context.Context, s state.ReadOnlyBeaconState, epoch primitives.Epoch) ([]primitives.ValidatorIndex, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "helpers.ActiveValidatorIndices")
|
||||
defer span.End()
|
||||
|
||||
seed, err := Seed(s, epoch, params.BeaconConfig().DomainBeaconAttester)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get seed")
|
||||
|
||||
@@ -16,9 +16,6 @@ var ErrNotFoundOriginBlockRoot = errors.Wrap(ErrNotFound, "OriginBlockRoot")
|
||||
// ErrNotFoundGenesisBlockRoot means no genesis block root was found, indicating the db was not initialized with genesis
|
||||
var ErrNotFoundGenesisBlockRoot = errors.Wrap(ErrNotFound, "OriginGenesisRoot")
|
||||
|
||||
// ErrNotFoundBackfillBlockRoot is an error specifically for the origin block root getter
|
||||
var ErrNotFoundBackfillBlockRoot = errors.Wrap(ErrNotFound, "BackfillBlockRoot")
|
||||
|
||||
// ErrNotFoundFeeRecipient is a not found error specifically for the fee recipient getter
|
||||
var ErrNotFoundFeeRecipient = errors.Wrap(ErrNotFound, "fee recipient")
|
||||
|
||||
|
||||
@@ -479,6 +479,93 @@ func TestProcessETH2GenesisLog_CorrectNumOfDeposits(t *testing.T) {
|
||||
hook.Reset()
|
||||
}
|
||||
|
||||
func TestProcessLogs_DepositRequestsStarted(t *testing.T) {
|
||||
params.SetupTestConfigCleanup(t)
|
||||
hook := logTest.NewGlobal()
|
||||
testAcc, err := mock.Setup()
|
||||
require.NoError(t, err, "Unable to set up simulated backend")
|
||||
kvStore := testDB.SetupDB(t)
|
||||
depositCache, err := depositsnapshot.New()
|
||||
require.NoError(t, err)
|
||||
server, endpoint, err := mockExecution.SetupRPCServer()
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
server.Stop()
|
||||
})
|
||||
|
||||
web3Service, err := NewService(context.Background(),
|
||||
WithHttpEndpoint(endpoint),
|
||||
WithDepositContractAddress(testAcc.ContractAddr),
|
||||
WithDatabase(kvStore),
|
||||
WithDepositCache(depositCache),
|
||||
)
|
||||
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
|
||||
web3Service = setDefaultMocks(web3Service)
|
||||
web3Service.depositContractCaller, err = contracts.NewDepositContractCaller(testAcc.ContractAddr, testAcc.Backend.Client())
|
||||
require.NoError(t, err)
|
||||
web3Service.rpcClient = &mockExecution.RPCClient{Backend: testAcc.Backend}
|
||||
web3Service.httpLogger = testAcc.Backend.Client()
|
||||
web3Service.latestEth1Data.LastRequestedBlock = 0
|
||||
block, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
|
||||
require.NoError(t, err)
|
||||
web3Service.latestEth1Data.BlockHeight = block.NumberU64()
|
||||
web3Service.latestEth1Data.BlockTime = block.Time()
|
||||
bConfig := params.MinimalSpecConfig().Copy()
|
||||
bConfig.MinGenesisTime = 0
|
||||
bConfig.SecondsPerETH1Block = 1
|
||||
params.OverrideBeaconConfig(bConfig)
|
||||
nConfig := params.BeaconNetworkConfig()
|
||||
nConfig.ContractDeploymentBlock = 0
|
||||
params.OverrideBeaconNetworkConfig(nConfig)
|
||||
|
||||
testAcc.Backend.Commit()
|
||||
|
||||
totalNumOfDeposits := depositsReqForChainStart + 30
|
||||
|
||||
deposits, _, err := util.DeterministicDepositsAndKeys(uint64(totalNumOfDeposits))
|
||||
require.NoError(t, err)
|
||||
_, depositRoots, err := util.DeterministicDepositTrie(len(deposits))
|
||||
require.NoError(t, err)
|
||||
depositOffset := 5
|
||||
|
||||
// 64 Validators are used as size required for beacon-chain to start. This number
|
||||
// is defined in the deposit contract as the number required for the testnet. The actual number
|
||||
// is 2**14
|
||||
for i := 0; i < totalNumOfDeposits; i++ {
|
||||
data := deposits[i].Data
|
||||
testAcc.TxOpts.Value = mock.Amount32Eth()
|
||||
testAcc.TxOpts.GasLimit = 1000000
|
||||
_, err = testAcc.Contract.Deposit(testAcc.TxOpts, data.PublicKey, data.WithdrawalCredentials, data.Signature, depositRoots[i])
|
||||
require.NoError(t, err, "Could not deposit to deposit contract")
|
||||
// pack 8 deposits into a block with an offset of
|
||||
// 5
|
||||
if (i+1)%8 == depositOffset {
|
||||
testAcc.Backend.Commit()
|
||||
}
|
||||
}
|
||||
// Forward the chain to account for the follow distance
|
||||
for i := uint64(0); i < params.BeaconConfig().Eth1FollowDistance; i++ {
|
||||
testAcc.Backend.Commit()
|
||||
}
|
||||
b, err := testAcc.Backend.Client().BlockByNumber(context.Background(), nil)
|
||||
require.NoError(t, err)
|
||||
web3Service.latestEth1Data.BlockHeight = b.NumberU64()
|
||||
web3Service.latestEth1Data.BlockTime = b.Time()
|
||||
|
||||
// Set up our subscriber now to listen for the chain started event.
|
||||
stateChannel := make(chan *feed.Event, 1)
|
||||
stateSub := web3Service.cfg.stateNotifier.StateFeed().Subscribe(stateChannel)
|
||||
defer stateSub.Unsubscribe()
|
||||
|
||||
web3Service.depositRequestsStarted = true
|
||||
web3Service.initPOWService()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, int64(-1), web3Service.lastReceivedMerkleIndex, "Processed deposit logs even when requests are active")
|
||||
|
||||
hook.Reset()
|
||||
}
|
||||
|
||||
func TestProcessETH2GenesisLog_LargePeriodOfNoLogs(t *testing.T) {
|
||||
params.SetupTestConfigCleanup(t)
|
||||
hook := logTest.NewGlobal()
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/cache"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/cache/depositsnapshot"
|
||||
statefeed "github.com/OffchainLabs/prysm/v6/beacon-chain/core/feed/state"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/transition"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/db"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/execution/types"
|
||||
@@ -141,6 +142,7 @@ type config struct {
|
||||
type Service struct {
|
||||
connectedETH1 bool
|
||||
isRunning bool
|
||||
depositRequestsStarted bool
|
||||
processingLock sync.RWMutex
|
||||
latestEth1DataLock sync.RWMutex
|
||||
cfg *config
|
||||
@@ -205,7 +207,7 @@ func NewService(ctx context.Context, opts ...Option) (*Service, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
s.initDepositRequests()
|
||||
eth1Data, err := s.validPowchainData(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "unable to validate powchain data")
|
||||
@@ -463,7 +465,9 @@ func safelyHandlePanic() {
|
||||
func (s *Service) handleETH1FollowDistance() {
|
||||
defer safelyHandlePanic()
|
||||
ctx := s.ctx
|
||||
|
||||
if s.depositRequestsStarted {
|
||||
return
|
||||
}
|
||||
// use a 5 minutes timeout for block time, because the max mining time is 278 sec (block 7208027)
|
||||
// (analyzed the time of the block from 2018-09-01 to 2019-02-13)
|
||||
fiveMinutesTimeout := prysmTime.Now().Add(-5 * time.Minute)
|
||||
@@ -530,25 +534,27 @@ func (s *Service) initPOWService() {
|
||||
s.latestEth1Data.BlockTime = header.Time
|
||||
s.latestEth1DataLock.Unlock()
|
||||
|
||||
if err := s.processPastLogs(ctx); err != nil {
|
||||
err = errors.Wrap(err, "processPastLogs")
|
||||
s.retryExecutionClientConnection(ctx, err)
|
||||
errorLogger(
|
||||
err,
|
||||
"Unable to process past deposit contract logs, perhaps your execution client is not fully synced",
|
||||
)
|
||||
continue
|
||||
}
|
||||
// Cache eth1 headers from our voting period.
|
||||
if err := s.cacheHeadersForEth1DataVote(ctx); err != nil {
|
||||
err = errors.Wrap(err, "cacheHeadersForEth1DataVote")
|
||||
s.retryExecutionClientConnection(ctx, err)
|
||||
if errors.Is(err, errBlockTimeTooLate) {
|
||||
log.WithError(err).Debug("Unable to cache headers for execution client votes")
|
||||
} else {
|
||||
errorLogger(err, "Unable to cache headers for execution client votes")
|
||||
if !s.depositRequestsStarted {
|
||||
if err := s.processPastLogs(ctx); err != nil {
|
||||
err = errors.Wrap(err, "processPastLogs")
|
||||
s.retryExecutionClientConnection(ctx, err)
|
||||
errorLogger(
|
||||
err,
|
||||
"Unable to process past deposit contract logs, perhaps your execution client is not fully synced",
|
||||
)
|
||||
continue
|
||||
}
|
||||
// Cache eth1 headers from our voting period.
|
||||
if err := s.cacheHeadersForEth1DataVote(ctx); err != nil {
|
||||
err = errors.Wrap(err, "cacheHeadersForEth1DataVote")
|
||||
s.retryExecutionClientConnection(ctx, err)
|
||||
if errors.Is(err, errBlockTimeTooLate) {
|
||||
log.WithError(err).Debug("Unable to cache headers for execution client votes")
|
||||
} else {
|
||||
errorLogger(err, "Unable to cache headers for execution client votes")
|
||||
}
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
// Handle edge case with embedded genesis state by fetching genesis header to determine
|
||||
// its height.
|
||||
@@ -824,7 +830,7 @@ func (s *Service) validPowchainData(ctx context.Context) (*ethpb.ETH1ChainData,
|
||||
if genState == nil || genState.IsNil() {
|
||||
return eth1Data, nil
|
||||
}
|
||||
if eth1Data == nil || !eth1Data.ChainstartData.Chainstarted || !validateDepositContainers(eth1Data.DepositContainers) {
|
||||
if s.depositRequestsStarted || eth1Data == nil || !eth1Data.ChainstartData.Chainstarted || !validateDepositContainers(eth1Data.DepositContainers) {
|
||||
pbState, err := native.ProtobufBeaconStatePhase0(s.preGenesisState.ToProtoUnsafe())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -900,6 +906,15 @@ func (s *Service) removeStartupState() {
|
||||
s.cfg.finalizedStateAtStartup = nil
|
||||
}
|
||||
|
||||
func (s *Service) initDepositRequests() {
|
||||
fState := s.cfg.finalizedStateAtStartup
|
||||
isNil := fState == nil || fState.IsNil()
|
||||
if isNil {
|
||||
return
|
||||
}
|
||||
s.depositRequestsStarted = helpers.DepositRequestsStarted(fState)
|
||||
}
|
||||
|
||||
func newBlobVerifierFromInitializer(ini *verification.Initializer) verification.NewBlobVerifier {
|
||||
return func(b blocks.ROBlob, reqs []verification.Requirement) verification.BlobVerifier {
|
||||
return ini.NewBlobVerifier(b, reqs)
|
||||
|
||||
@@ -900,7 +900,7 @@ func (s *Service) beaconEndpoints(
|
||||
middleware: []middleware.Middleware{
|
||||
middleware.AcceptHeaderHandler([]string{api.JsonMediaType}),
|
||||
},
|
||||
handler: server.GetPendingDeposits,
|
||||
handler: server.GetPendingConsolidations,
|
||||
methods: []string{http.MethodGet},
|
||||
},
|
||||
{
|
||||
@@ -1253,7 +1253,7 @@ func (s *Service) prysmValidatorEndpoints(stater lookup.Stater, coreService *cor
|
||||
methods: []string{http.MethodPost},
|
||||
},
|
||||
{
|
||||
template: "/prysm/v1/validators/participation",
|
||||
template: "/prysm/v1/validators/{state_id}/participation",
|
||||
name: namespace + ".GetParticipation",
|
||||
middleware: []middleware.Middleware{
|
||||
middleware.AcceptHeaderHandler([]string{api.JsonMediaType}),
|
||||
@@ -1262,7 +1262,7 @@ func (s *Service) prysmValidatorEndpoints(stater lookup.Stater, coreService *cor
|
||||
methods: []string{http.MethodGet},
|
||||
},
|
||||
{
|
||||
template: "/prysm/v1/validators/active_set_changes",
|
||||
template: "/prysm/v1/validators/{state_id}/active_set_changes",
|
||||
name: namespace + ".GetActiveSetChanges",
|
||||
middleware: []middleware.Middleware{
|
||||
middleware.AcceptHeaderHandler([]string{api.JsonMediaType}),
|
||||
|
||||
@@ -133,10 +133,10 @@ func Test_endpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
prysmValidatorRoutes := map[string][]string{
|
||||
"/prysm/validators/performance": {http.MethodPost},
|
||||
"/prysm/v1/validators/performance": {http.MethodPost},
|
||||
"/prysm/v1/validators/participation": {http.MethodGet},
|
||||
"/prysm/v1/validators/active_set_changes": {http.MethodGet},
|
||||
"/prysm/validators/performance": {http.MethodPost},
|
||||
"/prysm/v1/validators/performance": {http.MethodPost},
|
||||
"/prysm/v1/validators/{state_id}/participation": {http.MethodGet},
|
||||
"/prysm/v1/validators/{state_id}/active_set_changes": {http.MethodGet},
|
||||
}
|
||||
|
||||
s := &Service{cfg: &Config{}}
|
||||
|
||||
@@ -751,9 +751,9 @@ func (s *Server) GetAttesterSlashingsV2(w http.ResponseWriter, r *http.Request)
|
||||
httputil.HandleError(w, "Could not get head state: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
var attStructs []interface{}
|
||||
sourceSlashings := s.SlashingsPool.PendingAttesterSlashings(ctx, headState, true /* return unlimited slashings */)
|
||||
|
||||
sourceSlashings := s.SlashingsPool.PendingAttesterSlashings(ctx, headState, true /* return unlimited slashings */)
|
||||
attStructs := make([]interface{}, 0, len(sourceSlashings))
|
||||
for _, slashing := range sourceSlashings {
|
||||
var attStruct interface{}
|
||||
if v >= version.Electra && slashing.Version() >= version.Electra {
|
||||
|
||||
@@ -1858,6 +1858,7 @@ func TestGetAttesterSlashings(t *testing.T) {
|
||||
// Unmarshal resp.Data into a slice of slashings
|
||||
var slashings []*structs.AttesterSlashingElectra
|
||||
require.NoError(t, json.Unmarshal(resp.Data, &slashings))
|
||||
require.NotNil(t, slashings)
|
||||
require.Equal(t, 0, len(slashings))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -678,187 +678,6 @@ const (
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}`
|
||||
|
||||
// BadBlindedBellatrixBlock contains wrong data to create a block that does not pass ToConsensus conversion
|
||||
// "parent_root" length too short
|
||||
// "block_hash" length too short
|
||||
// "state_root" length too short
|
||||
BadBlindedBellatrixBlock = `{
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e95872",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"body": {
|
||||
"randao_reveal": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"eth1_data": {
|
||||
"deposit_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"deposit_count": "1",
|
||||
"block_hash": "0xcf8e0d4e95872"
|
||||
},
|
||||
"graffiti": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"proposer_slashings": [
|
||||
{
|
||||
"signed_header_1": {
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"state_root": "0xcf8e0d4e9580f2",
|
||||
"body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signed_header_2": {
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
}
|
||||
],
|
||||
"attester_slashings": [
|
||||
{
|
||||
"attestation_1": {
|
||||
"attesting_indices": [
|
||||
"1"
|
||||
],
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"attestation_2": {
|
||||
"attesting_indices": [
|
||||
"1"
|
||||
],
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"attestations": [
|
||||
{
|
||||
"aggregation_bits": "0xffffffffffffffffffffffffffffffffff3f",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"deposits": [
|
||||
{
|
||||
"proof": [
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
],
|
||||
"data": {
|
||||
"pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
|
||||
"withdrawal_credentials": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"amount": "1",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
}
|
||||
],
|
||||
"voluntary_exits": [
|
||||
{
|
||||
"message": {
|
||||
"epoch": "1",
|
||||
"validator_index": "1"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
],
|
||||
"sync_aggregate": {
|
||||
"sync_committee_bits": "0x6451e9f951ebf05edc01de67e593484b672877054f055903ff0df1a1a945cf30ca26bb4d4b154f94a1bc776bcf5d0efb3603e1f9b8ee2499ccdcfe2a18cef458",
|
||||
"sync_committee_signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"execution_payload_header": {
|
||||
"parent_hash": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"fee_recipient": "0xabcf8e0d4e9587369b2301d0790347320302cc09",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"receipts_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"prev_randao": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"block_number": "1",
|
||||
"gas_limit": "1",
|
||||
"gas_used": "1",
|
||||
"timestamp": "1",
|
||||
"extra_data": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"base_fee_per_gas": "1",
|
||||
"block_hash": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"transactions_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}`
|
||||
CapellaBlock = `{
|
||||
"message": {
|
||||
"slot": "1",
|
||||
@@ -1056,208 +875,7 @@ const (
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}`
|
||||
// BadCapellaBlock contains wrong data to create a block that does not pass ToConsensus conversion
|
||||
// "state_root" length too short
|
||||
// "block_hash" length too short
|
||||
// "graffiti" length too short
|
||||
// "state_root" length too short
|
||||
BadCapellaBlock = `{
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"state_root": "0xcf8e0d4e957e8208d920f2",
|
||||
"body": {
|
||||
"randao_reveal": "0x1b66ac1fb663c9baf888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"eth1_data": {
|
||||
"deposit_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"deposit_count": "1",
|
||||
"block_hash": "0xcf8e0d4e95873691884560367e8208d920f2"
|
||||
},
|
||||
"graffiti": "0xcf8e0d4e9587369b230120f2",
|
||||
"proposer_slashings": [
|
||||
{
|
||||
"signed_header_1": {
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d208d920f2",
|
||||
"body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signed_header_2": {
|
||||
"message": {
|
||||
"slot": "1",
|
||||
"proposer_index": "1",
|
||||
"parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
}
|
||||
],
|
||||
"attester_slashings": [
|
||||
{
|
||||
"attestation_1": {
|
||||
"attesting_indices": [
|
||||
"1"
|
||||
],
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"attestation_2": {
|
||||
"attesting_indices": [
|
||||
"1"
|
||||
],
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"attestations": [
|
||||
{
|
||||
"aggregation_bits": "0xffffffffffffffffffffffffffffffffff3f",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"deposits": [
|
||||
{
|
||||
"proof": [
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
],
|
||||
"data": {
|
||||
"pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
|
||||
"withdrawal_credentials": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"amount": "1",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
}
|
||||
],
|
||||
"voluntary_exits": [
|
||||
{
|
||||
"message": {
|
||||
"epoch": "1",
|
||||
"validator_index": "1"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
],
|
||||
"sync_aggregate": {
|
||||
"sync_committee_bits": "0x6451e9f951ebf05edc01de67e593484b672877054f055903ff0df1a1a945cf30ca26bb4d4b154f94a1bc776bcf5d0efb3603e1f9b8ee2499ccdcfe2a18cef458",
|
||||
"sync_committee_signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"execution_payload": {
|
||||
"parent_hash": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"fee_recipient": "0xabcf8e0d4e9587369b2301d0790347320302cc09",
|
||||
"state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"receipts_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"prev_randao": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"block_number": "1",
|
||||
"gas_limit": "1",
|
||||
"gas_used": "1",
|
||||
"timestamp": "1",
|
||||
"extra_data": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"base_fee_per_gas": "14074904626401341155369551180448584754667373453244490859944217516317499064576",
|
||||
"block_hash": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"transactions": [
|
||||
"0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86"
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"index": "1",
|
||||
"validator_index": "1",
|
||||
"address": "0xabcf8e0d4e9587369b2301d0790347320302cc09",
|
||||
"amount": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"bls_to_execution_changes": [
|
||||
{
|
||||
"message": {
|
||||
"validator_index": "1",
|
||||
"from_bls_pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
|
||||
"to_execution_address": "0xabcf8e0d4e9587369b2301d0790347320302cc09"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}`
|
||||
|
||||
BlindedCapellaBlock = `{
|
||||
"message": {
|
||||
"slot": "1",
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
|
||||
- Add light client p2p broadcaster functions.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
|
||||
- Add light client p2p validator and subscriber functions.
|
||||
3
changelog/james-prysm_consistent-slashingv2-api.md
Normal file
3
changelog/james-prysm_consistent-slashingv2-api.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
|
||||
- Fixed /eth/v2/beacon/pool/attester_slashings no slashings returns empty array instead of nil.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Ignored
|
||||
|
||||
- update deprecation message for gRPC to be less scary.
|
||||
3
changelog/james-prysm_wrong-consolidation-handler.md
Normal file
3
changelog/james-prysm_wrong-consolidation-handler.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
|
||||
- fixed wrong handler for get pending consolidations endpoint.
|
||||
@@ -1,2 +0,0 @@
|
||||
### Fixed
|
||||
- Ensure that the `payload_attributes` event has a consistent view of the head state by passing the head block in the event and using stategen to retrieve the corresponding state.
|
||||
@@ -1,2 +0,0 @@
|
||||
### Fixed
|
||||
- extend the payload attribute computation deadline to the beginning of the proposal slot.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
- Added immediate broadcasting of proposer slashings when equivocating blocks are detected during block processing.
|
||||
- Added 2 new errors: `HeadStateErr` and `ErrCouldNotVerifyBlockHeader`
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
|
||||
- PeerDAS related KZG wrappers.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
|
||||
- PeerDAS: Add needed proto files and corresponding generated code.
|
||||
@@ -1,5 +0,0 @@
|
||||
### Added
|
||||
- `UpgradeToFulu` spectests.
|
||||
|
||||
### Fixed
|
||||
- `UpgradeToFulu`
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
|
||||
- avoid nondeterministic default fork value when generate genesis. [[PR]](https://github.com/prysmaticlabs/prysm/pull/15151)
|
||||
3
changelog/nisdas_disable_log_processing.md
Normal file
3
changelog/nisdas_disable_log_processing.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
|
||||
- Disable log processing after deposit requests are activated.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
|
||||
- Fixes our generated ssz files to have the correct package name.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
|
||||
- Fixes our blob sidecar by root request lists for electra.
|
||||
@@ -1,6 +0,0 @@
|
||||
### Security
|
||||
|
||||
- Fix CVE-2025-22869
|
||||
- Fix CVE-2025-22870
|
||||
- Fix CVE-2025-22872
|
||||
- Fix CVE-2025-30204
|
||||
@@ -1,3 +0,0 @@
|
||||
### Ignored
|
||||
|
||||
- Check for uninitialized duties on `checkDependentRoot`
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
|
||||
- Pass parent context to update duties when dependent roots change
|
||||
@@ -1,3 +0,0 @@
|
||||
### Ignored
|
||||
|
||||
- Add dependent roots in block events.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Changed
|
||||
|
||||
- Removed the slot from `UpdateDuties`.
|
||||
3
changelog/potuz_remove_unused_fieldparams.md
Normal file
3
changelog/potuz_remove_unused_fieldparams.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- Removed unusued fieldparams
|
||||
@@ -1,2 +0,0 @@
|
||||
### Changed
|
||||
- Refactored internal function `reValidateSubscriptions` to `pruneSubscriptions` in `beacon-chain/sync/subscriber.go` for improved clarity, addressing a TODO comment.
|
||||
3
changelog/pvl-release-6.0.1.md
Normal file
3
changelog/pvl-release-6.0.1.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- Release notes for v6.0.1
|
||||
3
changelog/pvl-spans.md
Normal file
3
changelog/pvl-spans.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
|
||||
- Added more tracing spans to various helpers related to GetDuties
|
||||
3
changelog/pvl-spectest-fix.md
Normal file
3
changelog/pvl-spectest-fix.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- Updated sha256 hashes for spectests at version v1.5.0. This was due to maintainers re-issuing the tar files to omit various empty directories.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Changed
|
||||
|
||||
- Updated geth to v1.15.9
|
||||
@@ -1,3 +0,0 @@
|
||||
### Ignored
|
||||
|
||||
- Updated changelog for v6.0.0 release
|
||||
3
changelog/radek_add-stateId-param.md
Normal file
3
changelog/radek_add-stateId-param.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
|
||||
- Fix Prysm endpoints `/prysm/v1/validators/{state_id}/participation` and `/prysm/v1/validators/{state_id}/active_set_changes` to properly handle `{state_id}`.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Added
|
||||
|
||||
- Implement pending consolidations Beacon API endpoint.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Changed
|
||||
|
||||
- Update hoodie bootnodes
|
||||
3
changelog/tt_eggplant.md
Normal file
3
changelog/tt_eggplant.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- ssz static spec tests for fulu
|
||||
3
changelog/tt_melon.md
Normal file
3
changelog/tt_melon.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- sanity and rewards spec tests for fulu
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
|
||||
- Process slots across epoch for payload attribute event.
|
||||
3
changelog/tt_sandwich.md
Normal file
3
changelog/tt_sandwich.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- Remove unused.
|
||||
3
changelog/tt_taco.md
Normal file
3
changelog/tt_taco.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- finality and merkle proof spec tests for fulu
|
||||
@@ -40,17 +40,7 @@ const (
|
||||
PendingDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
|
||||
PendingPartialWithdrawalsLimit = 134217728 // Maximum number of pending partial withdrawals in the beacon state.
|
||||
PendingConsolidationsLimit = 262144 // Maximum number of pending consolidations in the beacon state.
|
||||
MaxDepositRequestsPerPayload = 8192 // Maximum number of deposit requests in an execution payload.
|
||||
MaxWithdrawalRequestsPerPayload = 16 // Maximum number of execution layer withdrawal requests in an execution payload.
|
||||
MaxConsolidationRequestsPerPayload = 1 // Maximum number of consolidation requests in an execution payload.
|
||||
MaxProposerSlashings = 16 // Maximum number of proposer slashings in a block.
|
||||
MaxAttesterSlashings = 2 // Maximum number of attester slashings in a block.
|
||||
MaxAttesterSlashingsElectra = 1 // Maximum number of attester slashings in a block.
|
||||
MaxAttestations = 128 // Maximum number of attestations in a block.
|
||||
MaxAttestationsElectra = 8 // Maximum number of attestations in a block.
|
||||
MaxDeposits = 16 // Maximum number of deposits in a block.
|
||||
MaxVoluntaryExits = 16 // Maximum number of voluntary exits in a block.
|
||||
MaxBlsToExecutionChanges = 16 // Maximum number of bls to execution changes in a block.
|
||||
MaxRandomByte = uint64(1<<8 - 1) // MaxRandomByte defines max for a random byte using for proposer and sync committee sampling.
|
||||
MaxRandomValueElectra = uint64(1<<16 - 1) // MaxRandomValueElectra defines max for a random value using for proposer and sync committee sampling.
|
||||
)
|
||||
|
||||
@@ -40,17 +40,7 @@ const (
|
||||
PendingDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
|
||||
PendingPartialWithdrawalsLimit = 64 // Maximum number of pending partial withdrawals in the beacon state.
|
||||
PendingConsolidationsLimit = 64 // Maximum number of pending consolidations in the beacon state.
|
||||
MaxDepositRequestsPerPayload = 4 // Maximum number of deposit requests in an execution payload.
|
||||
MaxWithdrawalRequestsPerPayload = 2 // Maximum number of execution layer withdrawal requests in an execution payload.
|
||||
MaxConsolidationRequestsPerPayload = 1 // Maximum number of consolidation requests in an execution payload.
|
||||
MaxProposerSlashings = 16 // Maximum number of proposer slashings in a block.
|
||||
MaxAttesterSlashings = 2 // Maximum number of attester slashings in a block.
|
||||
MaxAttesterSlashingsElectra = 1 // Maximum number of attester slashings in a block.
|
||||
MaxAttestations = 128 // Maximum number of attestations in a block.
|
||||
MaxAttestationsElectra = 8 // Maximum number of attestations in a block.
|
||||
MaxDeposits = 16 // Maximum number of deposits in a block.
|
||||
MaxVoluntaryExits = 16 // Maximum number of voluntary exits in a block.
|
||||
MaxBlsToExecutionChanges = 16 // Maximum number of bls to execution changes in a block.
|
||||
MaxRandomByte = uint64(1<<8 - 1) // Maximum value for a random value using for proposer and sync committee sampling.
|
||||
MaxRandomValueElectra = uint64(1<<16 - 1) // Maximum value for a random value using for proposer and sync committee sampling.
|
||||
)
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
|
||||
const (
|
||||
payloadFieldIndex = 9
|
||||
bodyFieldIndex = 4
|
||||
)
|
||||
|
||||
func ComputeBlockBodyFieldRoots(ctx context.Context, blockBody *BeaconBlockBody) ([][]byte, error) {
|
||||
@@ -196,45 +195,6 @@ func ComputeBlockBodyFieldRoots(ctx context.Context, blockBody *BeaconBlockBody)
|
||||
return fieldRoots, nil
|
||||
}
|
||||
|
||||
func ComputeBlockFieldRoots(ctx context.Context, block interfaces.ReadOnlyBeaconBlock) ([][]byte, error) {
|
||||
_, span := trace.StartSpan(ctx, "blocks.ComputeBlockFieldRoots")
|
||||
defer span.End()
|
||||
|
||||
if block == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
|
||||
fieldRoots := make([][]byte, 5)
|
||||
for i := range fieldRoots {
|
||||
fieldRoots[i] = make([]byte, 32)
|
||||
}
|
||||
|
||||
// Slot
|
||||
slotRoot := ssz.Uint64Root(uint64(block.Slot()))
|
||||
copy(fieldRoots[0], slotRoot[:])
|
||||
|
||||
// Proposer Index
|
||||
proposerRoot := ssz.Uint64Root(uint64(block.ProposerIndex()))
|
||||
copy(fieldRoots[1], proposerRoot[:])
|
||||
|
||||
// Parent Root
|
||||
parentRoot := block.ParentRoot()
|
||||
copy(fieldRoots[2], parentRoot[:])
|
||||
|
||||
// State Root
|
||||
stateRoot := block.StateRoot()
|
||||
copy(fieldRoots[3], stateRoot[:])
|
||||
|
||||
// block body Root
|
||||
blockBodyRoot, err := block.Body().HashTreeRoot()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
copy(fieldRoots[4], blockBodyRoot[:])
|
||||
|
||||
return fieldRoots, nil
|
||||
}
|
||||
|
||||
func PayloadProof(ctx context.Context, block interfaces.ReadOnlyBeaconBlock) ([][]byte, error) {
|
||||
i := block.Body()
|
||||
blockBody, ok := i.(*BeaconBlockBody)
|
||||
|
||||
@@ -153,13 +153,6 @@ func WithdrawalRequestsSliceRoot(withdrawalRequests []*enginev1.WithdrawalReques
|
||||
return SliceRoot(withdrawalRequests, limit)
|
||||
}
|
||||
|
||||
// ConsolidationRequestsSliceRoot computes the HTR of a slice of consolidation requests from the EL.
|
||||
// The limit parameter is used as input to the bitwise merkleization algorithm.
|
||||
|
||||
func ConsolidationRequestsSliceRoot(consolidationRequests []*enginev1.ConsolidationRequest, limit uint64) ([32]byte, error) {
|
||||
return SliceRoot(consolidationRequests, limit)
|
||||
}
|
||||
|
||||
// ByteSliceRoot is a helper func to merkleize an arbitrary List[Byte, N]
|
||||
// this func runs Chunkify + MerkleizeVector
|
||||
// max length is dividable by 32 ( root length )
|
||||
|
||||
@@ -5,46 +5,6 @@ import (
|
||||
ethpbalpha "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
// V1Alpha1SignedHeaderToV1 converts a v1alpha1 signed beacon block header to v1.
|
||||
func V1Alpha1SignedHeaderToV1(v1alpha1Hdr *ethpbalpha.SignedBeaconBlockHeader) *ethpbv1.SignedBeaconBlockHeader {
|
||||
if v1alpha1Hdr == nil || v1alpha1Hdr.Header == nil {
|
||||
return ðpbv1.SignedBeaconBlockHeader{}
|
||||
}
|
||||
return ðpbv1.SignedBeaconBlockHeader{
|
||||
Message: V1Alpha1HeaderToV1(v1alpha1Hdr.Header),
|
||||
Signature: v1alpha1Hdr.Signature,
|
||||
}
|
||||
}
|
||||
|
||||
// V1Alpha1HeaderToV1 converts a v1alpha1 beacon block header to v1.
|
||||
func V1Alpha1HeaderToV1(v1alpha1Hdr *ethpbalpha.BeaconBlockHeader) *ethpbv1.BeaconBlockHeader {
|
||||
if v1alpha1Hdr == nil {
|
||||
return ðpbv1.BeaconBlockHeader{}
|
||||
}
|
||||
|
||||
return ðpbv1.BeaconBlockHeader{
|
||||
Slot: v1alpha1Hdr.Slot,
|
||||
ProposerIndex: v1alpha1Hdr.ProposerIndex,
|
||||
ParentRoot: v1alpha1Hdr.ParentRoot,
|
||||
StateRoot: v1alpha1Hdr.StateRoot,
|
||||
BodyRoot: v1alpha1Hdr.BodyRoot,
|
||||
}
|
||||
}
|
||||
|
||||
// V1HeaderToV1Alpha1 converts a v1 beacon block header to v1alpha1.
|
||||
func V1HeaderToV1Alpha1(v1Header *ethpbv1.BeaconBlockHeader) *ethpbalpha.BeaconBlockHeader {
|
||||
if v1Header == nil {
|
||||
return ðpbalpha.BeaconBlockHeader{}
|
||||
}
|
||||
return ðpbalpha.BeaconBlockHeader{
|
||||
Slot: v1Header.Slot,
|
||||
ProposerIndex: v1Header.ProposerIndex,
|
||||
ParentRoot: v1Header.ParentRoot,
|
||||
StateRoot: v1Header.StateRoot,
|
||||
BodyRoot: v1Header.BodyRoot,
|
||||
}
|
||||
}
|
||||
|
||||
// V1ValidatorToV1Alpha1 converts a v1 validator to v1alpha1.
|
||||
func V1ValidatorToV1Alpha1(v1Validator *ethpbv1.Validator) *ethpbalpha.Validator {
|
||||
if v1Validator == nil {
|
||||
|
||||
@@ -186,6 +186,7 @@ ssz_fulu_objs = [
|
||||
"BeaconBlockContentsFulu",
|
||||
"BlindedBeaconBlockFulu",
|
||||
"DataColumnIdentifier",
|
||||
"DataColumnsByRootIdentifier",
|
||||
"DataColumnSidecar",
|
||||
"SignedBeaconBlockContentsFulu",
|
||||
"SignedBeaconBlockFulu",
|
||||
|
||||
@@ -886,25 +886,6 @@ func genPayloadDeneb() *enginev1.ExecutionPayloadDeneb {
|
||||
|
||||
var genPayloadElectra = genPayloadDeneb
|
||||
|
||||
func genPayloadHeader() *enginev1.ExecutionPayloadHeader {
|
||||
return &enginev1.ExecutionPayloadHeader{
|
||||
ParentHash: bytes(32),
|
||||
FeeRecipient: bytes(32),
|
||||
StateRoot: bytes(32),
|
||||
ReceiptsRoot: bytes(32),
|
||||
LogsBloom: bytes(32),
|
||||
PrevRandao: bytes(32),
|
||||
BlockNumber: 1,
|
||||
GasLimit: 2,
|
||||
GasUsed: 3,
|
||||
Timestamp: 4,
|
||||
ExtraData: bytes(32),
|
||||
BaseFeePerGas: bytes(32),
|
||||
BlockHash: bytes(32),
|
||||
TransactionsRoot: bytes(32),
|
||||
}
|
||||
}
|
||||
|
||||
func genPayloadHeaderCapella() *enginev1.ExecutionPayloadHeaderCapella {
|
||||
return &enginev1.ExecutionPayloadHeaderCapella{
|
||||
ParentHash: bytes(32),
|
||||
@@ -949,14 +930,6 @@ func genPayloadHeaderDeneb() *enginev1.ExecutionPayloadHeaderDeneb {
|
||||
|
||||
var genPayloadHeaderElectra = genPayloadHeaderDeneb
|
||||
|
||||
func genWithdrawals(num int) []*enginev1.Withdrawal {
|
||||
ws := make([]*enginev1.Withdrawal, num)
|
||||
for i := 0; i < num; i++ {
|
||||
ws[i] = genWithdrawal()
|
||||
}
|
||||
return ws
|
||||
}
|
||||
|
||||
func genWithdrawal() *enginev1.Withdrawal {
|
||||
return &enginev1.Withdrawal{
|
||||
Index: 123456,
|
||||
|
||||
108
proto/prysm/v1alpha1/data_columns.pb.go
generated
108
proto/prysm/v1alpha1/data_columns.pb.go
generated
@@ -164,6 +164,61 @@ func (x *DataColumnIdentifier) GetIndex() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type DataColumnsByRootIdentifier struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
BlockRoot []byte `protobuf:"bytes,1,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty" ssz-size:"32"`
|
||||
Columns []uint64 `protobuf:"varint,2,rep,packed,name=columns,proto3" json:"columns,omitempty" ssz-max:"128"`
|
||||
}
|
||||
|
||||
func (x *DataColumnsByRootIdentifier) Reset() {
|
||||
*x = DataColumnsByRootIdentifier{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_data_columns_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DataColumnsByRootIdentifier) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DataColumnsByRootIdentifier) ProtoMessage() {}
|
||||
|
||||
func (x *DataColumnsByRootIdentifier) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_data_columns_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DataColumnsByRootIdentifier.ProtoReflect.Descriptor instead.
|
||||
func (*DataColumnsByRootIdentifier) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_data_columns_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DataColumnsByRootIdentifier) GetBlockRoot() []byte {
|
||||
if x != nil {
|
||||
return x.BlockRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DataColumnsByRootIdentifier) GetColumns() []uint64 {
|
||||
if x != nil {
|
||||
return x.Columns
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_proto_prysm_v1alpha1_data_columns_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_prysm_v1alpha1_data_columns_proto_rawDesc = []byte{
|
||||
@@ -204,17 +259,23 @@ var file_proto_prysm_v1alpha1_data_columns_proto_rawDesc = []byte{
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52,
|
||||
0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x42, 0x9a, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10,
|
||||
0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f,
|
||||
0x66, 0x66, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x76, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15,
|
||||
0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61,
|
||||
0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x22, 0x67, 0x0a, 0x1b, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x42,
|
||||
0x79, 0x52, 0x6f, 0x6f, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12,
|
||||
0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e,
|
||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x42, 0x07, 0x92, 0xb5, 0x18, 0x03, 0x31, 0x32, 0x38,
|
||||
0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x42, 0x9a, 0x01, 0x0a, 0x19, 0x6f, 0x72,
|
||||
0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76,
|
||||
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x6c,
|
||||
0x75, 0x6d, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x39, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x66, 0x66, 0x63, 0x68, 0x61, 0x69, 0x6e,
|
||||
0x4c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x36, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02,
|
||||
0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -229,14 +290,15 @@ func file_proto_prysm_v1alpha1_data_columns_proto_rawDescGZIP() []byte {
|
||||
return file_proto_prysm_v1alpha1_data_columns_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_prysm_v1alpha1_data_columns_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_proto_prysm_v1alpha1_data_columns_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_proto_prysm_v1alpha1_data_columns_proto_goTypes = []interface{}{
|
||||
(*DataColumnSidecar)(nil), // 0: ethereum.eth.v1alpha1.DataColumnSidecar
|
||||
(*DataColumnIdentifier)(nil), // 1: ethereum.eth.v1alpha1.DataColumnIdentifier
|
||||
(*SignedBeaconBlockHeader)(nil), // 2: ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
(*DataColumnSidecar)(nil), // 0: ethereum.eth.v1alpha1.DataColumnSidecar
|
||||
(*DataColumnIdentifier)(nil), // 1: ethereum.eth.v1alpha1.DataColumnIdentifier
|
||||
(*DataColumnsByRootIdentifier)(nil), // 2: ethereum.eth.v1alpha1.DataColumnsByRootIdentifier
|
||||
(*SignedBeaconBlockHeader)(nil), // 3: ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_data_columns_proto_depIdxs = []int32{
|
||||
2, // 0: ethereum.eth.v1alpha1.DataColumnSidecar.signed_block_header:type_name -> ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
3, // 0: ethereum.eth.v1alpha1.DataColumnSidecar.signed_block_header:type_name -> ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
@@ -275,6 +337,18 @@ func file_proto_prysm_v1alpha1_data_columns_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_data_columns_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DataColumnsByRootIdentifier); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -282,7 +356,7 @@ func file_proto_prysm_v1alpha1_data_columns_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_prysm_v1alpha1_data_columns_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -48,4 +48,9 @@ message DataColumnSidecar {
|
||||
message DataColumnIdentifier {
|
||||
bytes block_root = 1 [ (ethereum.eth.ext.ssz_size) = "32" ];
|
||||
uint64 index = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message DataColumnsByRootIdentifier {
|
||||
bytes block_root = 1 [ (ethereum.eth.ext.ssz_size) = "32" ];
|
||||
repeated uint64 columns = 2 [ (ethereum.eth.ext.ssz_max) = "128" ];
|
||||
}
|
||||
|
||||
@@ -1158,3 +1158,123 @@ func (d *DataColumnIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the DataColumnsByRootIdentifier object
|
||||
func (d *DataColumnsByRootIdentifier) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(d)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the DataColumnsByRootIdentifier object to a target array
|
||||
func (d *DataColumnsByRootIdentifier) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(36)
|
||||
|
||||
// Field (0) 'BlockRoot'
|
||||
if size := len(d.BlockRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, d.BlockRoot...)
|
||||
|
||||
// Offset (1) 'Columns'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(d.Columns) * 8
|
||||
|
||||
// Field (1) 'Columns'
|
||||
if size := len(d.Columns); size > 128 {
|
||||
err = ssz.ErrListTooBigFn("--.Columns", size, 128)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(d.Columns); ii++ {
|
||||
dst = ssz.MarshalUint64(dst, d.Columns[ii])
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the DataColumnsByRootIdentifier object
|
||||
func (d *DataColumnsByRootIdentifier) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 36 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o1 uint64
|
||||
|
||||
// Field (0) 'BlockRoot'
|
||||
if cap(d.BlockRoot) == 0 {
|
||||
d.BlockRoot = make([]byte, 0, len(buf[0:32]))
|
||||
}
|
||||
d.BlockRoot = append(d.BlockRoot, buf[0:32]...)
|
||||
|
||||
// Offset (1) 'Columns'
|
||||
if o1 = ssz.ReadOffset(buf[32:36]); o1 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o1 != 36 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'Columns'
|
||||
{
|
||||
buf = tail[o1:]
|
||||
num, err := ssz.DivideInt2(len(buf), 8, 128)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.Columns = ssz.ExtendUint64(d.Columns, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
d.Columns[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the DataColumnsByRootIdentifier object
|
||||
func (d *DataColumnsByRootIdentifier) SizeSSZ() (size int) {
|
||||
size = 36
|
||||
|
||||
// Field (1) 'Columns'
|
||||
size += len(d.Columns) * 8
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the DataColumnsByRootIdentifier object
|
||||
func (d *DataColumnsByRootIdentifier) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(d)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the DataColumnsByRootIdentifier object with a hasher
|
||||
func (d *DataColumnsByRootIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'BlockRoot'
|
||||
if size := len(d.BlockRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(d.BlockRoot)
|
||||
|
||||
// Field (1) 'Columns'
|
||||
{
|
||||
if size := len(d.Columns); size > 128 {
|
||||
err = ssz.ErrListTooBigFn("--.Columns", size, 128)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range d.Columns {
|
||||
hh.AppendUint64(i)
|
||||
}
|
||||
hh.FillUpTo32()
|
||||
|
||||
numItems := uint64(len(d.Columns))
|
||||
hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(128, numItems, 8))
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -67,16 +67,6 @@ var DefaultDepositContractStorage = map[string]string{
|
||||
var bigz = big.NewInt(0)
|
||||
var minerBalance = big.NewInt(0)
|
||||
|
||||
// DefaultCliqueSigner is the testnet miner (clique signer) address encoded in the special way EIP-225 requires.
|
||||
// EIP-225 assigns a special meaning to the `extra-data` field in the block header for clique chains.
|
||||
// In a clique chain, this field contains one secp256k1 "miner" signature. This allows other nodes to
|
||||
// verify that the block was signed by an authorized signer, in place of the typical PoW verification.
|
||||
// Clique overloads the meaning of the `miner` and `nonce` fields to implement a voting protocol, whereby additional
|
||||
// signatures can be added to the list (for details see `Repurposing header fields for signing and voting` in EIP-225).
|
||||
// https://eips.ethereum.org/EIPS/eip-225
|
||||
// The following value is for the key used by the e2e test "miner" node.
|
||||
const DefaultCliqueSigner = "0x0000000000000000000000000000000000000000000000000000000000000000878705ba3f8bc32fcf7f4caa1a35e72af65cf7660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
// GethShanghaiTime calculates the absolute time of the shanghai (aka capella) fork block
|
||||
// by adding the relative time of the capella the fork epoch to the given genesis timestamp.
|
||||
func GethShanghaiTime(genesisTime uint64, cfg *clparams.BeaconChainConfig) *uint64 {
|
||||
|
||||
@@ -126,12 +126,6 @@ var PostElectraDepositCount = uint64(32)
|
||||
// PregenesisExecCreds is the number of withdrawal credentials of genesis validators which use an execution address.
|
||||
var PregenesisExecCreds = uint64(8)
|
||||
|
||||
// NumOfExecEngineTxs is the number of transaction sent to the execution engine.
|
||||
var NumOfExecEngineTxs = uint64(200)
|
||||
|
||||
// ExpectedExecEngineTxsThreshold is the portion of execution engine transactions we expect to find in blocks.
|
||||
var ExpectedExecEngineTxsThreshold = 0.5
|
||||
|
||||
// Base port values.
|
||||
const (
|
||||
portSpan = 50
|
||||
|
||||
14
testing/spectest/mainnet/fulu/finality/BUILD.bazel
Normal file
14
testing/spectest/mainnet/fulu/finality/BUILD.bazel
Normal file
@@ -0,0 +1,14 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "medium",
|
||||
timeout = "short",
|
||||
srcs = ["finality_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
shard_count = 4,
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/finality:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/mainnet/fulu/finality/finality_test.go
Normal file
11
testing/spectest/mainnet/fulu/finality/finality_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package finality
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/finality"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Finality(t *testing.T) {
|
||||
finality.RunFinalityTest(t, "mainnet")
|
||||
}
|
||||
11
testing/spectest/mainnet/fulu/merkle_proof/BUILD.bazel
Normal file
11
testing/spectest/mainnet/fulu/merkle_proof/BUILD.bazel
Normal file
@@ -0,0 +1,11 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["merkle_proof_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/merkle_proof:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package merkle_proof
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/merkle_proof"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_MerkleProof(t *testing.T) {
|
||||
merkle_proof.RunMerkleProofTests(t, "mainnet")
|
||||
}
|
||||
12
testing/spectest/mainnet/fulu/rewards/BUILD.bazel
Normal file
12
testing/spectest/mainnet/fulu/rewards/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["rewards_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/rewards:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/mainnet/fulu/rewards/rewards_test.go
Normal file
11
testing/spectest/mainnet/fulu/rewards/rewards_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package rewards
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/rewards"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Rewards(t *testing.T) {
|
||||
rewards.RunPrecomputeRewardsAndPenaltiesTests(t, "mainnet")
|
||||
}
|
||||
16
testing/spectest/mainnet/fulu/sanity/BUILD.bazel
Normal file
16
testing/spectest/mainnet/fulu/sanity/BUILD.bazel
Normal file
@@ -0,0 +1,16 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "medium",
|
||||
timeout = "short",
|
||||
srcs = [
|
||||
"blocks_test.go",
|
||||
"slots_test.go",
|
||||
],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/sanity:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/mainnet/fulu/sanity/blocks_test.go
Normal file
11
testing/spectest/mainnet/fulu/sanity/blocks_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/sanity"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Sanity_Blocks(t *testing.T) {
|
||||
sanity.RunBlockProcessingTest(t, "mainnet", "sanity/blocks/pyspec_tests")
|
||||
}
|
||||
11
testing/spectest/mainnet/fulu/sanity/slots_test.go
Normal file
11
testing/spectest/mainnet/fulu/sanity/slots_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/sanity"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Sanity_Slots(t *testing.T) {
|
||||
sanity.RunSlotProcessingTests(t, "mainnet")
|
||||
}
|
||||
12
testing/spectest/mainnet/fulu/ssz_static/BUILD.bazel
Normal file
12
testing/spectest/mainnet/fulu/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/ssz_static:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/mainnet/fulu/ssz_static/ssz_static_test.go
Normal file
11
testing/spectest/mainnet/fulu/ssz_static/ssz_static_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/ssz_static"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "mainnet")
|
||||
}
|
||||
15
testing/spectest/minimal/fulu/finality/BUILD.bazel
Normal file
15
testing/spectest/minimal/fulu/finality/BUILD.bazel
Normal file
@@ -0,0 +1,15 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "medium",
|
||||
timeout = "short",
|
||||
srcs = ["finality_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
shard_count = 4,
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/finality:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/minimal/fulu/finality/finality_test.go
Normal file
11
testing/spectest/minimal/fulu/finality/finality_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package finality
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/finality"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Finality(t *testing.T) {
|
||||
finality.RunFinalityTest(t, "minimal")
|
||||
}
|
||||
12
testing/spectest/minimal/fulu/merkle_proof/BUILD.bazel
Normal file
12
testing/spectest/minimal/fulu/merkle_proof/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["merkle_proof_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/merkle_proof:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package merkle_proof
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/merkle_proof"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_MerkleProof(t *testing.T) {
|
||||
merkle_proof.RunMerkleProofTests(t, "minimal")
|
||||
}
|
||||
13
testing/spectest/minimal/fulu/rewards/BUILD.bazel
Normal file
13
testing/spectest/minimal/fulu/rewards/BUILD.bazel
Normal file
@@ -0,0 +1,13 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["rewards_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/rewards:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/minimal/fulu/rewards/rewards_test.go
Normal file
11
testing/spectest/minimal/fulu/rewards/rewards_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package rewards
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/rewards"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Rewards(t *testing.T) {
|
||||
rewards.RunPrecomputeRewardsAndPenaltiesTests(t, "minimal")
|
||||
}
|
||||
17
testing/spectest/minimal/fulu/sanity/BUILD.bazel
Normal file
17
testing/spectest/minimal/fulu/sanity/BUILD.bazel
Normal file
@@ -0,0 +1,17 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "medium",
|
||||
timeout = "short",
|
||||
srcs = [
|
||||
"blocks_test.go",
|
||||
"slots_test.go",
|
||||
],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/fulu/sanity:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/minimal/fulu/sanity/blocks_test.go
Normal file
11
testing/spectest/minimal/fulu/sanity/blocks_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/sanity"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Sanity_Blocks(t *testing.T) {
|
||||
sanity.RunBlockProcessingTest(t, "minimal", "sanity/blocks/pyspec_tests")
|
||||
}
|
||||
11
testing/spectest/minimal/fulu/sanity/slots_test.go
Normal file
11
testing/spectest/minimal/fulu/sanity/slots_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/sanity"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Sanity_Slots(t *testing.T) {
|
||||
sanity.RunSlotProcessingTests(t, "minimal")
|
||||
}
|
||||
16
testing/spectest/minimal/fulu/ssz_static/BUILD.bazel
Normal file
16
testing/spectest/minimal/fulu/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,16 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
tags = [
|
||||
"minimal",
|
||||
"spectest",
|
||||
],
|
||||
deps = ["//testing/spectest/shared/fulu/ssz_static:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/minimal/fulu/ssz_static/ssz_static_test.go
Normal file
11
testing/spectest/minimal/fulu/ssz_static/ssz_static_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/ssz_static"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "minimal")
|
||||
}
|
||||
24
testing/spectest/shared/fulu/finality/BUILD.bazel
Normal file
24
testing/spectest/shared/fulu/finality/BUILD.bazel
Normal file
@@ -0,0 +1,24 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["finality.go"],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/finality",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/utils:go_default_library",
|
||||
"//testing/util:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_google_go_cmp//cmp:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
|
||||
],
|
||||
)
|
||||
86
testing/spectest/shared/fulu/finality/finality.go
Normal file
86
testing/spectest/shared/fulu/finality/finality.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package finality
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/transition"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
"github.com/golang/snappy"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
transition.SkipSlotCache.Disable()
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
BlocksCount int `json:"blocks_count"`
|
||||
}
|
||||
|
||||
// RunFinalityTest executes finality spec tests.
|
||||
func RunFinalityTest(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "finality/finality/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
helpers.ClearCache()
|
||||
preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
beaconStateBase := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, beaconStateBase.UnmarshalSSZ(preBeaconStateSSZ), "Failed to unmarshal")
|
||||
beaconState, err := state_native.InitializeFromProtoElectra(beaconStateBase)
|
||||
require.NoError(t, err)
|
||||
|
||||
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
|
||||
require.NoError(t, err)
|
||||
|
||||
metaYaml := &Config{}
|
||||
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
|
||||
|
||||
var processedState state.BeaconState
|
||||
var ok bool
|
||||
for i := 0; i < metaYaml.BlocksCount; i++ {
|
||||
filename := fmt.Sprintf("blocks_%d.ssz_snappy", i)
|
||||
blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename)
|
||||
require.NoError(t, err)
|
||||
blockSSZ, err := snappy.Decode(nil /* dst */, blockFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
block := ðpb.SignedBeaconBlockElectra{}
|
||||
require.NoError(t, block.UnmarshalSSZ(blockSSZ), "Failed to unmarshal")
|
||||
wsb, err := blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(t, err)
|
||||
processedState, err = transition.ExecuteStateTransition(context.Background(), beaconState, wsb)
|
||||
require.NoError(t, err)
|
||||
beaconState, ok = processedState.(*state_native.BeaconState)
|
||||
require.Equal(t, true, ok)
|
||||
}
|
||||
|
||||
postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
postBeaconState := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, postBeaconState.UnmarshalSSZ(postBeaconStateSSZ), "Failed to unmarshal")
|
||||
pbState, err := state_native.ProtobufBeaconStateElectra(beaconState.ToProtoUnsafe())
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(pbState, postBeaconState) {
|
||||
t.Log(cmp.Diff(postBeaconState, pbState, protocmp.Transform()))
|
||||
t.Fatal("Post state does not match expected")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
13
testing/spectest/shared/fulu/merkle_proof/BUILD.bazel
Normal file
13
testing/spectest/shared/fulu/merkle_proof/BUILD.bazel
Normal file
@@ -0,0 +1,13 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["merkle_proof.go"],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/merkle_proof",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//testing/spectest/shared/common/merkle_proof:go_default_library",
|
||||
"//testing/spectest/shared/fulu/ssz_static:go_default_library",
|
||||
],
|
||||
)
|
||||
12
testing/spectest/shared/fulu/merkle_proof/merkle_proof.go
Normal file
12
testing/spectest/shared/fulu/merkle_proof/merkle_proof.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package merkle_proof
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/merkle_proof"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/ssz_static"
|
||||
)
|
||||
|
||||
func RunMerkleProofTests(t *testing.T, config string) {
|
||||
common.RunMerkleProofTests(t, config, "fulu", ssz_static.UnmarshalledSSZ)
|
||||
}
|
||||
19
testing/spectest/shared/fulu/rewards/BUILD.bazel
Normal file
19
testing/spectest/shared/fulu/rewards/BUILD.bazel
Normal file
@@ -0,0 +1,19 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["rewards_penalties.go"],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/rewards",
|
||||
visibility = ["//testing/spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/core/electra:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/utils:go_default_library",
|
||||
"//testing/util:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
],
|
||||
)
|
||||
134
testing/spectest/shared/fulu/rewards/rewards_penalties.go
Normal file
134
testing/spectest/shared/fulu/rewards/rewards_penalties.go
Normal file
@@ -0,0 +1,134 @@
|
||||
package rewards
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"path"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
"github.com/golang/snappy"
|
||||
)
|
||||
|
||||
// Delta contains list of rewards and penalties.
|
||||
type Delta struct {
|
||||
Rewards []uint64 `json:"rewards"`
|
||||
Penalties []uint64 `json:"penalties"`
|
||||
}
|
||||
|
||||
// unmarshalSSZ deserializes specs data into a simple aggregating container.
|
||||
func (d *Delta) unmarshalSSZ(buf []byte) error {
|
||||
offset1 := binary.LittleEndian.Uint32(buf[:4])
|
||||
offset2 := binary.LittleEndian.Uint32(buf[4:8])
|
||||
|
||||
for i := uint32(0); i < offset2-offset1; i += 8 {
|
||||
d.Rewards = append(d.Rewards, binary.LittleEndian.Uint64(buf[offset1+i:offset1+i+8]))
|
||||
d.Penalties = append(d.Penalties, binary.LittleEndian.Uint64(buf[offset2+i:offset2+i+8]))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RunPrecomputeRewardsAndPenaltiesTests executes "rewards/{basic, leak, random}" tests.
|
||||
func RunPrecomputeRewardsAndPenaltiesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
_, testsFolderPath := utils.TestFolders(t, config, "fulu", "rewards")
|
||||
testTypes, err := util.BazelListDirectories(testsFolderPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, testType := range testTypes {
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", fmt.Sprintf("rewards/%s/pyspec_tests", testType))
|
||||
for _, folder := range testFolders {
|
||||
helpers.ClearCache()
|
||||
t.Run(fmt.Sprintf("%v/%v", testType, folder.Name()), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
runPrecomputeRewardsAndPenaltiesTest(t, folderPath)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) {
|
||||
ctx := context.Background()
|
||||
preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy"))
|
||||
require.NoError(t, err)
|
||||
preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
preBeaconStateBase := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, preBeaconStateBase.UnmarshalSSZ(preBeaconStateSSZ), "Failed to unmarshal")
|
||||
preBeaconState, err := state_native.InitializeFromProtoElectra(preBeaconStateBase)
|
||||
require.NoError(t, err)
|
||||
|
||||
vp, bp, err := electra.InitializePrecomputeValidators(ctx, preBeaconState)
|
||||
require.NoError(t, err)
|
||||
|
||||
vp, bp, err = electra.ProcessEpochParticipation(ctx, preBeaconState, bp, vp)
|
||||
require.NoError(t, err)
|
||||
|
||||
activeBal, targetPrevious, targetCurrent, err := preBeaconState.UnrealizedCheckpointBalances()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, bp.ActiveCurrentEpoch, activeBal)
|
||||
require.Equal(t, bp.CurrentEpochTargetAttested, targetCurrent)
|
||||
require.Equal(t, bp.PrevEpochTargetAttested, targetPrevious)
|
||||
|
||||
deltas, err := electra.AttestationsDelta(preBeaconState, bp, vp)
|
||||
require.NoError(t, err)
|
||||
|
||||
rewards := make([]uint64, len(deltas))
|
||||
penalties := make([]uint64, len(deltas))
|
||||
for i, d := range deltas {
|
||||
rewards[i] = d.HeadReward + d.SourceReward + d.TargetReward
|
||||
penalties[i] = d.SourcePenalty + d.TargetPenalty + d.InactivityPenalty
|
||||
}
|
||||
|
||||
totalSpecTestRewards := make([]uint64, len(rewards))
|
||||
totalSpecTestPenalties := make([]uint64, len(penalties))
|
||||
|
||||
// Fetch delta files. i.e. source_deltas.ssz_snappy, etc.
|
||||
testfiles, err := util.BazelListFiles(path.Join(testFolderPath))
|
||||
require.NoError(t, err)
|
||||
deltaFiles := make([]string, 0, len(testfiles))
|
||||
for _, tf := range testfiles {
|
||||
if strings.Contains(tf, "deltas") {
|
||||
deltaFiles = append(deltaFiles, tf)
|
||||
}
|
||||
}
|
||||
if len(deltaFiles) == 0 {
|
||||
t.Fatal("No delta files")
|
||||
}
|
||||
|
||||
for _, dFile := range deltaFiles {
|
||||
sourceFile, err := util.BazelFileBytes(path.Join(testFolderPath, dFile))
|
||||
require.NoError(t, err)
|
||||
sourceSSZ, err := snappy.Decode(nil /* dst */, sourceFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
d := &Delta{}
|
||||
require.NoError(t, d.unmarshalSSZ(sourceSSZ), "Failed to unmarshal")
|
||||
for i, reward := range d.Rewards {
|
||||
totalSpecTestRewards[i] += reward
|
||||
}
|
||||
for i, penalty := range d.Penalties {
|
||||
totalSpecTestPenalties[i] += penalty
|
||||
}
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(rewards, totalSpecTestRewards) {
|
||||
t.Error("Rewards don't match")
|
||||
t.Log(rewards)
|
||||
t.Log(totalSpecTestRewards)
|
||||
}
|
||||
if !reflect.DeepEqual(penalties, totalSpecTestPenalties) {
|
||||
t.Error("Penalties don't match")
|
||||
t.Log(penalties)
|
||||
t.Log(totalSpecTestPenalties)
|
||||
}
|
||||
}
|
||||
29
testing/spectest/shared/fulu/sanity/BUILD.bazel
Normal file
29
testing/spectest/shared/fulu/sanity/BUILD.bazel
Normal file
@@ -0,0 +1,29 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"block_processing.go",
|
||||
"block_processing.yaml.go",
|
||||
"slot_processing.go",
|
||||
],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/sanity",
|
||||
visibility = ["//testing/spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/utils:go_default_library",
|
||||
"//testing/util:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_google_go_cmp//cmp:go_default_library",
|
||||
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
|
||||
],
|
||||
)
|
||||
113
testing/spectest/shared/fulu/sanity/block_processing.go
Normal file
113
testing/spectest/shared/fulu/sanity/block_processing.go
Normal file
@@ -0,0 +1,113 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/transition"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
"github.com/bazelbuild/rules_go/go/tools/bazel"
|
||||
"github.com/golang/snappy"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
transition.SkipSlotCache.Disable()
|
||||
}
|
||||
|
||||
// RunBlockProcessingTest executes "sanity/blocks" tests.
|
||||
func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", folderPath)
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
helpers.ClearCache()
|
||||
preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
beaconStateBase := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, beaconStateBase.UnmarshalSSZ(preBeaconStateSSZ), "Failed to unmarshal")
|
||||
beaconState, err := state_native.InitializeFromProtoElectra(beaconStateBase)
|
||||
require.NoError(t, err)
|
||||
|
||||
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
|
||||
require.NoError(t, err)
|
||||
|
||||
metaYaml := &Config{}
|
||||
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
|
||||
|
||||
var transitionError error
|
||||
var processedState state.BeaconState
|
||||
var ok bool
|
||||
for i := 0; i < metaYaml.BlocksCount; i++ {
|
||||
filename := fmt.Sprintf("blocks_%d.ssz_snappy", i)
|
||||
blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename)
|
||||
require.NoError(t, err)
|
||||
blockSSZ, err := snappy.Decode(nil /* dst */, blockFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
block := ðpb.SignedBeaconBlockElectra{}
|
||||
require.NoError(t, block.UnmarshalSSZ(blockSSZ), "Failed to unmarshal")
|
||||
wsb, err := blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(t, err)
|
||||
processedState, transitionError = transition.ExecuteStateTransition(context.Background(), beaconState, wsb)
|
||||
if transitionError != nil {
|
||||
break
|
||||
}
|
||||
beaconState, ok = processedState.(*state_native.BeaconState)
|
||||
require.Equal(t, true, ok)
|
||||
}
|
||||
|
||||
// If the post.ssz is not present, it means the test should fail on our end.
|
||||
postSSZFilepath, readError := bazel.Runfile(path.Join(testsFolderPath, folder.Name(), "post.ssz_snappy"))
|
||||
postSSZExists := true
|
||||
if readError != nil && strings.Contains(readError.Error(), "could not locate file") {
|
||||
postSSZExists = false
|
||||
} else if readError != nil {
|
||||
t.Fatal(readError)
|
||||
}
|
||||
|
||||
if postSSZExists {
|
||||
if transitionError != nil {
|
||||
t.Errorf("Unexpected error: %v", transitionError)
|
||||
}
|
||||
|
||||
postBeaconStateFile, err := os.ReadFile(postSSZFilepath) // #nosec G304
|
||||
require.NoError(t, err)
|
||||
postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
|
||||
postBeaconState := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, postBeaconState.UnmarshalSSZ(postBeaconStateSSZ), "Failed to unmarshal")
|
||||
pbState, err := state_native.ProtobufBeaconStateElectra(beaconState.ToProtoUnsafe())
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(pbState, postBeaconState) {
|
||||
t.Log(cmp.Diff(postBeaconState, pbState, protocmp.Transform()))
|
||||
t.Fatal("Post state does not match expected")
|
||||
}
|
||||
} else {
|
||||
// Note: This doesn't test anything worthwhile. It essentially tests
|
||||
// that *any* error has occurred, not any specific error.
|
||||
if transitionError == nil {
|
||||
t.Fatal("Did not fail when expected")
|
||||
}
|
||||
t.Logf("Expected failure; failure reason = %v", transitionError)
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package sanity
|
||||
|
||||
// Config --
|
||||
type Config struct {
|
||||
BlocksCount int `json:"blocks_count"`
|
||||
}
|
||||
61
testing/spectest/shared/fulu/sanity/slot_processing.go
Normal file
61
testing/spectest/shared/fulu/sanity/slot_processing.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package sanity
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/transition"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
"github.com/golang/snappy"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
transition.SkipSlotCache.Disable()
|
||||
}
|
||||
|
||||
// RunSlotProcessingTests executes "sanity/slots" tests.
|
||||
func RunSlotProcessingTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "sanity/slots/pyspec_tests")
|
||||
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
base := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, base.UnmarshalSSZ(preBeaconStateSSZ), "Failed to unmarshal")
|
||||
beaconState, err := state_native.InitializeFromProtoElectra(base)
|
||||
require.NoError(t, err)
|
||||
|
||||
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "slots.yaml")
|
||||
require.NoError(t, err)
|
||||
fileStr := string(file)
|
||||
slotsCount, err := strconv.ParseUint(fileStr[:len(fileStr)-5], 10, 64)
|
||||
require.NoError(t, err)
|
||||
|
||||
postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
postBeaconState := ðpb.BeaconStateElectra{}
|
||||
require.NoError(t, postBeaconState.UnmarshalSSZ(postBeaconStateSSZ), "Failed to unmarshal")
|
||||
postState, err := transition.ProcessSlots(context.Background(), beaconState, beaconState.Slot().Add(slotsCount))
|
||||
require.NoError(t, err)
|
||||
|
||||
pbState, err := state_native.ProtobufBeaconStateElectra(postState.ToProto())
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(pbState, postBeaconState) {
|
||||
t.Fatal("Did not receive expected post state")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
17
testing/spectest/shared/fulu/ssz_static/BUILD.bazel
Normal file
17
testing/spectest/shared/fulu/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,17 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["ssz_static.go"],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/ssz_static",
|
||||
visibility = ["//testing/spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/shared/common/ssz_static:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
],
|
||||
)
|
||||
168
testing/spectest/shared/fulu/ssz_static/ssz_static.go
Normal file
168
testing/spectest/shared/fulu/ssz_static/ssz_static.go
Normal file
@@ -0,0 +1,168 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/ssz_static"
|
||||
fssz "github.com/prysmaticlabs/fastssz"
|
||||
)
|
||||
|
||||
// RunSSZStaticTests executes "ssz_static" tests.
|
||||
func RunSSZStaticTests(t *testing.T, config string) {
|
||||
common.RunSSZStaticTests(t, config, "fulu", UnmarshalledSSZ, customHtr)
|
||||
}
|
||||
|
||||
func customHtr(t *testing.T, htrs []common.HTR, object interface{}) []common.HTR {
|
||||
_, ok := object.(*ethpb.BeaconStateElectra)
|
||||
if !ok {
|
||||
return htrs
|
||||
}
|
||||
|
||||
htrs = append(htrs, func(s interface{}) ([32]byte, error) {
|
||||
beaconState, err := state_native.InitializeFromProtoElectra(s.(*ethpb.BeaconStateElectra))
|
||||
require.NoError(t, err)
|
||||
return beaconState.HashTreeRoot(context.Background())
|
||||
})
|
||||
return htrs
|
||||
}
|
||||
|
||||
// UnmarshalledSSZ unmarshalls serialized input.
|
||||
func UnmarshalledSSZ(t *testing.T, serializedBytes []byte, folderName string) (interface{}, error) {
|
||||
var obj interface{}
|
||||
switch folderName {
|
||||
case "ExecutionPayload":
|
||||
obj = &enginev1.ExecutionPayloadDeneb{}
|
||||
case "ExecutionPayloadHeader":
|
||||
obj = &enginev1.ExecutionPayloadHeaderDeneb{}
|
||||
case "Attestation":
|
||||
obj = ðpb.AttestationElectra{}
|
||||
case "AttestationData":
|
||||
obj = ðpb.AttestationData{}
|
||||
case "AttesterSlashing":
|
||||
obj = ðpb.AttesterSlashingElectra{}
|
||||
case "AggregateAndProof":
|
||||
obj = ðpb.AggregateAttestationAndProofElectra{}
|
||||
case "BeaconBlock":
|
||||
obj = ðpb.BeaconBlockElectra{}
|
||||
case "BeaconBlockBody":
|
||||
obj = ðpb.BeaconBlockBodyElectra{}
|
||||
case "BeaconBlockHeader":
|
||||
obj = ðpb.BeaconBlockHeader{}
|
||||
case "BeaconState":
|
||||
obj = ðpb.BeaconStateElectra{}
|
||||
case "Checkpoint":
|
||||
obj = ðpb.Checkpoint{}
|
||||
case "Deposit":
|
||||
obj = ðpb.Deposit{}
|
||||
case "DepositMessage":
|
||||
obj = ðpb.DepositMessage{}
|
||||
case "DepositData":
|
||||
obj = ðpb.Deposit_Data{}
|
||||
case "Eth1Data":
|
||||
obj = ðpb.Eth1Data{}
|
||||
case "Eth1Block":
|
||||
t.Skip("Unused type")
|
||||
return nil, nil
|
||||
case "Fork":
|
||||
obj = ðpb.Fork{}
|
||||
case "ForkData":
|
||||
obj = ðpb.ForkData{}
|
||||
case "HistoricalBatch":
|
||||
obj = ðpb.HistoricalBatch{}
|
||||
case "IndexedAttestation":
|
||||
obj = ðpb.IndexedAttestationElectra{}
|
||||
case "PendingAttestation":
|
||||
obj = ðpb.PendingAttestation{}
|
||||
case "ProposerSlashing":
|
||||
obj = ðpb.ProposerSlashing{}
|
||||
case "SignedAggregateAndProof":
|
||||
obj = ðpb.SignedAggregateAttestationAndProofElectra{}
|
||||
case "SignedBeaconBlock":
|
||||
obj = ðpb.SignedBeaconBlockElectra{}
|
||||
case "SignedBeaconBlockHeader":
|
||||
obj = ðpb.SignedBeaconBlockHeader{}
|
||||
case "SignedVoluntaryExit":
|
||||
obj = ðpb.SignedVoluntaryExit{}
|
||||
case "SigningData":
|
||||
obj = ðpb.SigningData{}
|
||||
case "Validator":
|
||||
obj = ðpb.Validator{}
|
||||
case "VoluntaryExit":
|
||||
obj = ðpb.VoluntaryExit{}
|
||||
case "SyncCommitteeMessage":
|
||||
obj = ðpb.SyncCommitteeMessage{}
|
||||
case "SyncCommitteeContribution":
|
||||
obj = ðpb.SyncCommitteeContribution{}
|
||||
case "ContributionAndProof":
|
||||
obj = ðpb.ContributionAndProof{}
|
||||
case "SignedContributionAndProof":
|
||||
obj = ðpb.SignedContributionAndProof{}
|
||||
case "SingleAttestation":
|
||||
obj = ðpb.SingleAttestation{}
|
||||
case "SyncAggregate":
|
||||
obj = ðpb.SyncAggregate{}
|
||||
case "SyncAggregatorSelectionData":
|
||||
obj = ðpb.SyncAggregatorSelectionData{}
|
||||
case "SyncCommittee":
|
||||
obj = ðpb.SyncCommittee{}
|
||||
case "LightClientOptimisticUpdate":
|
||||
obj = ðpb.LightClientOptimisticUpdateDeneb{}
|
||||
case "LightClientFinalityUpdate":
|
||||
obj = ðpb.LightClientFinalityUpdateElectra{}
|
||||
case "LightClientBootstrap":
|
||||
obj = ðpb.LightClientBootstrapElectra{}
|
||||
case "LightClientUpdate":
|
||||
obj = ðpb.LightClientUpdateElectra{}
|
||||
case "LightClientHeader":
|
||||
obj = ðpb.LightClientHeaderDeneb{}
|
||||
case "BlobIdentifier":
|
||||
obj = ðpb.BlobIdentifier{}
|
||||
case "BlobSidecar":
|
||||
obj = ðpb.BlobSidecar{}
|
||||
case "PowBlock":
|
||||
obj = ðpb.PowBlock{}
|
||||
case "Withdrawal":
|
||||
obj = &enginev1.Withdrawal{}
|
||||
case "HistoricalSummary":
|
||||
obj = ðpb.HistoricalSummary{}
|
||||
case "BLSToExecutionChange":
|
||||
obj = ðpb.BLSToExecutionChange{}
|
||||
case "SignedBLSToExecutionChange":
|
||||
obj = ðpb.SignedBLSToExecutionChange{}
|
||||
case "PendingDeposit":
|
||||
obj = ðpb.PendingDeposit{}
|
||||
case "PendingPartialWithdrawal":
|
||||
obj = ðpb.PendingPartialWithdrawal{}
|
||||
case "PendingConsolidation":
|
||||
obj = ðpb.PendingConsolidation{}
|
||||
case "WithdrawalRequest":
|
||||
obj = &enginev1.WithdrawalRequest{}
|
||||
case "DepositRequest":
|
||||
obj = &enginev1.DepositRequest{}
|
||||
case "ConsolidationRequest":
|
||||
obj = &enginev1.ConsolidationRequest{}
|
||||
case "ExecutionRequests":
|
||||
obj = &enginev1.ExecutionRequests{}
|
||||
case "DataColumnSidecar":
|
||||
obj = ðpb.DataColumnSidecar{}
|
||||
case "DataColumnsByRootIdentifier":
|
||||
obj = ðpb.DataColumnsByRootIdentifier{}
|
||||
case "MatrixEntry":
|
||||
t.Skip("Unused type")
|
||||
default:
|
||||
return nil, errors.New("type not found")
|
||||
}
|
||||
var err error
|
||||
if o, ok := obj.(fssz.Unmarshaler); ok {
|
||||
err = o.UnmarshalSSZ(serializedBytes)
|
||||
} else {
|
||||
err = errors.New("could not unmarshal object, not a fastssz compatible object")
|
||||
}
|
||||
return obj, err
|
||||
}
|
||||
@@ -33,15 +33,6 @@ type electraBlockGenerator struct {
|
||||
payload *enginev1.ExecutionPayloadDeneb
|
||||
}
|
||||
|
||||
func WithElectraProposerSigning(idx primitives.ValidatorIndex, sk bls.SecretKey, valRoot []byte) ElectraBlockGeneratorOption {
|
||||
return func(g *electraBlockGenerator) {
|
||||
g.sign = true
|
||||
g.proposer = idx
|
||||
g.sk = sk
|
||||
g.valRoot = valRoot
|
||||
}
|
||||
}
|
||||
|
||||
func WithElectraPayload(p *enginev1.ExecutionPayloadDeneb) ElectraBlockGeneratorOption {
|
||||
return func(g *electraBlockGenerator) {
|
||||
g.payload = p
|
||||
|
||||
@@ -71,19 +71,6 @@ func FillRootsNaturalOptCapella(state *ethpb.BeaconStateCapella) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FillRootsNaturalOptDeneb is meant to be used as an option when calling NewBeaconStateDeneb.
|
||||
// It fills state and block roots with hex representations of natural numbers starting with 0.
|
||||
// Example: 16 becomes 0x00...0f.
|
||||
func FillRootsNaturalOptDeneb(state *ethpb.BeaconStateDeneb) error {
|
||||
roots, err := PrepareRoots(int(params.BeaconConfig().SlotsPerHistoricalRoot))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
state.StateRoots = roots
|
||||
state.BlockRoots = roots
|
||||
return nil
|
||||
}
|
||||
|
||||
type NewBeaconStateOption func(state *ethpb.BeaconState) error
|
||||
|
||||
// NewBeaconState creates a beacon state with minimum marshalable fields.
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
|
||||
jsonCapellaBlock, err := structs.SignedBeaconBlockCapellaFromConsensus(capellaBlock.Capella)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
marshalledBlock, err := json.Marshal(jsonCapellaBlock)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user