Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
databus.test.cpp File Reference

Go to the source code of this file.

Typedefs

using Builder = MegaCircuitBuilder
 
using field_ct = stdlib::field_t< Builder >
 
using witness_ct = stdlib::witness_t< Builder >
 
using databus_ct = stdlib::databus< Builder >
 

Functions

 TEST (Databus, CallDataAndReturnData)
 An expository test demonstrating the functionality of the databus in a small but representative use case.
 
 TEST (Databus, ConstantEntryAccess)
 An expository test demonstrating the functionality of the databus in a small use case when the entries are constant witnesses.
 
 TEST (Databus, UnnormalizedEntryAccess)
 An expository test demonstrating the functionality of the databus in a small use case when the entries of the bus_vector are not normalized.
 
 TEST (Databus, ConstantAndUnnormalizedIndices)
 An expository test demonstrating the functionality of the databus in a small use case where the indices are constant and/or unnormalized.
 
 TEST (Databus, BadReadFailure)
 A failure test demonstrating that trying to prove (via a databus read) that an erroneous value is present in the databus will result in an invalid witness.
 
 TEST (Databus, BadCopyFailure)
 A failure test demonstrating that a bad input-output 'copy' will lead to an invalid witness.
 
 TEST (Databus, DuplicateRead)
 Check that multiple reads from the same index results in a valid circuit.
 
 TEST (Databus, AppendBindsBusEntryViaInitRead)
 Appending to a bus column emits the init-read that binds the bus entry to the appended witness.
 
 TEST (Databus, InitReadCatchesValueMismatch)
 The init-read's lookup rejects a bus_column / value-wire divergence.
 

Typedef Documentation

◆ Builder

Definition at line 11 of file databus.test.cpp.

◆ databus_ct

Definition at line 14 of file databus.test.cpp.

◆ field_ct

Definition at line 12 of file databus.test.cpp.

◆ witness_ct

Definition at line 13 of file databus.test.cpp.

Function Documentation

◆ TEST() [1/9]

TEST ( Databus  ,
AppendBindsBusEntryViaInitRead   
)

Appending to a bus column emits the init-read that binds the bus entry to the appended witness.

The bus column is not part of the copy-constraint permutation, so this init-read's lookup is what links bus_column[slot] to its main-wire witness. Two slots with distinct values exercise the assertions broadly: a missing row, missing read_count increment, wrong index wire, swapped index/value wires, or wrong value wire all leave at least one structural assertion or the lookup balance failing.

Definition at line 287 of file databus.test.cpp.

◆ TEST() [2/9]

TEST ( Databus  ,
BadCopyFailure   
)

A failure test demonstrating that a bad input-output 'copy' will lead to an invalid witness.

Definition at line 214 of file databus.test.cpp.

◆ TEST() [3/9]

TEST ( Databus  ,
BadReadFailure   
)

A failure test demonstrating that trying to prove (via a databus read) that an erroneous value is present in the databus will result in an invalid witness.

Definition at line 181 of file databus.test.cpp.

◆ TEST() [4/9]

TEST ( Databus  ,
CallDataAndReturnData   
)

An expository test demonstrating the functionality of the databus in a small but representative use case.

Definition at line 24 of file databus.test.cpp.

◆ TEST() [5/9]

TEST ( Databus  ,
ConstantAndUnnormalizedIndices   
)

An expository test demonstrating the functionality of the databus in a small use case where the indices are constant and/or unnormalized.

Definition at line 142 of file databus.test.cpp.

◆ TEST() [6/9]

TEST ( Databus  ,
ConstantEntryAccess   
)

An expository test demonstrating the functionality of the databus in a small use case when the entries are constant witnesses.

Definition at line 85 of file databus.test.cpp.

◆ TEST() [7/9]

TEST ( Databus  ,
DuplicateRead   
)

Check that multiple reads from the same index results in a valid circuit.

Definition at line 240 of file databus.test.cpp.

◆ TEST() [8/9]

TEST ( Databus  ,
InitReadCatchesValueMismatch   
)

The init-read's lookup rejects a bus_column / value-wire divergence.

Appends a witness with value 13 (creating an init-read at slot 0), then overwrites the row's value wire to point at a witness with value 14. The bus column at slot 0 materializes to 13 from bus_vec[0]; the lookup at the row now expects (0, 14) ∈ bus_col, and check_databus_read rejects.

Definition at line 312 of file databus.test.cpp.

◆ TEST() [9/9]

TEST ( Databus  ,
UnnormalizedEntryAccess   
)

An expository test demonstrating the functionality of the databus in a small use case when the entries of the bus_vector are not normalized.

Definition at line 110 of file databus.test.cpp.