MCPcopy Create free account
hub / github.com/DNAProject/DNA / verifyVrf

Function verifyVrf

consensus/vbft/utils.go:113–130  ·  view source on GitHub ↗
(pk keypair.PublicKey, blkNum uint32, prevVrf, newVrf, proof []byte)

Source from the content-addressed store, hash-verified

111}
112
113func verifyVrf(pk keypair.PublicKey, blkNum uint32, prevVrf, newVrf, proof []byte) error {
114 data, err := json.Marshal(&vrfData{
115 BlockNum: blkNum,
116 PrevVrf: prevVrf,
117 })
118 if err != nil {
119 return fmt.Errorf("verifyVrf failed to marshal vrfData: %s", err)
120 }
121
122 result, err := vrf.Verify(pk, data, newVrf, proof)
123 if err != nil {
124 return fmt.Errorf("verifyVrf failed: %s", err)
125 }
126 if !result {
127 return fmt.Errorf("verifyVrf failed")
128 }
129 return nil
130}
131
132func GetVbftConfigInfo(memdb *overlaydb.MemDB) (*config.VBFTConfig, error) {
133 //get governance view

Callers 2

TestVrfFunction · 0.85
processProposalMsgMethod · 0.85

Calls 3

MarshalMethod · 0.80
ErrorfMethod · 0.80
VerifyMethod · 0.65

Tested by 1

TestVrfFunction · 0.68