Once men turned their thinking over to machines in the hope that this would set them free.

But that only permitted other men with machines to enslave them.

      --  Reverend Mother Gaius Helen Mohiam
This commit is contained in:
Duke Leto
2020-12-09 07:23:08 -05:00
parent 710559576c
commit 6a30b40415
30 changed files with 346 additions and 458 deletions

View File

@@ -123,16 +123,16 @@ public:
return true;
}
bool GetNotarisationData(uint256 notarisationHash, NotarisationData &data) const
bool GetNotarizationData(uint256 notarisationHash, NotarizationData &data) const
{
if (notarisationHash == NotarisationHash()) {
if (notarisationHash == NotarizationHash()) {
data.MoM = MoM;
return true;
}
return false;
}
static uint256 NotarisationHash()
static uint256 NotarizationHash()
{
uint256 h;
h.begin()[0] = 123;
@@ -206,7 +206,7 @@ public:
int nIndex = 5;
std::vector<uint256> vBranch;
vBranch.resize(3);
return {MerkleBranch(nIndex, vBranch), EvalMock::NotarisationHash()};
return {MerkleBranch(nIndex, vBranch), EvalMock::NotarizationHash()};
}
CMutableTransaction ImportPayoutTx()
@@ -562,7 +562,7 @@ TEST_F(TestBet, testImportPayoutMangleSessionId)
}
TEST_F(TestBet, testImportPayoutInvalidNotarisationHash)
TEST_F(TestBet, testImportPayoutInvalidNotarizationHash)
{
EvalMock eval = ebet.SetEvalMock(12);

View File

@@ -21,7 +21,7 @@
extern int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
namespace TestEvalNotarisation {
namespace TestEvalNotarization {
class EvalMock : public Eval
@@ -96,14 +96,14 @@ namespace TestEvalNotarisation {
static auto vMomProof = ParseHex("0303faecbdd4b3da128c2cd2701bb143820a967069375b2ec5b612f39bbfe78a8611978871c193457ab1e21b9520f4139f113b8d75892eb93ee247c18bccfd067efed7eacbfcdc8946cf22de45ad536ec0719034fb9bc825048fe6ab61fee5bd6e9aae0bb279738d46673c53d68eb2a72da6dbff215ee41a4d405a74ff7cd355805b"); // $ fiat/bots txMoMproof $proofTxHash
/*
TEST(TestEvalNotarisation, testGetNotarisation)
TEST(TestEvalNotarization, testGetNotarization)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
SetupEval(eval, notary, noop);
NotarisationData data;
ASSERT_TRUE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data;
ASSERT_TRUE(eval.GetNotarizationData(notary.GetHash(), data));
EXPECT_EQ(data.height, 77455);
EXPECT_EQ(data.blockHash.GetHex(), "000030ef29d072f417cec86ad5a5ab4f8c413c7f96f572a098e45d6e3e0f8eae");
EXPECT_STREQ(data.symbol, "BOTS");
@@ -116,7 +116,7 @@ namespace TestEvalNotarisation {
}
TEST(TestEvalNotarisation, testInvalidNotaryPubkey)
TEST(TestEvalNotarization, testInvalidNotaryPubkey)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
@@ -124,13 +124,13 @@ TEST(TestEvalNotarisation, testInvalidNotaryPubkey)
memset(eval.notaries[10], 0, 33);
NotarisationData data;
ASSERT_FALSE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data;
ASSERT_FALSE(eval.GetNotarizationData(notary.GetHash(), data));
}
*/
TEST(TestEvalNotarisation, testInvalidNotarisationBadOpReturn)
TEST(TestEvalNotarization, testInvalidNotarizationBadOpReturn)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
@@ -138,12 +138,12 @@ TEST(TestEvalNotarisation, testInvalidNotarisationBadOpReturn)
notary.vout[1].scriptPubKey = CScript() << OP_RETURN << 0;
SetupEval(eval, notary, noop);
NotarisationData data(0);
ASSERT_FALSE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data(0);
ASSERT_FALSE(eval.GetNotarizationData(notary.GetHash(), data));
}
TEST(TestEvalNotarisation, testInvalidNotarisationTxNotEnoughSigs)
TEST(TestEvalNotarization, testInvalidNotarizationTxNotEnoughSigs)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
@@ -152,24 +152,24 @@ TEST(TestEvalNotarisation, testInvalidNotarisationTxNotEnoughSigs)
tx.vin.resize(10);
});
NotarisationData data(0);
ASSERT_FALSE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data(0);
ASSERT_FALSE(eval.GetNotarizationData(notary.GetHash(), data));
}
TEST(TestEvalNotarisation, testInvalidNotarisationTxDoesntExist)
TEST(TestEvalNotarization, testInvalidNotarizationTxDoesntExist)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
SetupEval(eval, notary, noop);
NotarisationData data(0);
ASSERT_FALSE(eval.GetNotarisationData(uint256(), data));
NotarizationData data(0);
ASSERT_FALSE(eval.GetNotarizationData(uint256(), data));
}
TEST(TestEvalNotarisation, testInvalidNotarisationDupeNotary)
TEST(TestEvalNotarization, testInvalidNotarizationDupeNotary)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
@@ -178,12 +178,12 @@ TEST(TestEvalNotarisation, testInvalidNotarisationDupeNotary)
tx.vin[1] = tx.vin[3];
});
NotarisationData data(0);
ASSERT_FALSE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data(0);
ASSERT_FALSE(eval.GetNotarizationData(notary.GetHash(), data));
}
TEST(TestEvalNotarisation, testInvalidNotarisationInputNotCheckSig)
TEST(TestEvalNotarization, testInvalidNotarizationInputNotCheckSig)
{
EvalMock eval;
CMutableTransaction notary(notaryTx);
@@ -197,10 +197,10 @@ TEST(TestEvalNotarisation, testInvalidNotarisationInputNotCheckSig)
eval.txs[txIn.GetHash()] = CTransaction(txIn);
});
NotarisationData data(0);
ASSERT_FALSE(eval.GetNotarisationData(notary.GetHash(), data));
NotarizationData data(0);
ASSERT_FALSE(eval.GetNotarizationData(notary.GetHash(), data));
}
} /* namespace TestEvalNotarisation */
} /* namespace TestEvalNotarization */

