-
Notifications
You must be signed in to change notification settings - Fork 125
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.
Haven't rechecked the circuit in detail again, but generally looks okay, just some questions.
There's also still some clippy errors I think.
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.
PI circuit part seems ok as the most of logic is moved from a5, however, maybe separating this one to 2 PRs(1 for circuit_tool & 1 for pi change) is better for reviewing & commitment organization.
FixedBytes(self.graffiti, 32), | ||
]; | ||
match evidence_type { | ||
EvidenceType::Sgx { prover, new_pubkey } => { |
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.
Do we need sgx type here?
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.
Copied from Raiko? Otherwise indeed not necessary here.
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.
Yea it's copied.
result.extend_from_slice(self.block_evidence.blockMetadata.l1Hash.as_slice()); | ||
result.extend_from_slice(self.block_evidence.signalRoot.as_slice()); | ||
result.extend_from_slice(self.block_evidence.blockMetadata.l1Hash.as_slice()); | ||
result.extend_from_slice(&[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.
why 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 is parent_gas_used
which got removed from this version. I'll change it to a param.
}); | ||
|
||
/// | ||
pub static TREASURY: Lazy<Address> = Lazy::new(|| { |
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.
in case of l1 change, hardcode is inflexible, I think client already gives all of them from API, why you need hardcode here?
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 think these constants should be taken from Raiko-host? Maybe we should align the API. For now the only place of getting taiko specific params are through ProtocolInstance
, if anything is removed from BlockEvidence
in our contract, I'll have to scrape it from somewhere else or hardcode.
|
||
/// PublicData contains all the values that the PiCircuit receives as input | ||
const S1: PiCellType = PiCellType::StoragePhase1; |
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.
SP1 or SPhase1 makes more sense.
@@ -173,6 +203,7 @@ impl_expr!(bool); | |||
impl_expr!(u8); | |||
impl_expr!(u64); | |||
impl_expr!(usize); | |||
impl_expr!(isize); |
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.
which data is in isize type?
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.
Default type of negative numbers, was added for the MPT circuit.
@@ -540,11 +454,11 @@ impl<F: Field> SubCircuit<F> for TaikoPiCircuit<F> { | |||
fn unusable_rows() -> usize { | |||
// No column queried at more than 3 distinct rotations, so returns 6 as | |||
// minimum unusable rows. | |||
6 | |||
CM_HEIGHT + 3 |
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 CM_HEIGHT enough? as you don't have cross CM rotation I think.
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.
Seems okay to me because 3 is the base number of unusable rows. Or what do you mean with cross CM rotation?
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 was thinking that the max rotation is CM_HEIGHT because there is no rotation to the other cm region, not a real problem with +3.
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 think the 3 comes from the random values that are required to make the prover zero knowledge that need to be stored in the last 3 rows. Not sure though, and I also don't know why it's 3 to make that happen (I would think 1 random value would be good enough, but seems like not).
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.
Total cells needed for 7 FieldGadget
are 7 * 32 = 224. CM height is 15 and has 15 columns available = 225 which fits nicely :)
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.
Would indeed have been a bit easier to have separate PRs so it's more clear what needs to be reviewed more closely. Now I just went over everything pretty quickly. :)
@@ -34,7 +34,6 @@ impl<F: Field> ExecutionGadget<F> for JumpGadget<F> { | |||
|
|||
// Pop the value from the stack | |||
cb.stack_pop(destination.expr()); | |||
|
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.
Random new line removed diff?
@@ -540,11 +454,11 @@ impl<F: Field> SubCircuit<F> for TaikoPiCircuit<F> { | |||
fn unusable_rows() -> usize { | |||
// No column queried at more than 3 distinct rotations, so returns 6 as | |||
// minimum unusable rows. | |||
6 | |||
CM_HEIGHT + 3 |
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.
Seems okay to me because 3 is the base number of unusable rows. Or what do you mean with cross CM rotation?
@@ -173,6 +203,7 @@ impl_expr!(bool); | |||
impl_expr!(u8); | |||
impl_expr!(u64); | |||
impl_expr!(usize); | |||
impl_expr!(isize); |
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.
Default type of negative numbers, was added for the MPT circuit.
FixedBytes(self.graffiti, 32), | ||
]; | ||
match evidence_type { | ||
EvidenceType::Sgx { prover, new_pubkey } => { |
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.
Copied from Raiko? Otherwise indeed not necessary here.
Description
Migrated from #149