-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implement hashing and proofs for multistacks #201
Conversation
…g to match order in proving
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.
got better definitions working on solidity code. Could still change, but seems right.
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.
some minor comments.
This looks great and I can certainly start integration with this version.
arbitrator/prover/src/machine.rs
Outdated
@@ -972,6 +1027,7 @@ pub fn get_empty_preimage_resolver() -> PreimageResolver { | |||
|
|||
impl Machine { | |||
pub const MAX_STEPS: u64 = 1 << 43; | |||
pub const NO_STACK_HASH: Bytes32 = Bytes32::new([255_u8; 32]); |
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 don't think you should need that.
Something like 'Bytes32([255_u8;32])' and/or something like '[255_u8;32].into()' should work
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.
Bytes32([255_u8;32])
works!
Tried .into()/from()
before but that complained about non-static fn used in static initialization.
arbitrator/arbutil/src/types.rs
Outdated
@@ -13,6 +13,14 @@ use std::{ | |||
#[repr(C)] | |||
pub struct Bytes32(pub [u8; 32]); | |||
|
|||
|
|||
impl Bytes32 { | |||
pub const fn new(bytes: [u8; 32]) -> Self { |
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 don't think you need that.. see comment where you use it
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.
Done
arbitrator/arbutil/src/types.rs
Outdated
@@ -13,6 +13,14 @@ use std::{ | |||
#[repr(C)] | |||
pub struct Bytes32(pub [u8; 32]); | |||
|
|||
|
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.
extra blank line
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.
Done
arbitrator/arbutil/src/types.rs
Outdated
} | ||
} | ||
|
||
|
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.
extra blank line
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.
Done
arbitrator/prover/src/machine.rs
Outdated
hash_stack(multistack.iter().map(|v| stack_hasher(v)), "cothread:") | ||
} | ||
|
||
|
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.
extra blank line
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.
Done
arbitrator/prover/src/machine.rs
Outdated
{ | ||
let mut data = Vec::with_capacity(33); | ||
|
||
|
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.
2 blank lines
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.
Done
arbitrator/prover/src/machine.rs
Outdated
data | ||
} | ||
|
||
|
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.
extra blank line
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.
Done
I got some new warnings during rust compilation
|
arbitrator/prover/src/machine.rs
Outdated
// "multistack: " | ||
// + hash_stack(first_stack) | ||
// + hash_stack(last_stack) | ||
// + Keccak("cothread: " + 2nd_stack+Keccak("cothread" + 3drd_stack + ...) |
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.
code does "cothread:" (no space)
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.
Done. Dropped it from multistack for consistency as well.
arbitrator/prover/src/machine.rs
Outdated
} | ||
let mut hash: Bytes32 = match items.len() > 2 { | ||
true => Machine::NO_STACK_HASH, | ||
_ => { |
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.
these two are switched
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.
Done
arbitrator/prover/src/machine.rs
Outdated
|
||
let mut last_hash = match items.len() > 1{ | ||
true => {Machine::NO_STACK_HASH}, | ||
_ => stack_hasher(items.last().unwrap()), |
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.
these two are switched
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.
Done
Addressed comments, PTAL. |
added some small fixes and merged into go_wasi |
That accepts prover so that we can use it both for values and stack frames.