Refactoring: Rename class libzcash::Note to libzcash::SproutNote.

This commit is contained in:
Simon
2018-04-24 21:20:01 -07:00
parent bef33bbc73
commit b230fe6836
21 changed files with 61 additions and 61 deletions

View File

@@ -139,7 +139,7 @@ public:
ZCProof prove(
const boost::array<JSInput, NumInputs>& inputs,
const boost::array<JSOutput, NumOutputs>& outputs,
boost::array<Note, NumOutputs>& out_notes,
boost::array<SproutNote, NumOutputs>& out_notes,
boost::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
uint256& out_ephemeralKey,
const uint256& pubKeyHash,
@@ -364,10 +364,10 @@ uint256 JoinSplit<NumInputs, NumOutputs>::h_sig(
return output;
}
Note JSOutput::note(const uint252& phi, const uint256& r, size_t i, const uint256& h_sig) const {
SproutNote JSOutput::note(const uint252& phi, const uint256& r, size_t i, const uint256& h_sig) const {
uint256 rho = PRF_rho(phi, i, h_sig);
return Note(addr.a_pk, value, rho, r);
return SproutNote(addr.a_pk, value, rho, r);
}
JSOutput::JSOutput() : addr(uint256(), uint256()), value(0) {
@@ -377,7 +377,7 @@ JSOutput::JSOutput() : addr(uint256(), uint256()), value(0) {
JSInput::JSInput() : witness(ZCIncrementalMerkleTree().witness()),
key(SpendingKey::random()) {
note = Note(key.address().a_pk, 0, random_uint256(), random_uint256());
note = SproutNote(key.address().a_pk, 0, random_uint256(), random_uint256());
ZCIncrementalMerkleTree dummy_tree;
dummy_tree.append(note.cm());
witness = dummy_tree.witness();

View File

@@ -18,12 +18,12 @@ namespace libzcash {
class JSInput {
public:
ZCIncrementalWitness witness;
Note note;
SproutNote note;
SpendingKey key;
JSInput();
JSInput(ZCIncrementalWitness witness,
Note note,
SproutNote note,
SpendingKey key) : witness(witness), note(note), key(key) { }
uint256 nullifier() const {
@@ -40,7 +40,7 @@ public:
JSOutput();
JSOutput(PaymentAddress addr, uint64_t value) : addr(addr), value(value) { }
Note note(const uint252& phi, const uint256& r, size_t i, const uint256& h_sig) const;
SproutNote note(const uint252& phi, const uint256& r, size_t i, const uint256& h_sig) const;
};
template<size_t NumInputs, size_t NumOutputs>
@@ -62,7 +62,7 @@ public:
virtual ZCProof prove(
const boost::array<JSInput, NumInputs>& inputs,
const boost::array<JSOutput, NumOutputs>& outputs,
boost::array<Note, NumOutputs>& out_notes,
boost::array<SproutNote, NumOutputs>& out_notes,
boost::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
uint256& out_ephemeralKey,
const uint256& pubKeyHash,

View File

@@ -9,14 +9,14 @@
namespace libzcash {
Note::Note() {
SproutNote::SproutNote() {
a_pk = random_uint256();
rho = random_uint256();
r = random_uint256();
value = 0;
}
uint256 Note::cm() const {
uint256 SproutNote::cm() const {
unsigned char discriminant = 0xb0;
CSHA256 hasher;
@@ -35,12 +35,12 @@ uint256 Note::cm() const {
return result;
}
uint256 Note::nullifier(const SpendingKey& a_sk) const {
uint256 SproutNote::nullifier(const SpendingKey& a_sk) const {
return PRF_nf(a_sk, rho);
}
NotePlaintext::NotePlaintext(
const Note& note,
const SproutNote& note,
boost::array<unsigned char, ZC_MEMO_SIZE> memo) : memo(memo)
{
value = note.value;
@@ -48,9 +48,9 @@ NotePlaintext::NotePlaintext(
r = note.r;
}
Note NotePlaintext::note(const PaymentAddress& addr) const
SproutNote NotePlaintext::note(const PaymentAddress& addr) const
{
return Note(addr.a_pk, value, rho, r);
return SproutNote(addr.a_pk, value, rho, r);
}
NotePlaintext NotePlaintext::decrypt(const ZCNoteDecryption& decryptor,

View File

@@ -13,17 +13,17 @@ public:
virtual uint256 cm() const {};
};
class Note : public BaseNote {
class SproutNote : public BaseNote {
public:
uint256 a_pk;
uint64_t value;
uint256 rho;
uint256 r;
Note(uint256 a_pk, uint64_t value, uint256 rho, uint256 r)
SproutNote(uint256 a_pk, uint64_t value, uint256 rho, uint256 r)
: a_pk(a_pk), value(value), rho(rho), r(r) {}
Note();
SproutNote();
virtual uint256 cm() const override;
@@ -39,9 +39,9 @@ public:
NotePlaintext() {}
NotePlaintext(const Note& note, boost::array<unsigned char, ZC_MEMO_SIZE> memo);
NotePlaintext(const SproutNote& note, boost::array<unsigned char, ZC_MEMO_SIZE> memo);
Note note(const PaymentAddress& addr) const;
SproutNote note(const PaymentAddress& addr) const;
ADD_SERIALIZE_METHODS;

View File

@@ -191,7 +191,7 @@ public:
const uint256& rt,
const uint256& h_sig,
const boost::array<JSInput, NumInputs>& inputs,
const boost::array<Note, NumOutputs>& outputs,
const boost::array<SproutNote, NumOutputs>& outputs,
uint64_t vpub_old,
uint64_t vpub_new
) {

View File

@@ -21,7 +21,7 @@ public:
r->generate_r1cs_constraints();
}
void generate_r1cs_witness(const Note& note) {
void generate_r1cs_witness(const SproutNote& note) {
r->bits.fill_with_bits(this->pb, uint256_to_bool_vector(note.r));
value.fill_with_bits(this->pb, uint64_to_bool_vector(note.value));
}
@@ -119,7 +119,7 @@ public:
void generate_r1cs_witness(
const MerklePath& path,
const SpendingKey& key,
const Note& note
const SproutNote& note
) {
note_gadget<FieldT>::generate_r1cs_witness(note);
@@ -222,7 +222,7 @@ public:
commit_to_outputs->generate_r1cs_constraints();
}
void generate_r1cs_witness(const Note& note) {
void generate_r1cs_witness(const SproutNote& note) {
note_gadget<FieldT>::generate_r1cs_witness(note);
prevent_faerie_gold->generate_r1cs_witness();