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

QGB ADR-005 Reducing QGB module state usage #657

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Aug 24, 2022

Closing #656

@rach-id rach-id added documentation Improvements or additions to documentation enhancement New feature or request C: QGB labels Aug 24, 2022
@rach-id rach-id self-assigned this Aug 24, 2022
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Great work articulating the problem! Most of my comments are nits. I'm super curious on what the "QGB Rollup" design entails but it doesn't seem necessary to flesh out now.

### Keep the existing design

Keeping the current design would entail using the state extensively.
This proves bad when the state grows after a few hundred attestations, and performing checks on the `Valset Confirms` and `DataCommitment Confirms` becomes so expensive.
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nit]

Suggested change
This proves bad when the state grows after a few hundred attestations, and performing checks on the `Valset Confirms` and `DataCommitment Confirms` becomes so expensive.
This proves bad when the state grows after a few hundred attestations, and performing checks on the `Valset Confirms` and `DataCommitment Confirms` becomes too expensive.

I remember hearing that this state is bounded by some fixed upper limit. Is it worth explaining that limit here?

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please, added a sentence explaining that.


### Negative

- Reducing the checks applied on the confirms: everyone will be able to post commitments, and we will have no way to sanitize them before adding them to a block. This would add an extra overhead for the relayer to choose the right commitments. However, it is alright, since we will not have a lot of Also, we will need to decide if this will be relayers, and we can give them enough computation power to compensate the overhead.
Copy link
Collaborator

Choose a reason for hiding this comment

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

However, it is alright, since we will not have a lot

the rest of this sentence got lost

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please

rach-id and others added 5 commits August 25, 2022 09:56
…espace.md

Co-authored-by: Rootul Patel <rootulp@gmail.com>
…espace.md

Co-authored-by: Rootul Patel <rootulp@gmail.com>
Co-authored-by: Rootul Patel <rootulp@gmail.com>
@rach-id rach-id requested a review from rootulp August 25, 2022 08:14
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all my nits! I still don't understand what data needs to be published to a reserved namespace vs. non-reserved namespace but it sounds like you're working on a proposal for that so will re-review after its published


## Context

Currently, the QGB is using the state to save all the attestations and confirms it needs.
Copy link
Collaborator

Choose a reason for hiding this comment

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

the state

[optional] it may help non-familiar readers (i.e. me) to clarify what this state is. Is it specifically state stored within the QGB module which would end up bloating the celestia-app state?

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please?

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

just to note some things @sweexordious and I discussed synchronously:

  1. For any new more stateless approach, we need to first have a plausible-potentially-hand-wavy form of slashing. As already mentioned, deciding on when we actually want this formal mechanism for slashing is also important.
  2. A more stateless approach could be as simple as keeping identical transaction types, but not storing the confirmations in the state! We'd still have the valset/data commitment requests be handled and stored by the state machine, and the mapping between validators and their orchestrator keys, but the rest would simply be charged gas fees and be stored in block data. Relayers and orchestrators can then reconstruct a local copy of the state using the block data.
  3. One hand-wavy-potentially-viable formal slashing mechanism could involve some sort of commit-reveal scheme, where anyone can post a bond and claim that a validator should be slashed for a specific violation. It is then up to any other honest participant to refute that claim. If successful, then they get the bond. This would likely require other additional data be kept in state, but that's still to be investigated. As mentioned, it might be easier to implement fraud proofs (or tendermint like evidence)

note to selves: specifying a formal mechanism for slashing is a perfect thing to do at the onsite.

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

🚀


- Reduce significantly the gas fees paid by orchestrators.
- Reduce significantly the use of Celestia state.
- Keep the whole QGB confirms history via using block data, instead of being forced to delete it after the unbonding period to not end up with a super gigantic state. This would allow any QGB contract to have the whole history on any EVM chain.
Copy link
Member

Choose a reason for hiding this comment

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

Keep the whole QGB confirms history via using block data

not sure if this bullet point makes it clear that the old approach was also not deleting the transactions from previous blocks, so it technically could also do the same thing. The relayer design I think is what enables this

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please?

## Context

Currently, the QGB is using the state to save all the attestations and confirms it needs.
We propose to post `Valset Confirms` and `DataCommitment Confirms` in a reserved namespace instead of adding them to the state to achieve the following:
Copy link
Member

Choose a reason for hiding this comment

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

Are we still planning on sticking the confirms in their own namespace? if not, I think we can update this to reflect that we're planning on simply posting them in the txs namespace instead of in their own.

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please?

### Keep the existing design

Keeping the current design would entail using the state extensively.
This proves bad when the state grows after a few hundred attestations, and performing checks on the `Valset Confirms` and `DataCommitment Confirms` becomes too expensive.
Copy link
Member

Choose a reason for hiding this comment

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

not 100% sure state growth is the correct term here since the querying mechanism ended up being the culprit for the gas leak.

Also, we were planning on deleting the state after so long, so the state in theory would be constant

Copy link
Member Author

Choose a reason for hiding this comment

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

check now please?

@rach-id
Copy link
Member Author

rach-id commented Aug 31, 2022

This also will need to be addressed in this ADR: #613 (comment)

evan-forbes and others added 2 commits September 1, 2022 22:13
Co-authored-by: CHAMI Rachid <chamirachid1@gmail.com>
@rach-id rach-id changed the title QGB ADR-005 Posting confirms in reserved namespaces QGB ADR-005 Reducing QGB module state usage Sep 2, 2022
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Overall LGTM. I defer to other reviewers for approval on this b/c my approval here doesn't carry much weight

docs/architecture/ADR-005-QGB_reduce_state_usage.md Outdated Show resolved Hide resolved

For the orchestrators, they will also need to parse the history to keep track of any missed signatures. But, same as with the relayers, the cost is justified.

For posting transactions, we will rely on gas fees as a mechanism to limit malicious parties to flood the network with invalid transactions. Then, eventually slash malicious behavious. However, since posting confirms will be possible for any user of the network. It won't be possible to slash ordinary users, who are not running validators, if they post invalid confirms.
Copy link
Collaborator

Choose a reason for hiding this comment

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

[no change needed]

If we assume that the QGB data (i.e. Valset Confirms and DataCommitment Confirms) is stored in a non-reserved namespace, I think the problem stated above == https://forum.celestia.org/t/woods-attack-on-celestia/59

If the QGB data is only stored in transaction data and this document proposed adding new transaction types (distinct from MsgPayForData), I think we need a follow-up issue to discuss the metering (i.e. gas accounting) for these new message types.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we assume that the QGB data (i.e. Valset Confirms and DataCommitment Confirms) is stored in a non-reserved namespace, I think the problem stated above == https://forum.celestia.org/t/woods-attack-on-celestia/59

We are no longer posting in confirms in namespaces, so woods attack is not relevant, if I understand right.

If the QGB data is only stored in transaction data and this document proposed adding new transaction types (distinct from MsgPayForData), I think we need a follow-up issue to discuss the metering (i.e. gas accounting) for these new message types.

No need for a new message type, we already have them defined and used. And the gas usage will be minimal since there will be no read/write in state.

Co-authored-by: Rootul Patel <rootulp@gmail.com>
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

Nice!! excited about this change.

I don't think its necessary at all, since this ADR is focused on the state machine, but after we flesh out the implementation for the orchestrator and relayer, we might want to add a few more details into how that's done. Very optional in my opinion tho, as this serves the purpose of documenting the decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants