Skip to content

Commit

Permalink
fixes for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Nov 24, 2024
1 parent 60fbeef commit 104c38c
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 38 deletions.
3 changes: 2 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ libbitcoin_node_a_SOURCES = \
blsct/set_mem_proof/set_mem_proof.cpp \
blsct/set_mem_proof/set_mem_proof_setup.cpp \
blsct/set_mem_proof/set_mem_proof_prover.cpp \
blsct/tokens/rpc.cpp \
blsct/wallet/rpc.cpp \
blsct/wallet/verification.cpp \
blsct/signature.cpp \
Expand Down Expand Up @@ -980,6 +979,8 @@ libbitcoin_common_a_SOURCES = \
blsct/set_mem_proof/set_mem_proof_prover.cpp \
blsct/set_mem_proof/set_mem_proof_setup.cpp \
blsct/signature.cpp \
blsct/tokens/predicate_exec.cpp \
blsct/tokens/predicate_parser.cpp \
blsct/wallet/address.cpp \
blsct/wallet/txfactory_global.cpp \
chainparams.cpp \
Expand Down
39 changes: 23 additions & 16 deletions src/blsct/external_api/blsct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,51 +881,58 @@ const BlsctPoint* get_tx_out_range_proof_A(const CTxOut* tx_out) {
return copy;
}

