Skip to content

Commit

Permalink
Skip validating tortoise beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Aug 25, 2021
1 parent 6f666f2 commit b1c83e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 1 addition & 4 deletions blocks/blockeligibilityvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ func (v BlockEligibilityValidator) BlockSignedAndEligible(block *types.Block) (b
numberOfEligibleBlocks, totalWeight)
}

epochBeacon, err := v.beaconProvider.GetBeacon(epochNumber)
if err != nil {
return false, fmt.Errorf("get beacon for epoch %v: %w", epochNumber, err)
}
epochBeacon := block.EligibilityProof.TortoiseBeacon

message, err := serializeVRFMessage(epochBeacon, epochNumber, counter)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions blocks/blockoracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ func (bo *Oracle) calcEligibilityProofs(epochNumber types.EpochID) (map[types.La

eligibleLayer := calcEligibleLayer(epochNumber, bo.layersPerEpoch, vrfSig)
eligibilityProofs[eligibleLayer] = append(eligibilityProofs[eligibleLayer], types.BlockEligibilityProof{
J: counter,
Sig: vrfSig,
J: counter,
Sig: vrfSig,
TortoiseBeacon: epochBeacon,
})
}

Expand Down
9 changes: 7 additions & 2 deletions common/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ type BlockEligibilityProof struct {

// Sig is the VRF signature from which the block's LayerID is derived.
Sig []byte

// TortoiseBeacon is the tortoise beacon value for this block.
TortoiseBeacon []byte
}

// BlockHeader includes all of a block's fields, except the list of transaction IDs, activation transaction IDs and the
Expand Down Expand Up @@ -437,9 +440,11 @@ func NewExistingBlock(layerIndex LayerID, data []byte, txs []TransactionID) *Blo
MiniBlock: MiniBlock{
BlockHeader: BlockHeader{
LayerIndex: layerIndex,
Data: data},
Data: data,
},
TxIDs: txs,
}}
},
}
b.Signature = signing.NewEdSigner().Sign(b.Bytes())
b.Initialize()
return &b
Expand Down

0 comments on commit b1c83e1

Please sign in to comment.