Electroneum
bulletproofs.cpp File Reference
#include "gtest/gtest.h"
#include "string_tools.h"
#include "ringct/rctOps.h"
#include "ringct/rctSigs.h"
#include "ringct/bulletproofs.h"
#include "cryptonote_basic/blobdatatype.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "device/device.hpp"
#include "misc_log_ex.h"
Include dependency graph for bulletproofs.cpp:

Go to the source code of this file.

Functions

 TEST (bulletproofs, valid_zero)
 
 TEST (bulletproofs, valid_max)
 
 TEST (bulletproofs, valid_random)
 
 TEST (bulletproofs, valid_multi_random)
 
 TEST (bulletproofs, multi_splitting)
 
 TEST (bulletproofs, valid_aggregated)
 
 TEST (bulletproofs, invalid_8)
 
 TEST (bulletproofs, invalid_31)
 
 TEST (bulletproofs, invalid_gamma_0)
 
 TEST (bulletproofs, invalid_torsion)
 
 TEST (bulletproof, weight_equal)
 
 TEST (bulletproof, weight_more)
 

Function Documentation

◆ TEST() [1/12]

TEST ( bulletproofs  ,
valid_zero   
)

Definition at line 42 of file bulletproofs.cpp.

43 {
46 }
bool bulletproof_VERIFY(const Bulletproof &proof)
void skGen(key &sk)
Definition: rctOps.cpp:253
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [2/12]

TEST ( bulletproofs  ,
valid_max   
)

Definition at line 48 of file bulletproofs.cpp.

49 {
50  rct::Bulletproof proof = bulletproof_PROVE(0xffffffffffffffff, rct::skGen());
52 }
bool bulletproof_VERIFY(const Bulletproof &proof)
void skGen(key &sk)
Definition: rctOps.cpp:253
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [3/12]

TEST ( bulletproofs  ,
valid_random   
)

Definition at line 54 of file bulletproofs.cpp.

55 {
56  for (int n = 0; n < 8; ++n)
57  {
58  rct::Bulletproof proof = bulletproof_PROVE(crypto::rand<uint64_t>(), rct::skGen());
60  }
61 }
bool bulletproof_VERIFY(const Bulletproof &proof)
void skGen(key &sk)
Definition: rctOps.cpp:253
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [4/12]

TEST ( bulletproofs  ,
valid_multi_random   
)

Definition at line 63 of file bulletproofs.cpp.

64 {
65  for (int n = 0; n < 8; ++n)
66  {
67  size_t outputs = 2 + n;
68  std::vector<uint64_t> amounts;
69  rct::keyV gamma;
70  for (size_t i = 0; i < outputs; ++i)
71  {
72  amounts.push_back(crypto::rand<uint64_t>());
73  gamma.push_back(rct::skGen());
74  }
75  rct::Bulletproof proof = bulletproof_PROVE(amounts, gamma);
77  }
78 }
bool bulletproof_VERIFY(const Bulletproof &proof)
std::vector< key > keyV
Definition: rctTypes.h:88
void skGen(key &sk)
Definition: rctOps.cpp:253
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [5/12]

TEST ( bulletproofs  ,
multi_splitting   
)

Definition at line 80 of file bulletproofs.cpp.

