mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Do Not Propose if Assigned to Genesis Slot (#1989)
* do not propose if assigned to genesis * fix bitset * revert bitset * regress test * rem commented blocks
This commit is contained in:
parent
d5c05f083b
commit
ef8232ae2e
@ -23,6 +23,10 @@ import (
|
|||||||
// the state root computation, and finally signed by the validator before being
|
// the state root computation, and finally signed by the validator before being
|
||||||
// sent back to the beacon node for broadcasting.
|
// sent back to the beacon node for broadcasting.
|
||||||
func (v *validator) ProposeBlock(ctx context.Context, slot uint64) {
|
func (v *validator) ProposeBlock(ctx context.Context, slot uint64) {
|
||||||
|
if slot == params.BeaconConfig().GenesisSlot {
|
||||||
|
log.Info("Assigned to genesis slot, skipping proposal")
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx, span := trace.StartSpan(ctx, "validator.ProposeBlock")
|
ctx, span := trace.StartSpan(ctx, "validator.ProposeBlock")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
log.Info("Proposing...")
|
log.Info("Proposing...")
|
||||||
|
@ -43,6 +43,15 @@ func setup(t *testing.T) (*validator, *mocks, func()) {
|
|||||||
return validator, m, ctrl.Finish
|
return validator, m, ctrl.Finish
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestProposeBlock_DoesNotProposeGenesisBlock(t *testing.T) {
|
||||||
|
hook := logTest.NewGlobal()
|
||||||
|
validator, _, finish := setup(t)
|
||||||
|
defer finish()
|
||||||
|
validator.ProposeBlock(context.Background(), params.BeaconConfig().GenesisSlot)
|
||||||
|
|
||||||
|
testutil.AssertLogsContain(t, hook, "Assigned to genesis slot, skipping proposal")
|
||||||
|
}
|
||||||
|
|
||||||
func TestProposeBlock_LogsCanonicalHeadFailure(t *testing.T) {
|
func TestProposeBlock_LogsCanonicalHeadFailure(t *testing.T) {
|
||||||
hook := logTest.NewGlobal()
|
hook := logTest.NewGlobal()
|
||||||
validator, m, finish := setup(t)
|
validator, m, finish := setup(t)
|
||||||
|
Loading…
Reference in New Issue
Block a user