Capella: validator log withdrawals (#11657)

* Capella: validator log withdrawals

* Capella: validator log withdrawals
This commit is contained in:
terencechain
2022-11-12 18:26:49 -08:00
committed by GitHub
parent de73baa4a7
commit cf466702df
2 changed files with 33 additions and 1 deletions

View File

@@ -145,7 +145,7 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [f
trace.Int64Attribute("numAttestations", int64(len(blk.Block().Body().Attestations()))),
)
if blk.Version() == version.Bellatrix {
if blk.Version() >= version.Bellatrix {
p, err := blk.Block().Body().Execution()
if err != nil {
log.WithError(err).Error("Failed to get execution payload")
@@ -167,6 +167,14 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [f
if p.GasLimit() != 0 {
log = log.WithField("gasUtilized", float64(p.GasUsed())/float64(p.GasLimit()))
}
if blk.Version() >= version.Capella && !blk.IsBlinded() {
withdrawals, err := p.Withdrawals()
if err != nil {
log.WithError(err).Error("Failed to get execution payload withdrawals")
return
}
log = log.WithField("withdrawalCount", len(withdrawals))
}
}
blkRoot := fmt.Sprintf("%#x", bytesutil.Trunc(blkResp.BlockRoot))

View File

@@ -561,6 +561,30 @@ func testProposeBlock(t *testing.T, graffiti []byte) {
},
},
},
{
name: "capella",
block: &ethpb.GenericBeaconBlock{
Block: &ethpb.GenericBeaconBlock_Capella{
Capella: func() *ethpb.BeaconBlockCapella {
blk := util.NewBeaconBlockCapella()
blk.Block.Body.Graffiti = graffiti
return blk.Block
}(),
},
},
},
{
name: "capella blind block",
block: &ethpb.GenericBeaconBlock{
Block: &ethpb.GenericBeaconBlock_BlindedCapella{
BlindedCapella: func() *ethpb.BlindedBeaconBlockCapella {
blk := util.NewBlindedBeaconBlockCapella()
blk.Block.Body.Graffiti = graffiti
return blk.Block
}(),
},
},
},
}
for _, tt := range tests {