mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-02-18 00:41:38 -05:00
Compare commits
1 Commits
e2e-debugg
...
consensus-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c245c55dc5 |
@@ -270,6 +270,7 @@ func AttestationsDelta(beaconState state.BeaconState, bal *precompute.Balance, v
|
|||||||
// Modified in Altair and Bellatrix.
|
// Modified in Altair and Bellatrix.
|
||||||
var inactivityDenominator uint64
|
var inactivityDenominator uint64
|
||||||
bias := cfg.InactivityScoreBias
|
bias := cfg.InactivityScoreBias
|
||||||
|
inactivityDenominator := bias * beaconState.InactivityPenaltyQuotient()
|
||||||
switch beaconState.Version() {
|
switch beaconState.Version() {
|
||||||
case version.Altair:
|
case version.Altair:
|
||||||
inactivityDenominator = bias * cfg.InactivityPenaltyQuotientAltair
|
inactivityDenominator = bias * cfg.InactivityPenaltyQuotientAltair
|
||||||
|
|||||||
@@ -16,12 +16,19 @@ import (
|
|||||||
type BeaconState interface {
|
type BeaconState interface {
|
||||||
ReadOnlyBeaconState
|
ReadOnlyBeaconState
|
||||||
WriteOnlyBeaconState
|
WriteOnlyBeaconState
|
||||||
|
SpecConstantsProvider
|
||||||
Copy() BeaconState
|
Copy() BeaconState
|
||||||
HashTreeRoot(ctx context.Context) ([32]byte, error)
|
HashTreeRoot(ctx context.Context) ([32]byte, error)
|
||||||
FutureForkStub
|
FutureForkStub
|
||||||
StateProver
|
StateProver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SpecConstantsProvider defines a struct which can provide varying configuration
|
||||||
|
// values depending on fork versions, such as the beacon state.
|
||||||
|
type SpecConstantsProvider interface {
|
||||||
|
InactivityPenaltyQuotient() (uint64, error)
|
||||||
|
}
|
||||||
|
|
||||||
// StateProver defines the ability to create Merkle proofs for beacon state fields.
|
// StateProver defines the ability to create Merkle proofs for beacon state fields.
|
||||||
type StateProver interface {
|
type StateProver interface {
|
||||||
FinalizedRootProof(ctx context.Context) ([][]byte, error)
|
FinalizedRootProof(ctx context.Context) ([][]byte, error)
|
||||||
|
|||||||
7
beacon-chain/state/state-native/v1/spec_constants.go
Normal file
7
beacon-chain/state/state-native/v1/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotient
|
||||||
|
}
|
||||||
7
beacon-chain/state/state-native/v2/spec_constants.go
Normal file
7
beacon-chain/state/state-native/v2/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotientAltair
|
||||||
|
}
|
||||||
7
beacon-chain/state/state-native/v3/spec_constants.go
Normal file
7
beacon-chain/state/state-native/v3/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotientBellatrix
|
||||||
|
}
|
||||||
7
beacon-chain/state/v1/spec_constants.go
Normal file
7
beacon-chain/state/v1/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotient
|
||||||
|
}
|
||||||
7
beacon-chain/state/v2/spec_constants.go
Normal file
7
beacon-chain/state/v2/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotientAltair
|
||||||
|
}
|
||||||
7
beacon-chain/state/v3/spec_constants.go
Normal file
7
beacon-chain/state/v3/spec_constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import "github.com/prysmaticlabs/prysm/config/params"
|
||||||
|
|
||||||
|
func (b *BeaconState) InactivityPenaltyQuotient() uint64 {
|
||||||
|
return params.BeaconConfig().InactivityPenaltyQuotientBellatrix
|
||||||
|
}
|
||||||
72
consensus-types/interfaces.go
Normal file
72
consensus-types/interfaces.go
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package consensus_types
|
||||||
|
|
||||||
|
import (
|
||||||
|
ssz "github.com/ferranbt/fastssz"
|
||||||
|
types "github.com/prysmaticlabs/eth2-types"
|
||||||
|
enginev1 "github.com/prysmaticlabs/prysm/proto/engine/v1"
|
||||||
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||||
|
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SSZItem defines a struct which provides Marshal,
|
||||||
|
// Unmarshal, and HashTreeRoot SSZ operations.
|
||||||
|
type SSZItem interface {
|
||||||
|
ssz.Marshaler
|
||||||
|
ssz.Unmarshaler
|
||||||
|
ssz.HashRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
// Container defines the base methods required for a consensus
|
||||||
|
// data structure used in Prysm, containing utilities for SSZ
|
||||||
|
// as well as conversion methods to a protobuf representation for use
|
||||||
|
// with Prysm's gRPC API.
|
||||||
|
type Container interface {
|
||||||
|
SSZItem
|
||||||
|
IsNil() bool
|
||||||
|
Proto() proto.Message
|
||||||
|
FromProto(m proto.Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignedBeaconBlock describes the method set of a signed beacon block.
|
||||||
|
type SignedBeaconBlock interface {
|
||||||
|
Container
|
||||||
|
Block() BeaconBlock
|
||||||
|
Signature() []byte
|
||||||
|
Copy() SignedBeaconBlock
|
||||||
|
PbGenericBlock() (*ethpb.GenericSignedBeaconBlock, error)
|
||||||
|
PbPhase0Block() (*ethpb.SignedBeaconBlock, error)
|
||||||
|
PbAltairBlock() (*ethpb.SignedBeaconBlockAltair, error)
|
||||||
|
PbBellatrixBlock() (*ethpb.SignedBeaconBlockBellatrix, error)
|
||||||
|
PbBlindedBellatrixBlock() (*ethpb.SignedBlindedBeaconBlockBellatrix, error)
|
||||||
|
Header() (*ethpb.SignedBeaconBlockHeader, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeaconBlock describes an interface which states the methods
|
||||||
|
// employed by an object that is a beacon block.
|
||||||
|
type BeaconBlock interface {
|
||||||
|
Container
|
||||||
|
Slot() types.Slot
|
||||||
|
ProposerIndex() types.ValidatorIndex
|
||||||
|
ParentRoot() []byte
|
||||||
|
StateRoot() []byte
|
||||||
|
Body() BeaconBlockBody
|
||||||
|
AsSignRequestObject() validatorpb.SignRequestObject
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeaconBlockBody describes the method set employed by an object
|
||||||
|
// that is a beacon block body.
|
||||||
|
type BeaconBlockBody interface {
|
||||||
|
Container
|
||||||
|
RandaoReveal() []byte
|
||||||
|
Eth1Data() *ethpb.Eth1Data
|
||||||
|
Graffiti() []byte
|
||||||
|
ProposerSlashings() []*ethpb.ProposerSlashing
|
||||||
|
AttesterSlashings() []*ethpb.AttesterSlashing
|
||||||
|
Attestations() []*ethpb.Attestation
|
||||||
|
Deposits() []*ethpb.Deposit
|
||||||
|
VoluntaryExits() []*ethpb.SignedVoluntaryExit
|
||||||
|
SyncAggregate() (*ethpb.SyncAggregate, error)
|
||||||
|
ExecutionPayload() (*enginev1.ExecutionPayload, error)
|
||||||
|
ExecutionPayloadHeader() (*ethpb.ExecutionPayloadHeader, error)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user