Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Add activity tracking to entropy generator #194

Merged

Conversation

jinmannwong
Copy link
Contributor

@jinmannwong jinmannwong commented Oct 2, 2020

  • Track the signature shares received from validators in a sliding window
  • Slash when the number of shares in the window is below the allowed threshold
  • Do not double slash validators for inactivity in the same period
  • Bug fixes from deployment

}
evidence.ComplainantSignature = sig

entropyGenerator.Logger.Debug("Add evidence for inactivity", "height", entropy.Height, "validator", crypto.AddressHash(defAddress))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider making this a log Info. When doing the SDK tests I would have appreciated if the logs said something to the effect of 'jailing/slashing validator for inactivity' when it happened so you aren't wondering why it is suddenly jailed. In my mind there should be logs by default if something unexpected happens

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. The slashing module actually does have Info logs when it jails a validator. Not sure why they weren't printing out on the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh - perhaps I missed them. I guess the logs rather than being here could be in the SDK actually, since that would be when action actually happened

stateDB dbm.DB
evpool evidencePool
aeonEntropyParams *types.EntropyParams // Inactivity params for this aeon
activityTracking map[uint]*list.List // Record of validators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to be a pointer to a list?

sigShareCount += e.Value.(int)
}

threshold := float64(entropyGenerator.aeonEntropyParams.RequiredActivityPercentage*entropyGenerator.aeonEntropyParams.InactivityWindowSize) * 0.01
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might break this up into multiple lines, and also make it a log info for when there is evidence submitted against you - in my mind if something unexpected is happening such as slashing there should be a log so you notice it asap. I found that in the sdk tests it was confusing when you would be suddenly jailed with no indication why, if it had printed 'validator jailed for inactivity' that would have been helpful.

stateDB dbm.DB
evpool evidencePool
aeonEntropyParams *types.EntropyParams // Inactivity params for this aeon
activityTracking map[uint]*list.List // Record of validators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is slightly nicer when iterating through the map as you can edit the list directly rather than having to access it by indexing into the map.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -530,6 +543,9 @@ func (bie *BeaconInactivityEvidence) Verify(chainID string, complainantPubKey cr
return fmt.Errorf("ComplainantSignature invalid")
}

// Need to verify defendant address in state and also aeon start is correct
// and evidence height is greater than aeon start
Copy link
Contributor Author

@jinmannwong jinmannwong Oct 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evidence needs to be fully verified in Tendermint - coming in #195

@jinmannwong jinmannwong requested a review from n-hutton October 6, 2020 11:48
@jinmannwong jinmannwong merged commit 27222ae into fetchai:master Oct 6, 2020
@jinmannwong jinmannwong deleted the improvements/activity_tracking branch October 6, 2020 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants