-
Notifications
You must be signed in to change notification settings - Fork 5
Shd/governance validation2 #457
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
base: main
Are you sure you want to change the base?
Conversation
…github.com:input-output-hk/acropolis into shd/governance-validation
sandtreader
left a comment
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.
This is a great pattern to do this error promotion across the board - thanks!
Some comments on naming - nothing substantive so go ahead and merge if it's holding anything up.
| } | ||
|
|
||
| pub fn conway() -> Self { | ||
| Self { major: 9, minor: 0 } |
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.
This could be confusing - Conway is (at least) protocol versions 9 (Chang) and 10 (Plomin) and could well include 11 soon. It would be better to call this chang() I think.
| macro_rules! declare_cardano_reader { | ||
| ($name:ident, $msg_constructor:ident, $msg_type:ty) => { | ||
| async fn $name(s: &mut Box<dyn Subscription<Message>>) -> Result<(BlockInfo, $msg_type)> { | ||
| info!("Waiting in topic {}", stringify!($msg_constructor)); |
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.
Unlikely we'd want this in production :-)
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.
There's a standing joke about files called 'utils' ;-) The validation bits could move to validation.rs, maybe the remaining macro in messaging.rs or some such?
| /// See Haskell Node, Cardano.Ledger.BaseTypes: Cardano/Src/Ledger/BaseTypes.hs | ||
| #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)] | ||
| pub enum MismatchRelation { | ||
| RelEq, |
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.
Style point - is the Rel prefix needed given it's always qualified with MismatchRelation anyway?
| /// See Haskell Node, Cardano.Ledger.BaseTypes: Cardano/Src/Ledger/BaseTypes.hs | ||
| #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)] | ||
| pub enum Mismatch<T: Debug + Display> { | ||
| Supplied(T, MismatchRelation), |
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.
Why does Supplied have a relation too? I'm assuming we're representing "we got X but expected REL Y".
Also confused why it's an enum - maybe naming is strange? Let's not import Haskell weirdness if we can avoid it!
| try_join_all(validator_topics.iter().map(|topic| context.subscribe(topic))).await?; | ||
|
|
||
| // True if we expect validation to be performed by the nodes | ||
| let do_validation = !validator_subscriptions.is_empty(); |
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.
Nice!
| let prev = self.proposals.insert(proc.gov_action_id.clone(), (epoch, proc.clone())); | ||
| if let Some(prev) = prev { | ||
| return Err(anyhow!( | ||
| outcomes.push_anyhow(anyhow!( |
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.
Is there no specific governance error we could generate here? It seems like you have done in most cases.
| let (blk_p, params) = Self::read_parameters(&mut protocol_s).await?; | ||
| if blk_g != blk_p { | ||
| error!( | ||
| outcomes.push_anyhow(anyhow!( |
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.
Interesting... I hadn't thought of promoting this kind of internal error, but it is the safe thing to do - nothing can be valid if we're screwed up internally.
| (Conway "GOV" rule) | ||
|
|
||
| ``` | ||
| data ConwayGovPredFailure era |
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.
Looks like there are a lot more errors defined here than we can currently generate - need a ticket to add checks on these (in time).
golddydev
left a comment
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.
ValidationOutcome approach is nice 👍🏼
Willl use that with UTxO validation
Description
Related Issue(s)
Fixes #[#404] (#404)
How was this tested?
Checklist
Impact / Side effects
Reviewer notes / Areas to focus
Added common/utils.rs for validation help.