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

VDF clean ups #770

Merged
merged 30 commits into from May 13, 2024
Merged

VDF clean ups #770

merged 30 commits into from May 13, 2024

Conversation

jonas-lj
Copy link
Contributor

@jonas-lj jonas-lj commented Apr 23, 2024

  • Derive Serialize/Deserilialize automatically and use bcs for all serialization and deserialization.
  • Simplify: Get rid of unnecessary abstractions.
  • Add more tests and update existing tests.
  • Refactoring: Move unit tests to modules.
  • Update benchmarks and cli.

@jonas-lj jonas-lj requested a review from benr-ml April 24, 2024 12:09
@jonas-lj jonas-lj marked this pull request as ready for review April 24, 2024 14:10
@jonas-lj jonas-lj requested a review from kchalkias April 24, 2024 15:45
Copy link
Collaborator

@kchalkias kchalkias left a comment

Choose a reason for hiding this comment

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

Please have a final check for any padding issues where size of vectors (length) can panic or similar issues. All public functions used by the blockchain should not trust user input and should never panic.

fastcrypto-cli/src/vdf.rs Outdated Show resolved Hide resolved
fastcrypto-cli/src/vdf.rs Show resolved Hide resolved
fastcrypto-vdf/src/class_group/discriminant.rs Outdated Show resolved Hide resolved
#[test]
fn test_discriminant_from_seed() {
let seed = [1, 2, 3];
let target_size = 512;
Copy link
Collaborator

Choose a reason for hiding this comment

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

shall we do at least 1024?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also with the new paper we could theoretically support 2K+ sizes, shall we do or not? Do we actually have a default strong one, generated with some nothing up my sleeve properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does support larger discriminants, but it takes a long time. I'll update the test to generate a 1024 bit discriminant instead (takes ~9 seconds) and compare it to a test vector from chiavdf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re a larger discriminant, generating a strong "nothing-up-my-sleeve" is straight-forward to do. 1) We demonstrate that the implementation follows chiavdf for 1024 bits, 2) decide on some future information, say a bitcoin block hash or similar, 3) generate a 3072 bit discriminant with that seed and use that as a fixed discriminant..

fastcrypto-vdf/src/class_group/mod.rs Show resolved Hide resolved
fastcrypto-vdf/src/class_group/mod.rs Outdated Show resolved Hide resolved
fastcrypto-vdf/src/class_group/mod.rs Outdated Show resolved Hide resolved
@@ -54,3 +54,34 @@ impl QuadraticForm {
}
}
}

#[cfg(test)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

after this is merged I'd expect some fuzzy test coverage here (even via LLM aid)

fastcrypto-vdf/src/math/modular_sqrt.rs Outdated Show resolved Hide resolved
fastcrypto-vdf/src/vdf/mod.rs Outdated Show resolved Hide resolved
@jonas-lj jonas-lj merged commit 086e0d7 into main May 13, 2024
7 checks passed
@jonas-lj jonas-lj deleted the jonas/vdf_update branch May 13, 2024 07:25
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.

None yet

3 participants