Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Checkpoint actor to accumulate signatures #207

Closed
aakoshh opened this issue Sep 7, 2023 · 5 comments
Closed

Create Checkpoint actor to accumulate signatures #207

aakoshh opened this issue Sep 7, 2023 · 5 comments
Assignees

Comments

@aakoshh
Copy link
Contributor

aakoshh commented Sep 7, 2023

As a Fendermint interpreter, I want to be able to use a smart contract (actor) to store the checkpoints about our own subnet, while the validator signatures are being accumulated. I want the contract to be able to emit events to which relayers can subscribe.

I don't know if a Solidity or a built-in actor is better for this. The Solidity API can be used for subscriptions, but so can the Tendermint RPC. The checkpoint itself will either go as "full fat" Solidity message to Lotus, or a "low fat" message with a CID if the parent is Fendermint.

@aakoshh
Copy link
Contributor Author

aakoshh commented Sep 14, 2023

As per #209 this method should take as input parameters the past validator set, because the contract will not keep the history of the power table. Fendermint shall retrieve the validators from CometBFT based on the height indicated in the signature, and then the contract can check whether the signatory can legally submit signatures, it should remember whether it has submitted one already, adjust the power, check for quorum, etc.

Some of these checks can be done in Fendermint too, but since the same checks need to be done in Solidity on the parent, why not do it in Solidity here too.

@dnkolegov
Copy link
Contributor

dnkolegov commented Sep 15, 2023

this method should take as input parameters the past validator set

  1. We have a map signatures: height => membership_hash => signatures
  2. We check that the signature is valid and was signed by a validator from the input validator set.
  3. We hash the input "the past validator set" (that is ordered and the same for all honest validators on a child subnet).
  4. Store the signature signatures[height][hash] = signature

Then, we can garbage collect old signatures set from that map.

@aakoshh Is my understanding correct?

@aakoshh
Copy link
Contributor Author

aakoshh commented Sep 15, 2023

We have a map signatures: height => membership_hash => signatures

I don't know why you would complicate things with a membership hash here. We need a list of checkpoints. True, at any height there can be at most one checkpoint, so you can store them indexed by height. But there is only one membership eligible to sign a checkpoints, so there's no reason to sub-index by its hash. Just store the actual checkpoint, which is a struct we have to come up with.

We check that the signature is valid and was signed a validator from the input validator set.

Yes that sounds right.

We hash the input "the past validator set" (that is ordered and the same for all honest validators on a child subnet).

I don't think there is any need for this hashing.

Store the signature signatures[height][hash] = signature

I think that should be more like an append, not overwriting with the single input signature.
Once again, no need for hashing, just store the list of signatures at the height the checkpoint belongs to.

Then, we can garbage collect old signatures set from that map.

I am not sure at which point we can garbage collect signatures, I'd say we can postpone that for now. First let's get all the other stories completed.

@aakoshh
Copy link
Contributor Author

aakoshh commented Sep 15, 2023

IMO start with the definition of a Checkpoint and then we need two mappings: height => Checkpoint and height => Signature[]. Let's take it from there.

@dnkolegov
Copy link
Contributor

dnkolegov commented Sep 15, 2023

@jsoares jsoares transferred this issue from consensus-shipyard/fendermint Dec 19, 2023
@jsoares jsoares closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants