Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

add pre-fund when there are less than three validators #102

Closed
wants to merge 3 commits into from

Conversation

adlrocha
Copy link
Contributor

@adlrocha adlrocha commented May 3, 2023

Background

In order to remove the chicken-and-egg problem described in #96 we send some initial funds to the initial validators in a subnet. The issue is that if we spawn a subnet with just one validator, and we join from another validator, the second validator won't have any funds to submit top-down checkpoints, and as a super-majority is required to commit the checkpoint, there won't be any way for the joining validator to inject funds in the subnet to submit top-down checkpoints, stalling the checkpoint submission of top-down checkpoints for the subnet.

Proposal

For now, this PR introduces a work-around where some initial funds are also sent to joining validators when the number of validators is below 3, to prevent joining validators from not being able to submit a checkpoint for lack of funds. A more robust solution should be considered like using account abstraction or some kind of checkpoint submission subsidising system.

// is too small (< 3), where if a new validator join and it doesn't have funds
// no new top-down checkpoints can be submitted, we add some balance also for
// non-initial validators.
if rt.curr_epoch() > 1 && validator_set.validators().len() < 4 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cryptoAtwill, just to double-check with you. I don't think we should merge this one, as there is a really simple attack where before there are more than four validators, any validator could continuously join and leave to drain 1 FIL of the gateway at a time. I think for now let's track the bug here and figure out a better way to solve it. Tracking the issue here: #103

@adlrocha
Copy link
Contributor Author

adlrocha commented May 4, 2023

@cryptoAtwill, unless you think otherwise, closing for now as the solution is too hacky and open to abuse.

@adlrocha adlrocha closed this May 4, 2023
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