View File

@@ -10,42 +10,42 @@
#include "testutils.h"
namespace TestParseNotarisation {
namespace TestParseNotarization {
class TestParseNotarisation : public ::testing::Test, public Eval {};
class TestParseNotarization : public ::testing::Test, public Eval {};
TEST(TestParseNotarisation, test_ee2fa)
TEST(TestParseNotarization, test_ee2fa)
{
// ee2fa47820a31a979f9f21cb3fedbc484bf9a8957cb6c9acd0af28ced29bdfe1
std::vector<uint8_t> opret = ParseHex("c349ff90f3bce62c1b7b49d1da0423b1a3d9b733130cce825b95b9e047c729066e020d00743a06fdb95ad5775d032b30bbb3680dac2091a0f800cf54c79fd3461ce9b31d4b4d4400");
NotarisationData nd;
NotarizationData nd;
ASSERT_TRUE(E_UNMARSHAL(opret, ss >> nd));
}
TEST(TestParseNotarisation, test__)
TEST(TestParseNotarization, test__)
{
// 576e910a1f704207bcbcf724124ff9adc5237f45cb6919589cd0aa152caec424
std::vector<uint8_t> opret = ParseHex("b3ed7fbbfbc027caeeeec81e65489ec5d9cd47cda675a5cbb75b4a845e67cf0ef6330300b5a6bd8385feb833f3be961c9d8a46fcecd36dcdfa42ad81a20a892433722f0b4b4d44004125a06024eae24c11f36ea110acd707b041d5355b6e1b42de5e2614357999c6aa02000d26ad0300000000404b4c000000000005130300500d000061f22ba7d19fe29ac3baebd839af8b7127d1f90755534400");
NotarisationData nd;
NotarizationData nd;
// We can't parse this one
ASSERT_FALSE(E_UNMARSHAL(opret, ss >> nd));
}
TEST(TestParseNotarisation, test__a)
TEST(TestParseNotarization, test__a)
{
// be55101e6c5a93fb3611a44bd66217ad8714d204275ea4e691cfff9d65dff85c TXSCL
std::vector<uint8_t> opret = ParseHex("fb9ea2818eec8b07f8811bab49d64379db074db478997f8114666f239bd79803cc460000d0fac4e715b7e2b917a5d79f85ece0c423d27bd3648fd39ac1dc7db8e1bd4b16545853434c00a69eab9f23d7fb63c4624973e7a9079d6ada2f327040936356d7af5e849f6d670a0003001caf7b7b9e1c9bc59d0c7a619c9683ab1dd0794b6f3ea184a19f8fda031150e700000000");
NotarisationData nd(1);
NotarizationData nd(1);
bool res = E_UNMARSHAL(opret, ss >> nd);
ASSERT_TRUE(res);
}
TEST(TestParseNotarisation, test__b)
TEST(TestParseNotarization, test__b)
{
// 03085dafed656aaebfda25bf43ffe9d1fb72565bb1fc8b2a12a631659f28f877 TXSCL
std::vector<uint8_t> opret = ParseHex("48c71a10aa060eab1a43f52acefac3b81fb2a2ce310186b06141884c0501d403c246000052e6d49afd82d9ab3d97c996dd9b6a78a554ffa1625e8dadf0494bd1f8442e3e545853434c007cc5c07e3b67520fd14e23cd5b49f2aa022f411500fd3326ff91e6dc0544a1c90c0003008b69117bb1376ac8df960f785d8c208c599d3a36248c98728256bb6d4737e59600000000");
NotarisationData nd(1);
NotarizationData nd(1);
bool res = E_UNMARSHAL(opret, ss >> nd);
ASSERT_TRUE(res);
}