initial clsag implementation for carrot

This commit is contained in:
akildemir
2025-05-28 17:50:16 +03:00
parent a3a05a24e4
commit 3878e389fe
10 changed files with 390 additions and 8 deletions

View File

@@ -37,6 +37,7 @@
#include "ringct/rctTypes.h"
#include "ringct/rctSigs.h"
#include "ringct/rctOps.h"
#include "crypto/generators.h"
#include "device/device.hpp"
#include "string_tools.h"
@@ -299,6 +300,47 @@ TEST(ringct, CLSAG)
ASSERT_TRUE(rct::verRctCLSAGSimple(message,clsag,pubs,Cout));
}
TEST(ringct, CLSAG_CARROT)
{
const size_t N = 16;
const size_t idx = 5;
ctkeyV pubs;
key x, y, t, t2, u;
const key message = identity();
ctkey backup;
clsagCarrot clsag;
for (size_t i = 0; i < N; ++i)
{
key sk;
ctkey tmp;
skpkGen(sk, tmp.dest);
skpkGen(sk, tmp.mask);
pubs.push_back(tmp);
}
// Set P[idx]
x = skGen();
y = skGen();
addKeys2(pubs[idx].dest, x, y, rct::pk2rct(crypto::get_T()));
// Set C[idx]
t = skGen();
u = skGen();
addKeys2(pubs[idx].mask,t,u,H);
// Set commitment offset
key Cout;
t2 = skGen();
addKeys2(Cout,t2,u,H);
// generate the signature
clsag = rct::proveRctCLSAGSSimpleCarrot(message, pubs, x, y, t, t2, Cout, idx, hw::get_device("default"));
ASSERT_TRUE(rct::verRctCLSAGSimpleCarrot(message, clsag, pubs, Cout));
}
TEST(ringct, range_proofs)
{
//Ring CT Stuff

View File

@@ -75,7 +75,7 @@ bool construct_miner_tx_fake_reward_1out(const size_t height,
height,
coinbase_enotes);
tx = carrot::store_carrot_to_coinbase_transaction_v1(coinbase_enotes, "");
tx = carrot::store_carrot_to_coinbase_transaction_v1(coinbase_enotes, "", cryptonote::transaction_type::MINER);
}
else // !is_carrot
{