81 {
82  rct::ctkeyV sc, pc;
83  rct::ctkey sctmp, pctmp;
84  std::vector<unsigned int> index;
85  std::vector<uint64_t> inamounts, outamounts;
86 
87  std::tie(sctmp, pctmp) = rct::ctskpkGen(6000);
88  sc.push_back(sctmp);
89  pc.push_back(pctmp);
90  inamounts.push_back(6000);
91  index.push_back(1);
92 
93  std::tie(sctmp, pctmp) = rct::ctskpkGen(7000);
94  sc.push_back(sctmp);
95  pc.push_back(pctmp);
96  inamounts.push_back(7000);
97  index.push_back(1);
98 
99  const int mixin = 3, max_outputs = 16;
100 
101  for (int n_outputs = 1; n_outputs <= max_outputs; ++n_outputs)
102  {
103  std::vector<uint64_t> outamounts;
104  rct::keyV amount_keys;
105  rct::keyV destinations;
106  rct::key Sk, Pk;
107  uint64_t available = 6000 + 7000;
108  uint64_t amount;
109  rct::ctkeyM mixRing(sc.size());
110 
111  //add output
112  for (size_t i = 0; i < n_outputs; ++i)
113  {
114  amount = rct::randEtnAmount(available);
115  outamounts.push_back(amount);
116  amount_keys.push_back(rct::hash_to_scalar(rct::zero()));
117  rct::skpkGen(Sk, Pk);
118  destinations.push_back(Pk);
119  available -= amount;
120  }
121 
122  for (size_t i = 0; i < sc.size(); ++i)
123  {
124  for (size_t j = 0; j <= mixin; ++j)
125  {
126  if (j == 1)
127  mixRing[i].push_back(pc[i]);
128  else
129  mixRing[i].push_back({rct::scalarmultBase(rct::skGen()), rct::scalarmultBase(rct::skGen())});
130  }
131  }
132 
133  rct::ctkeyV outSk;
135  rct::rctSig s = rct::genRctSimple(rct::zero(), sc, destinations, inamounts, outamounts, available, mixRing, amount_keys, NULL, NULL, index, outSk, rct_config, hw::get_device("default"));
136  ASSERT_TRUE(rct::verRctSimple(s));
137  for (size_t i = 0; i < n_outputs; ++i)
138  {
139  rct::key mask;
140  rct::decodeRctSimple(s, amount_keys[i], i, mask, hw::get_device("default"));
141  ASSERT_TRUE(mask == outSk[i].mask);
142  }
143  }
144 }
rctSig genRctSimple(const key &message, const ctkeyV &inSk, const keyV &destinations, const vector< etn_amount > &inamounts, const vector< etn_amount > &outamounts, etn_amount txnFee, const ctkeyM &mixRing, const keyV &amount_keys, const std::vector< multisig_kLRki > *kLRki, multisig_out *msout, const std::vector< unsigned int > &index, ctkeyV &outSk, const RCTConfig &rct_config, hw::device &hwdev)
Definition: rctSigs.cpp:752
tuple< ctkey, ctkey > ctskpkGen(etn_amount amount)
Definition: rctOps.cpp:302
std::vector< key > keyV
Definition: rctTypes.h:88
device & get_device(const std::string &device_descriptor)
Definition: device.cpp:95
std::vector< ctkey > ctkeyV
Definition: rctTypes.h:100
unsigned __int64 uint64_t
Definition: stdint.h:136
void hash_to_scalar(key &hash, const void *data, const std::size_t l)
Definition: rctOps.cpp:536
void skGen(key &sk)
Definition: rctOps.cpp:253
etn_amount randEtnAmount(etn_amount upperlimit)
Definition: rctOps.cpp:343
void scalarmultBase(key &aG, const key &a)
Definition: rctOps.cpp:350
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
void skpkGen(key &sk, key &pk)
Definition: rctOps.cpp:284
std::vector< ctkeyV > ctkeyM
Definition: rctTypes.h:101
key zero()
Definition: rctOps.h:70
etn_amount decodeRctSimple(const rctSig &rv, const key &sk, unsigned int i, key &mask, hw::device &hwdev)
Definition: rctSigs.cpp:1180
Here is the call graph for this function:

◆ TEST() [6/12]

TEST ( bulletproofs  ,
valid_aggregated   
)

Definition at line 146 of file bulletproofs.cpp.

147 {
148  static const size_t N_PROOFS = 8;
149  std::vector<rct::Bulletproof> proofs(N_PROOFS);
150  for (size_t n = 0; n < N_PROOFS; ++n)
151  {
152  size_t outputs = 2 + n;
153  std::vector<uint64_t> amounts;
154  rct::keyV gamma;
155  for (size_t i = 0; i < outputs; ++i)
156  {
157  amounts.push_back(crypto::rand<uint64_t>());
158  gamma.push_back(rct::skGen());
159  }
160  proofs[n] = bulletproof_PROVE(amounts, gamma);
161  }
163 }
bool bulletproof_VERIFY(const Bulletproof &proof)
std::vector< key > keyV
Definition: rctTypes.h:88
void skGen(key &sk)
Definition: rctOps.cpp:253
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [7/12]

