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

Next round for post #583

Closed
wants to merge 4 commits into from
Closed

Next round for post #583

wants to merge 4 commits into from

Conversation

dignifiedquire
Copy link
Contributor

@dignifiedquire dignifiedquire commented Apr 4, 2019

  • finish compound proof implementation of beacon_post
  • switch to using beacon_post in the exported proofs api
  • use no vdf effectively for now by setting post_epochs=1
  • various fixes to make these things work out

Note: Before this can be merged params need to be regenerated, but waiting to do so until everything is finalized.


const POST_CHALLENGE_COUNT: usize = 30;
const POST_EPOCHS: usize = 3;
const POST_EPOCHS: usize = 0;
const POST_PERIODS_COUNT: usize = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicola need a number here

Copy link
Contributor

Choose a reason for hiding this comment

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

@dignifiedquire @nicola - What's the relationship between POST_PERIODS_COUNT and total time to generate a PoSt? I ask this question because PoSt generation takes very little time right now. go-filecoin relies on that fact. If PoSt generation starts to take approximately the whole proving period, we're going to need to change a bunch of software.

let mut f_in = File::open(sealed_path).expect("invalid path");
let mut replica = Vec::new();
f_in.read_to_end(&mut replica)
.expect("failed to read replica");
Copy link
Contributor

Choose a reason for hiding this comment

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

You want exects here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is exects?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a misspelling of expects

trees.push(public_params(bytes).graph.merkle_tree(&replica)?);
replicas.push(replica);
} else {
panic!("faults are not yet supported")
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that you're editing this code... will you think of a way to remove this panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will work on faults likely tomorrow as a follow up to this and think about handling it then

{
let circuit = ZigZagCompound::blank_circuit(&public_params, &internal::ENGINE_PARAMS);
let _ = ZigZagCompound::get_verifying_key(circuit, &public_params);
ZigZagCompound::get_verifying_key(circuit, &public_params)
.expect("failed to generate zigzag verifying key");
Copy link
Contributor

Choose a reason for hiding this comment

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

You want to use expects here.

Copy link
Collaborator

@porcuquine porcuquine left a comment

Choose a reason for hiding this comment

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

I thought we were going to implement this as a loop driven from the internal API, which takes 'partial' PoSt proofs as inputs and reduces them into an eventual final proof then generates a circuit proof. This still relies on a state-introducing Beacon::get function, but I think we need to respect the abstractions in place and have proofs be pure functions of their public inputs.

My intent isn't to design in review, so this is just context referencing what we discussed before.

I get that this is an incremental update to existing work, and I'm not averse to including it on the path forward — as long as we're still in agreement about the end goal. I do think this version of BeaconPost will probably need to be changed noticeably, so I'd also be okay with just diving into the reorganization first.

If we're on the same page, I commit to spending some time to hammer out the design in a bit more detail, which we can do in a new issue.

If you're now leaning toward trying to drive all the way forward using this approach, let's talk it through some more.

@@ -39,6 +39,9 @@ impl<T: Domain, V: Vdf<T>> ParameterSetIdentifier for PublicParams<T, V> {
pub struct PublicInputs<T: Domain> {
/// The root hashes of the merkle trees of the sealed sectors.
pub commitments: Vec<T>,
pub challenge_seed: T,
// TODO: Actually use the faults once faults are designed.
pub faults: Vec<u64>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are faults a public input?

Copy link
Contributor

Choose a reason for hiding this comment

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

They need to be public because the blockchain must know they happened.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. Makes sense.


for _ in 0..post_periods_count {
inputs.push(pub_in.challenge_seed.into());
inputs.push(compute_root_commitment(&pub_in.commitments).into());
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might be able to use the apex commitment for the implementation of compute_root_commitment. (See #562).

porcuquine
porcuquine previously approved these changes Apr 12, 2019
Copy link
Collaborator

@porcuquine porcuquine left a comment

Choose a reason for hiding this comment

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

As discussed, I leave it to you whether to merge this or wait. Do regenerate params before merging if you decide to proceed.

@dignifiedquire
Copy link
Contributor Author

closing, will open a new PR once this is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants