-
Notifications
You must be signed in to change notification settings - Fork 33
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
LedgerDB namespacing #917
LedgerDB namespacing #917
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just gonna leave a comment here without "requesting changes" since i don't agree with the way things have been done here but i don't want to block the PR either.
The reason i have is:
We have Node,Prover,SequencerTrait... etc which are all implemented for LedgerDB
which doesn't make that much of a difference from the previous version which LedgerDB
had by containing all the methods. Limiting the access to methods using traits in prover for example by defining ledger_db: DB
is okay.
The way i would have done it is as follows:
One trait, 3 structs
/// Common ledger ops, leaving out the word `common`/`shared` from the name.
pub trait Ledger {
... common stuff
}
pub struct ProverLedger {
}
impl ProverLedger {
}
impl LedgerOps for ProverLedger {
}
Same for sequencer and fullnode. I would also try to namespace tables
sequencer_xyz
prover_abc`
so that prover tables are only accessed within ProverLedger
.
The main aim of this PR is to restrict visibility in order to prevent calling the method where it shouldn't be, i.e. calling a sequencer method from the prover. If I understand correctly, we would declare the For the namespacing of the tables, that would be ideal, but would it change anything if we're sharing the inner RocksDB instance ? |
Isn't the three structs approach basically trying to do OOP where the Ledger trait would be the base class ? |
Description
SharedLedgerOps
for any method shared between Prover/Sequencer/Node.NodeLedgerOps
,ProverLedgerOps
andSequencerLedgerOps
to constraint the associatedCitreaFullNode
,CitreaProver
andCitreaSequencer
Linked Issues