Commit Graph

32 Commits

Author SHA1 Message Date
Kris Nuttycombe b60ef5c7ea Return bundle metadata from bundle building.
In order to be able to associate requested spends and outputs with the
indices of the actions that execute these operations, it is necessary to
track the randomization of inputs and outputs and return the mappings
that resulted from that shuffling.
2024-01-09 14:09:05 -07:00
Kris Nuttycombe 3845686a6e Modify `BundleType` to exclude the anchor & allow no bundle to be produced.
This adds a flag to `BundleType` that, when set, requires a dummy-only
bundle to be produced even if no spends or outputs are added to the
builder, and when unset results in standard padding.
2023-12-20 19:29:14 -07:00
Kris Nuttycombe 2e2c161d52 Add a public bundle construction function & use it in the builder. 2023-12-18 21:56:42 -07:00
Kris Nuttycombe 0a257d6f68 Add explicit control of padding to the Builder API. 2023-12-15 15:08:22 -07:00
Kris Nuttycombe 06cb76168e Rename `Builder::add_recipient` to `add_output`.
The term `recipient` is commonly used to refer to the address to which a
note is sent; however, a bundle may include multiple outputs to the same
recipient. This change is intended to clarify this usage.

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-12-14 15:56:42 -07:00
Daira Hopwood cb1733d6ad Change number of iterations for the compact-note-decryption benchmark
to 10240. This improves the accuracy by ensuring a more even distribution
of more expensive decryptions.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-10-18 19:27:56 +01:00
Jack Grigg 0b4d7bc9c6 Migrate note encryption to use prepared w-NAF APIs 2022-10-15 23:27:57 +00:00
Jack Grigg 6b5905880d Make note decryption benchmark reliable
The benchmark assumed that the first action in the bundle was for the
recipient it had added, but we've started shuffling recipients within
actions, and the builder pads to a minimum of two actions. This meant
that 50% of benchmark runs would fail to start, but would proceed fine
if they did start (as the bundle is cached for the entire test).

We now add two recipients, to cancel out the effect of the padding and
shuffle.
2022-05-06 21:22:51 +00:00
Jack Grigg 4574d4793a Migrate to 2021 edition 2022-04-28 17:23:30 +00:00
therealyingtong a0424984c6 Add explicit scoping for viewing keys and addresses
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-30 20:49:37 +08:00
Jack Grigg 17ad25ee35 Merge branch 'non-consensus-changes-on-branchid-c4cd541e' into merge-non-consensus-changes 2022-02-15 22:46:47 +00:00
Kris Nuttycombe 5d5e289197 Remove default_diversifier and default_address methods. 2022-02-15 14:39:32 -07:00
therealyingtong f74cb9e4d3 Delete gadgets and their primitives; add `halo2_gadgets` dependency. 2022-01-29 01:57:01 +08:00
therealyingtong 5b26c7d67a Pass rng to create_proof API.
As of halo2#444, all APIs now take `R: RngCore` arguments instead of
internally depending on `rand::rngs::OsRng`.
2022-01-05 21:30:45 +08:00
Jack Grigg 0e1220acc9 Merge branch 'main' into orchard-mainnet-circuit 2021-12-20 15:20:33 +00:00
Jack Grigg bfc65d5985 poseidon: Remove `self` parameter from `Domain` trait methods
For almost all the sponge constructions defined in the Poseidon paper,
the domain can be defined completely statically. Variable-length hashing
requires knowledge of the message length, but that can be provided to
the fixed padding function in a subsequent commit, and in any case we
can't use variable-length inputs in a circuit.
2021-12-10 02:40:33 +00:00
Jack Grigg 84aa43fe8b bench: Fix circuit benchmarks
Criterion's benchmark grouping does not match on group names; it only
groups benchmarks that are run prior to that specific benchmark group
instance being dropped. Since each benchmark group holds a mutable
reference to the criterion instance, this means we can't have multiple
active groups collecting measurements. Instead, we need to collect the
proving benchmarks for all recipient numbers, followed by verification
benchmarks.
2021-12-09 13:18:39 +00:00
Jack Grigg 3079800f42 Remove `Var::new` trait method
As the underlying `Region` methods now return `AssignedCell` instead of
`Cell`, we can simplify all the places where we then constructed a
`CellValue` struct.
2021-12-08 01:48:17 +00:00
Jack Grigg 9b41a06363 Migrate to halo2 version with `AssignedCell`
We change `CellValue` into a typedef of `AssignedCell` to simplify the
migration in this commit.

The migration from `CellValue` to `AssignedCell` requires several other
changes:

- `<CellValue as Var>::value()` returned `Option<F>`, whereas
  `AssignedCell::<F, F>::value()` returns `Option<&F>`. This means we
  need to dereference, use `Option::cloned`, or alter functions to take
  `&F` arguments.
- `StateWord` in the Poseidon chip has been changed to a newtype around
  `AssignedCell` (the chip was written before `CellValue` existed).
2021-12-08 01:45:00 +00:00
ying tong b02628d263 Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-12-01 09:31:53 -05:00
therealyingtong 421891f065 Benchmark proof creation and verification for RATE = 2, 8, 11. 2021-11-30 10:03:49 -05:00
therealyingtong b63c868591 poseidon: Make Spec trait methods not take (&self) parameter. 2021-11-30 10:02:16 -05:00
Jack Grigg 99d03e0d25 Migrate to latest halo2 revision 2021-11-26 16:24:26 +00:00
therealyingtong 764c445a81 Rename poseidon::nullifier -> poseidon::p128pow5t3. 2021-10-12 11:58:27 +02:00
str4d cb28e00ebd
Merge pull request #178 from zcash/batch-note-decryption
Speed up batched note decryption
2021-08-13 14:27:41 +01:00
Jack Grigg 8c15cc25be Benchmark batch trial decryption 2021-08-12 01:36:38 +01:00
Jack Grigg 0d306d18aa Expose and benchmark Poseidon 2021-08-10 13:44:04 +01:00
Jack Grigg 08b279b900 Expose and benchmark Sinsemilla primitive 2021-08-10 13:39:14 +01:00
Jack Grigg cad3c8a1b8 Add benchmark for note decryption 2021-08-06 01:03:03 +01:00
Jack Grigg 1ecd7a9555 Add another data point to the bundle benchmarks 2021-07-28 23:06:40 +01:00
Jack Grigg a33d1bd90f Add circuit benchmarks and (on Unix) flamegraphs
- Benchmarks:  `cargo bench`
- Flamegraphs: `cargo bench -- --profile-time 100`
2021-07-28 15:09:31 +01:00
Jack Grigg f18ffa63d5 Add small key derivation benchmarks 2021-03-20 18:19:51 +13:00