From a64f4199848c63e3da6ebfe3c0ba519a7e24f175 Mon Sep 17 00:00:00 2001 From: Jie Date: Mon, 25 Apr 2022 19:18:23 -0400 Subject: [PATCH] More Comments for gossip processing accusations --- CTng/gossip/accusation_validation.go | 5 ++++- CTng/gossip/accusations.go | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CTng/gossip/accusation_validation.go b/CTng/gossip/accusation_validation.go index 107113a..d36acd9 100644 --- a/CTng/gossip/accusation_validation.go +++ b/CTng/gossip/accusation_validation.go @@ -9,10 +9,11 @@ type Accusation_POM struct { Signature_TH crypto.ThresholdSig } +//Written By Jie //verification for PoM due to enough number of accusations happens during the PoM generation //we are not sending the entire PoM generated by enough number of accusations as gossip object //therefore, we will verify the combined parital signature at the local level - +//This function will be invoked in the Process_accusation function in accusations.go when the number of accusations accumulated after receiving a new one exceeds the threshold func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto.CryptoConfig) *Accusation_POM { pom_sig, _ := c.ThresholdAggregate(Ea.Partial_sigs) new_Pom02 := new(Accusation_POM) @@ -21,6 +22,8 @@ func generate_accusation_pom_from_accused_entity(Ea EntityAccusations, c *crypto return new_Pom02 } +//Written by Jie +//This function is invoked in Process_accusation function in accusations.go after invoking generate_accusation_pom_from_accused_entity to check the validity of the new generated PoM func verify_accusation_pom(candidatepom Accusation_POM, c *crypto.CryptoConfig) error { //generate the msg and verify the signature return c.ThresholdVerify(candidatepom.Entity_URL, candidatepom.Signature_TH) diff --git a/CTng/gossip/accusations.go b/CTng/gossip/accusations.go index 5a7e22f..4062fa1 100644 --- a/CTng/gossip/accusations.go +++ b/CTng/gossip/accusations.go @@ -6,10 +6,11 @@ import ( "fmt" ) -/*This file mainly deals with Proof of Misbehavior generated after receiving threshold number of accusations (as part of the process accusations). -This file also contains the process accusations function for the gossiper to invoke. -*/ - +//Written by Jie, reviewed and edited by Finn +//This function is invoked when the gossiper receives an accusation +//It will store all the non-duplicate accusations +//it will deal with PoM generation due to threshold number of accusations by invoking generate_accusation_pom_from_accused_entity from accusation_validation.go +//if a PoM due to threshold number of accusations is generated, the PoM will be returned as a gossip_object to be sent to the monitor func Process_Accusation(new_acc Gossip_object, accs *AccusationDB, c *crypto.CryptoConfig) (*Gossip_object, bool, error) { // Convert signature string p_sig, err := crypto.SigFragmentFromString(new_acc.Signature[0])