TEST ( bulletproofs  ,
invalid_8   
)

Definition at line 166 of file bulletproofs.cpp.

167 {
168  rct::key invalid_amount = rct::zero();
169  invalid_amount[8] = 1;
170  rct::Bulletproof proof = bulletproof_PROVE(invalid_amount, rct::skGen());
172 }
bool bulletproof_VERIFY(const Bulletproof &proof)
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
void skGen(key &sk)
Definition: rctOps.cpp:253
key zero()
Definition: rctOps.h:70
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [8/12]

TEST ( bulletproofs  ,
invalid_31   
)

Definition at line 174 of file bulletproofs.cpp.

175 {
176  rct::key invalid_amount = rct::zero();
177  invalid_amount[31] = 1;
178  rct::Bulletproof proof = bulletproof_PROVE(invalid_amount, rct::skGen());
180 }
bool bulletproof_VERIFY(const Bulletproof &proof)
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
void skGen(key &sk)
Definition: rctOps.cpp:253
key zero()
Definition: rctOps.h:70
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [9/12]

TEST ( bulletproofs  ,
invalid_gamma_0   
)

Definition at line 182 of file bulletproofs.cpp.

183 {
184  rct::key invalid_amount = rct::zero();
185  invalid_amount[8] = 1;
186  rct::key gamma = rct::zero();
187  rct::Bulletproof proof = bulletproof_PROVE(invalid_amount, gamma);
189 }
bool bulletproof_VERIFY(const Bulletproof &proof)
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
key zero()
Definition: rctOps.h:70
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
Here is the call graph for this function:

◆ TEST() [10/12]

TEST ( bulletproofs  ,
invalid_torsion   
)

Definition at line 202 of file bulletproofs.cpp.

203 {
204  rct::Bulletproof proof = bulletproof_PROVE(7329838943733, rct::skGen());
206  for (const auto &xs: torsion_elements)
207  {
208  rct::key x;
211  for (auto &k: proof.V)
212  {
213  const rct::key org_k = k;
214  rct::addKeys(k, org_k, x);
216  k = org_k;
217  }
218  for (auto &k: proof.L)
219  {
220  const rct::key org_k = k;
221  rct::addKeys(k, org_k, x);
223  k = org_k;
224  }
225  for (auto &k: proof.R)
226  {
227  const rct::key org_k = k;
228  rct::addKeys(k, org_k, x);
230  k = org_k;
231  }
232  const rct::key org_A = proof.A;
233  rct::addKeys(proof.A, org_A, x);
235  proof.A = org_A;
236  const rct::key org_S = proof.S;
237  rct::addKeys(proof.S, org_S, x);
239  proof.S = org_S;
240  const rct::key org_T1 = proof.T1;
241  rct::addKeys(proof.T1, org_T1, x);
243  proof.T1 = org_T1;
244  const rct::key org_T2 = proof.T2;
245  rct::addKeys(proof.T2, org_T2, x);
247  proof.T2 = org_T2;
248  }
249 }
bool isInMainSubgroup(const key &A)
Definition: rctOps.cpp:412
rct::key S
Definition: rctTypes.h:182
bool bulletproof_VERIFY(const Bulletproof &proof)
rct::key T2
Definition: rctTypes.h:182
rct::keyV R
Definition: rctTypes.h:184
rct::key A
Definition: rctTypes.h:182
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
bool hex_to_pod(const std::string &hex_str, t_pod_type &s)
Definition: string_tools.h:324
void skGen(key &sk)
Definition: rctOps.cpp:253
rct::keyV L
Definition: rctTypes.h:184
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
rct::key T1
Definition: rctTypes.h:182
void addKeys(key &AB, const key &A, const key &B)
Definition: rctOps.cpp:420
Bulletproof bulletproof_PROVE(const rct::key &v, const rct::key &gamma)
rct::keyV V
Definition: rctTypes.h:181
Here is the call graph for this function:

