This installs a package vdaf_poc that can be imported from PINE. Hacking in the module by adding the submodule to Python's PATH is no longer necessary.
Replace class-factory patterns with standard Python OOP patterns. In particular, methods on Vdaf are no longer class methods, but methods on an instance of the class that is constructed with all the necessary parameters.
Enforce type hints:
sage -python -m mypy *pine*.py
This required minor changes to the code in some cases. For instance, previously we allowed chunk_length to be None, but the type is int, not Optional[int]. There are also situations where it's necessary to call cast() to tell the type checker that an Optional[SomeType] is a SomeType and not None.
Another notable change is that, in some cases, we were treating generic types as class constructors. In particular, we often want to be generic in the finite field, but then invoke the constructor for that type with the same variable. Python's type hints doesn't actually support this.
Finally, rename encode_gradient_and_norm() to encode(), which is an abstract method of Flp. This was pointed out by the type checker.
We need https://github.com/cfrg/draft-irtf-cfrg-vdaf/pull/383 before we can merge this.
Remove the submodule and require the user to install the reference code the VDAF draft via pip:
This installs a package
vdaf_poc
that can be imported from PINE. Hacking in the module by adding the submodule to Python's PATH is no longer necessary.Vdaf
are no longer class methods, but methods on an instance of the class that is constructed with all the necessary parameters.Enforce type hints:
This required minor changes to the code in some cases. For instance, previously we allowed
chunk_length
to beNone
, but the type isint
, notOptional[int]
. There are also situations where it's necessary to callcast()
to tell the type checker that anOptional[SomeType]
is aSomeType
and notNone
.Another notable change is that, in some cases, we were treating generic types as class constructors. In particular, we often want to be generic in the finite field, but then invoke the constructor for that type with the same variable. Python's type hints doesn't actually support this.
Finally, rename
encode_gradient_and_norm()
toencode()
, which is an abstract method ofFlp
. This was pointed out by the type checker.