const BlsctPoint* get_tx_out_range_proof_S(const CTxOut* tx_out) {
const BlsctPoint* get_tx_out_range_proof_A_wip(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctPoint*>(malloc(POINT_SIZE));
auto org = tx_out->blsctData.rangeProof.S.GetVch();
auto org = tx_out->blsctData.rangeProof.A_wip.GetVch();
std::memcpy(copy, &org[0], POINT_SIZE);
return copy;
}

const BlsctPoint* get_tx_out_range_proof_T1(const CTxOut* tx_out) {
const BlsctPoint* get_tx_out_range_proof_B(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctPoint*>(malloc(POINT_SIZE));
auto org = tx_out->blsctData.rangeProof.T1.GetVch();
auto org = tx_out->blsctData.rangeProof.B.GetVch();
std::memcpy(copy, &org[0], POINT_SIZE);
return copy;
}

const BlsctPoint* get_tx_out_range_proof_T2(const CTxOut* tx_out) {
auto copy = static_cast<BlsctPoint*>(malloc(POINT_SIZE));
auto org = tx_out->blsctData.rangeProof.T2.GetVch();
std::memcpy(copy, &org[0], POINT_SIZE);
const BlsctScalar* get_tx_out_range_proof_r_prime(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctScalar*>(malloc(SCALAR_SIZE));
auto org = tx_out->blsctData.rangeProof.r_prime.GetVch();
std::memcpy(copy, &org[0], SCALAR_SIZE);
return copy;
}

const BlsctScalar* get_tx_out_range_proof_mu(const CTxOut* tx_out) {
const BlsctScalar* get_tx_out_range_proof_s_prime(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctScalar*>(malloc(SCALAR_SIZE));
auto org = tx_out->blsctData.rangeProof.mu.GetVch();
auto org = tx_out->blsctData.rangeProof.s_prime.GetVch();
std::memcpy(copy, &org[0], SCALAR_SIZE);
return copy;
}

const BlsctScalar* get_tx_out_range_proof_a(const CTxOut* tx_out) {
const BlsctScalar* get_tx_out_range_proof_delta_prime(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctScalar*>(malloc(SCALAR_SIZE));
auto org = tx_out->blsctData.rangeProof.a.GetVch();
auto org = tx_out->blsctData.rangeProof.delta_prime.GetVch();
std::memcpy(copy, &org[0], SCALAR_SIZE);
return copy;
}

const BlsctScalar* get_tx_out_range_proof_b(const CTxOut* tx_out) {
const BlsctScalar* get_tx_out_range_proof_alpha_hat(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctScalar*>(malloc(SCALAR_SIZE));
auto org = tx_out->blsctData.rangeProof.b.GetVch();
auto org = tx_out->blsctData.rangeProof.alpha_hat.GetVch();
std::memcpy(copy, &org[0], SCALAR_SIZE);
return copy;
}

const BlsctScalar* get_tx_out_range_proof_t_hat(const CTxOut* tx_out) {
const BlsctScalar* get_tx_out_range_proof_tau_x(const CTxOut* tx_out)
{
auto copy = static_cast<BlsctScalar*>(malloc(SCALAR_SIZE));
auto org = tx_out->blsctData.rangeProof.t_hat.GetVch();
auto org = tx_out->blsctData.rangeProof.tau_x.GetVch();
std::memcpy(copy, &org[0], SCALAR_SIZE);
return copy;
}
Expand Down
20 changes: 7 additions & 13 deletions src/blsct/external_api/blsct.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,19 +386,13 @@ const BlsctPoint* get_tx_out_blinding_key(const CTxOut* tx_out);
uint16_t get_tx_out_view_tag(const CTxOut* tx_out);

const BlsctPoint* get_tx_out_range_proof_A(const CTxOut* tx_out);
const BlsctPoint* get_tx_out_range_proof_S(const CTxOut* tx_out);
const BlsctPoint* get_tx_out_range_proof_T1(const CTxOut* tx_out);
const BlsctPoint* get_tx_out_range_proof_T2(const CTxOut* tx_out);

const BlsctScalar* get_tx_out_range_proof_mu(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_a(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_b(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_t_hat(const CTxOut* tx_out);

const BlsctSignature* sign_message(
const BlsctScalar* blsct_priv_key,
const char* blsct_msg
);
const BlsctPoint* get_tx_out_range_proof_A_wip(const CTxOut* tx_out);
const BlsctPoint* get_tx_out_range_proof_B(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_r_prime(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_s_prime(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_delta_prime(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_alpha_hat(const CTxOut* tx_out);
const BlsctScalar* get_tx_out_range_proof_tau_x(const CTxOut* tx_out);

bool verify_msg_sig(
const BlsctPubKey* blsct_pub_key,
Expand Down
8 changes: 8 additions & 0 deletions src/blsct/range_proof/bulletproofs_plus/range_proof.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ struct RangeProofWithoutVs {
}
};

template <typename T>
struct RangeProofCompressedForRecovery {
FORMATTER_METHODS(RangeProof<T>, obj)
{
READWRITE(Using<range_proof::ProofBase<T>>(obj), obj.A_wip, obj.B, obj.alpha_hat, obj.tau_x);
}
};

} // namespace bulletproofs_plus

#endif // NAVIO_BLSCT_RANGE_PROOF_BULLETPROOFS_PLUS_RANGE_PROOF_H
2 changes: 2 additions & 0 deletions src/blsct/tokens/predicate_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <blsct/tokens/info.h>
#include <blsct/tokens/predicate.h>

#include <variant>

namespace blsct {
enum PredicateOperation : uint8_t {
CREATE_TOKEN,
Expand Down
2 changes: 1 addition & 1 deletion src/blsct/tokens/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void TokenToUniValue(UniValue& obj, const blsct::TokenEntry& token)
for (auto& it2 : it.second) {
nftMetadata.pushKV(it2.first, it2.second);
}
mintedNft.pushKV(std::to_string(it.first), nftMetadata);
mintedNft.pushKV(strprintf("%llu", it.first), nftMetadata);
}
obj.pushKV("mintedNft", mintedNft);
}
Expand Down
14 changes: 14 additions & 0 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ class CTxOutBLSCTData
}
};

struct CTxOutBLSCTDataCompressedForRecovery {
FORMATTER_METHODS(CTxOutBLSCTData, obj)
{
READWRITE(Using<bulletproofs_plus::RangeProofCompressedForRecovery<Mcl>>(obj.rangeProof), obj.spendingKey, obj.blindingKey, obj.ephemeralKey, obj.viewTag);
}
};

/** An output of a transaction. It contains the public key that the next input
* must be able to sign with to claim it.
*/
Expand Down Expand Up @@ -374,6 +381,13 @@ class CTxOut
uint256 GetHash() const;
};

struct CTxOutCompressedForRecovery {
FORMATTER_METHODS(CTxOut, obj)
{
READWRITE(Using<CTxOutBLSCTDataCompressedForRecovery>(obj.blsctData), obj.nValue, obj.scriptPubKey, obj.tokenId, obj.viewTag);
}
};

struct CMutableTransaction;

struct TransactionSerParams {
Expand Down
4 changes: 2 additions & 2 deletions test/functional/blsct_nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run_test(self):
tokens = self.nodes[0].listtokens()
assert len(tokens) == 1, "length of tokens is not 1"

self.log.info(f"Created token: {token["tokenId"]}")
self.log.info(f"Created token: {token['tokenId']}")

assert tokens[0]['type'] == 'nft', "token type is not token"
assert tokens[0]['metadata'] == {'name': 'Test'}, "incorrect metadata"
Expand Down Expand Up @@ -108,4 +108,4 @@ def run_test(self):


if __name__ == '__main__':
NavioBlsctNftTest().main()
NavioBlsctNftTest().main()
4 changes: 2 additions & 2 deletions test/functional/blsct_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run_test(self):
tokens = self.nodes[0].listtokens()
assert len(tokens) == 1, "length of tokens is not 1"

self.log.info(f"Created token: {token["tokenId"]}")
self.log.info(f"Created token: {token['tokenId']}")

assert tokens[0]['type'] == 'token', "token type is not token"
assert tokens[0]['metadata'] == {'name': 'Test'}, "incorrect metadata"
Expand Down Expand Up @@ -108,4 +108,4 @@ def run_test(self):


if __name__ == '__main__':
NavioBlsctTokenTest().main()
NavioBlsctTokenTest().main()
3 changes: 0 additions & 3 deletions test/functional/wallet_reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ def birthtime_test(self, node, miner_wallet):
if self.options.descriptors:
# For descriptors, verify the wallet updated the birth time to the transaction time
assert_equal(tx_info['time'], wallet_watch_only.getwalletinfo()['birthtime'])
else:
# For legacy, as the birth time was set to the beginning of time, verify it did not change
assert_equal(wallet_birthtime, 1)

wallet_watch_only.unloadwallet()

Expand Down

0 comments on commit 104c38c

Please sign in to comment.