◆ TEST() [11/12]

TEST ( bulletproof  ,
weight_equal   
)

Definition at line 251 of file bulletproofs.cpp.

252 {
253  static const char *tx_hex = "02000102000b849b08f2b70b9891019707a8081bc7040d9f0b55d3019669afc83528a6e18454cf13ca392a581098c067df30e66dee8aaddf14c61a8f020002775faa070d3b3ab1d9de66deb402f635aca2580191bce277c26fef7c00cb3f3500025c9c10a978bfe085d42a7b73980f53eab4cbfde73d8023e21978ec8a467375e22101a340cd8bc95636a0ba6ffe5ebfda5eb637d44ad73c32150a469008cb870d22aa03d0cca632f376c5417327569d497d42f09386c5dd4b5efecd9dd20719861ef5aed810e70d824e8e77189c35e6d79993eeeea77b219106df29dd9e77370e7f2fb5ead175064ba8a59397a3ce6804bde23b4d90039c5ad4d1282bc23f791221bc185d70b30d84dda556348a3b9af09513946a03c190b9c53fbeb970a286b1ff8d462630ef0a2737ff40f238461e8ed3eedb8f2a01492abcb96e116ae9d51c4b35e9ba2f3bbe78228618f17a5708c0e30a47b7ed15d4a20ded508f9daddd92e07c6e74167cdf0100000099c4e562de6abd309b4cc26ab41aac39eb0eb252468f79bc5369eae8ba7f94ef2d795fb6b61a0e69e6a95dd3e257615188e80bc1c90c5f571028bb9d2b99c13d41a1e1a770e592ae7a9cda9014f6d4f3233d30f062b774a7241b6e0bb0b83b4a3e36200234a288fcf65cf8a35dfd7710dc5ece5d7abb5ec58451f1cbd41513b1bb6190c609c25e2a2b94eadfe22e8a9eb28ea3d16fa49cb1eb4d7f5c3706b50e7ae60cedf6af2c3e8dc8f96113c029749ae2b266090cc2e6650cf0a869f6c20b0792987702834ff278516dccbd3cff94a6ff36361178a302b37a62c9134b50739228430306ff2bc6a6d282d4cfa9bf6b92486f0e0dd594f2334296e248514c28436b3e86f9d527a8b1ed9f6ed09fa48514364df41d50cb3d376b71b3585cad9de30c465302ae91818ce42eb77e26a31242b4f1255f455df49409197a6d0e468f2c2d781684bb697a785ac77d41950901e9b67a2a4d6a3ec05fffec9e3a0313c972120ac3f5e01f1bc595438d7e07ff6de4ede96915a8696bcbaf449fae978565eceaebe2c3bd2f8315c535ff25fa8924fc2d49e0cb7ecc1c3fd72ce821513fa113078fda233e1588022c6267ba2f78a8a4f9ac8c7ea2dc4dca464902f46fb92702db8d26afa628f2aa182c2b34768a2b0581e7196ce041e73924af51d713db75093bf292e4263be8fc08a0b2f531e1a10ce79b95ab1fab726478cea8e79e0313ffc895069938ecf7ed14a037577f4f461ae6cde9bae6ade8a1d9e46040321b250d7ff9f3612b278757717596040dc58e7f68687b72c1ba71f36daeeb7ebdcbfd77d3518dff7d0fee252887ee38db33dffd714924d5823c539288d581eba17053beb273a13ca6f43132da705308bdc53c80c45e347bffb5c1fae7907369598660ce2c70d34083fec197b914c3b77f50e57ec54d89d0031df92a1241d40f9ea3ed14008ecc339323118ad22adca5c56687f854bc5fd47a3223016eee46e7d94b31a101df22d87b1404bbceaaaab2a8bde72aa318d3364e8926119d792cad21e51faf0cbd5ea0bbe939c5bcfbaa489dfda38aa124f3fc007b9e58f55ad8acd25d17a40bd4c1c17e03610fecb789702b0b8a4aa3a79028a7292212c550dec72f2c356f02bc0f2a0513ae07892143b8aa5ab30e9f6d71eeb3df2ea64a839b5b857000db043bf506a26953a909116b10cdce03a27d549db2f51f9a341c721bb0e442b5d0034038fbb0cd2ef27fb48f5acbd6b4104af18a98a1692d10d59884fcd2eb4641000ac32df57b5dcf387c4c097e5e7e702b2f07cdb18a69d5c69a5f7e135a9f8e020670758a1e4d955878de2f93181adfddd8cff4d20365c4663e870ff09d6b15065bbd81555d6aeb92e07ebbeae426cd0ab982a03ffeec31627ae140cd1e78f60ab6a55811d9d4051d50050c9e920e0b11c526530e613e0d3f925271f90ef0990e3df2c46170153e553a0035c0e8e87d957f40f072fd6b1ff30ee7aca3af88c40f1c255b3546dba9d23f352c729a0466729918336560df233843734e7dad57960f8d5592a299f6b762efdbd37aa0ff5310c940d03622023146a042079c8097fe01606594ab3578d0c0a90f8088d5c93504896ed80e809d22bf9483bf62398feb06099904cc23480b27709845ef1e26059d4730aeb5c2bb34c2ff34bff3c1a1c10a5898584fac078225bd435541fd2f4244e14118c8a08af7a3027d41b7af62420d12ba05466f905fe49882db44994180a1a549acfec42549254feda65aa6ee0c0e35e5a7525ae373ea0053fd536d4b6605ee833a0fa85e863807c30f02b46fde0305864da7d10f60b44ec1c2944a45de27912a39cebdc0ae18034397e4f5cfaf0ebe9ea5b225e80075f1bf6ac2211b7512870cc556e685a2464bf91100b36e5d0ea64af85d92d2aa1c2625e5bcbe93352a92dec8d735e54a2e6dfba6a91cc7c40e5c883d932769ce2d57b21ba898a2437ae6a39cfda1f3adefab0241548ad88104cbf113df4d1a243a5ae639b75169ae60b2c0dd1091a994e2a4d6d3536e3f4405a723c50ba4e9f822a2de189fd8158b0aa94c4b6255e5d4b504f789e4036d4206e8afd25693198f7bb3b04c23a6dc83f09260ae7c83726d4d524e7f9f851c39f5";
257  crypto::hash tx_hash, tx_prefix_hash;
258  ASSERT_TRUE(parse_and_validate_tx_from_blob(bd, tx, tx_hash, tx_prefix_hash));
259  ASSERT_TRUE(tx.version == 4);
261  const uint64_t tx_size = bd.size();
262  const uint64_t tx_weight = cryptonote::get_transaction_weight(tx);
263  ASSERT_TRUE(tx_weight == tx_size); // it has two outputs, <= 2 makes weight == size
264 }
::std::string string
Definition: gtest-port.h:1097
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
uint8_t type
Definition: rctTypes.h:241
bool is_rct_bulletproof(int type)
Definition: rctTypes.cpp:227
unsigned __int64 uint64_t
Definition: stdint.h:136
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
std::string blobdata
Definition: blobdatatype.h:39
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
POD_CLASS hash
Definition: hash.h:50
bool parse_hexstr_to_binbuff(const epee::span< const char > s, epee::span< char > &res)
Definition: string_tools.h:92
Here is the call graph for this function:

◆ TEST() [12/12]

TEST ( bulletproof  ,
weight_more   
)

Definition at line 266 of file bulletproofs.cpp.

267 {
268  static const char *tx_hex = "02000102000be98714944aeb01c006c80cbd0aaa04e5023e9003fa089669afc83528a6e18454cf13ca392a581098c067df30e66dee8aaddf14c61a8f040002377a0483ad63d58e7667a8325349c89e41e9ad5dce5aef30204fd4a6dc8eb7a100022a518afc3d690a992150646c559a24add698c98e87e732244cf2855cb7d0cff10002485a8de9d099c96fce8f26ad320cd627a6bb188f719c380517861c031aa65011000218ebf7b40a5ba25fb98ad7c6543239c2a3343b9e7cfd5140280e587c8f930f0d2101b330267408724dcf7fc2902e7d74a7962995e7905cc5d043fa1c8c6379e0eccd03e089bb498d0fffca61afd0d61f4875e8b32fa63f8729c654bba5f167199b7b518433680242640504c7568d273b2a74fe2d204dbb97eea4724ee5a2cf19eb3349ec3a2602a244de2a33c62bbfaa0b4cb85bf36863f765b237138929e43462e4bf19684d0924fd73c30bee474f0e927e8eb84dd6cc987acaf41e19e2f1e07381bd95e0f504964c8d10793972e88d64683a4a3960a9645735a76cc62d99e7a87b62c3cb590ca9dc27f91e9103c1b55ece5d5a932a04c99bf019463455b5d78397bd2295be075af5ae9bf0e43e724e11f83f336ca3c1bd9601c7fd6642795e8618b5c5b9d0045a6766daf2118f994b418504c6939b94c72e875423989ea7069d73e8d02f7b0bd9c1c7eb2289eaeda5fabd8142ee0ebafcbe101c58e99034d0c9ca34a703180e1dd7000e9f11cb4bcbe11f0c0041a0cc30f5b8b3bd7f2ace0266dd0282aea17f088c88e98a22f764e32507d1c900ef50b1157b49dbfda2fd9a2ea3be5182fb10fa590b464907049d88ff9c33fbe6d8b05898abf196dd097e1009d9bd1a1997830100000006ccdcc8aa53e183578656540fa393e6d9f96c07497b9dd009b48e8f990a75be18f5f37a47ff07f3c4d6427626afc5d24897ad31a98d01cc44476fba41f6bc3dc3de91d2655130090393e3ebcb7f436470edefff5aa11fa1016fecccf1824a5cdd66ea51dcd8f0193a6e507309d6a13680605febb971c3df4cceac5078be996c0d686c72627696e6961447145143e23cae2c97686524c0587b6cce7b05851b087d658a795bd22de18c0f68e824e1673c47f4b7f4ba7d4bedd95f46ffc22d9409087a58a80088679d3775e46f75dc6dc48f485a2c35a8dd60e7dabe29f656cbaad8d25a5e01d165fa9df29acd6e2471c4880d3129fd110066788de9c979f03d9c2e46ab80bf0dbd24ac6aaba2db0d723e1ba3a002efd2aebf245a2fd53767fa490244396284826b64a4a3f069f21047486a27c5ebdf802c23d8d276b9c83fa2e329aefb953ad34f382975204706c14249a496791cd3d20f4bd98d8f6325f5e7d7aa2d1f8b23361434f74584136cf1ead94365a6ce134159141fa4c68660a99ad90caa8c711abe5411dffa7132f8ce71dba63619e1410380c56766c79ff8e433eb806f49bca6f1bcb0c66dfd61c3133e7c095a11abd068b6a5774a02a5825cbd82a408d5580ee4dbe9a4ba07282f5a764279ad27f7ac27e7cccb3c76b5dd64be7bbdf3ecc4abcc29bc561e81cbc502ed3a4ce277b567a6eb09dfd8454c4d4e8c038b9dd6042a0515b0d1dfbb45585e79ca5705a22fcb3c67bc0261cc0cec6998354448e83fa7ff8706178e14a482e73719df33c9d753757131f3560391be2dd6c40391e3e7882ea07bb23c4d2d157349965082e1447e94849fde224452f6c98efa44f6438b731859fac8f49761e4447e8d34275e7dd9ae01d8550dcc75284715e026d25e9c444265fb4fee3f783ff2a2a5c414714a57525738884bbdbd8d997dbbcafcafd8e283b524bef0ded141160f47ce352b2104257b312d12594de45a0241d9753ec19e2f8603b5fc8682d72bf1de51d7f4caa7026989a7e46b9dd41075ad480df9de6a952e8562e548e3576e9c9230cb2cd0ee7f955e2d29240d7fa55b8e0b0b6c92823d9636592c460af670bb0b8714ca626497c68403793fe8495a7542c60587d117e3adb3644e62053817fa600910e2dfad97b2a7492ac6fa13c0a9a03e0ce12c3d12a09a4e22b9d0d74b9d431d53252fcbd06cb119d128646042eef81002fc6e9ff5006e06247f40f0391ad095c0d50a78863c975edbf0498e58ba7e6e0505d5eaa4d8ba2aa3f40e728f1a6aef6b2f9f5705cc3d2591bb5b878c258b4107857dc6ee75d591ea7af7b16196cd6c979a0bf819db39658491889c83a41c2c0035116fcac23ac45144731592ea0e3a11c335a278b2a6798d46828c8590b92701468e9d9c3560ed58c3ab861995aca439ee49ecf4a5b0ad160a12bd23a437f90c383095e85a95bb441bcb8dc1752e805e85d1ee0f6967ce95dcd888efa7ac440813c78b11d56d2a1b870c59d36430b10cd28bc693c4f64e769acfbcff27d8e904e0ca7e73aab5439de571b66f91fe9c05264e070aa223b68e5de763d838985e0ec0e8ac0dd0b1f6eb1e145c4473f9edda5732b1f9d3627423b5c60e055377bd044ff30017d25b3d26b5590b53d8aeaf10ce73d86fe4c40fa14e6f710f72c7da0600e7fc495a75a875d1aeee246b70cf24a8a85fba2d31f96faa42ece112b9030987ce0e735ab51eb4222a48bc51ab69d644bda77fb2aa0cd3a0477a2a2d92510103dbd58ee1c28eb20cfb31f5268f4a70a431ff4aedbfdfc59ea6709283a51902202effba960da6170b1a25c26a52890da54757c93156d250540590266eed8c00647270cb302cff7cbe4a8ed27da21dbaa303d1aea0eb152e1f6fd24dbdfaea0c5b0f5d6acb6724cf711ec3194a94f52f8cce13e1e3d1d7758d3d7e3cd37fd1011265199eb4126975687ce958dd1a75b6a71cf397fb618003e85af842dc3ff50a134411bbe18a1dea4beeb1e8d1ca5ac67f7f6ce2bbdeb2efcf6dcfdef64b360d4fb1849947800a3595e0a8029b631a06508b5d9f4f6e6a1be110524e5584f209b9db1651ddc8571102a58e7823dcf026f89d59ca213b6c6e32088d6c4967b20b28ffe86aed6c11d6aa0072691ff133d7bbc6d013629faebadc087c0f4f84d106677013893be4ca55018fbafcc2cee8be4ad0bcf1ad8762ec0c285e8c414bb204";
272  crypto::hash tx_hash, tx_prefix_hash;
273  ASSERT_TRUE(parse_and_validate_tx_from_blob(bd, tx, tx_hash, tx_prefix_hash));
274  ASSERT_TRUE(tx.version == 4);
276  const uint64_t tx_size = bd.size();
277  const uint64_t tx_weight = cryptonote::get_transaction_weight(tx);
278  ASSERT_TRUE(tx_weight > tx_size); // it has four outputs, > 2 makes weight > size
279 }
::std::string string
Definition: gtest-port.h:1097
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
uint8_t type
Definition: rctTypes.h:241
bool is_rct_bulletproof(int type)
Definition: rctTypes.cpp:227
unsigned __int64 uint64_t
Definition: stdint.h:136
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
std::string blobdata
Definition: blobdatatype.h:39
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
POD_CLASS hash
Definition: hash.h:50
bool parse_hexstr_to_binbuff(const epee::span< const char > s, epee::span< char > &res)
Definition: string_tools.h:92
Here is the call graph for this function: