Update unit tests for current Vexta codebase

This commit is contained in:
Capri 2026-09-09 20:43:47 +00:00
commit 6103c1ef22
Signed by: VextaProject
SSH key fingerprint: SHA256:739BZv8LvIDY2tR7lXLy/IQ6MaGTQtYcG9GNvCjmpVM
2 changed files with 1 additions and 45 deletions

View file

@ -189,15 +189,6 @@ static void TestHKDF_SHA256_32(const std::string &ikm_hex, const std::string &sa
BOOST_CHECK(HexStr(out) == okm_check_hex);
}
static void TestOdo(uint32_t key, const std::string &in, const std::string &hexout)
{
assert(in.length() == OdoCrypt::DIGEST_SIZE);
std::vector<unsigned char> out = ParseHex(hexout);
std::vector<unsigned char> outres(OdoCrypt::DIGEST_SIZE);
OdoCrypt(key).Encrypt(reinterpret_cast<char*>(outres.data()), in.c_str());
BOOST_CHECK(out == outres);
}
static std::string LongTestString()
{
std::string ret;
@ -509,28 +500,6 @@ BOOST_AUTO_TEST_CASE(chacha20_testvector)
"fab78c9");
}
BOOST_AUTO_TEST_CASE(odo_testvector)
{
TestOdo(0, "00000000000000000000000000000000000000000000000000000000000000000000000000000000",
"9724ebfef40d7808bc21b212d8645a1df4d7fc4a0d91ee8e7f747ca1383eaeb1bb264b3a3b1b1f19"
"a8d458616e9a19572e3ceb2f58773076e829a288c8fdb61ab619ffaa84a4ee752fea52dbb359620e");
TestOdo(1, "00000000000000000000000000000000000000000000000000000000000000000000000000000000",
"c659c70bd9335a0bec67e526cdf99569543ca7e258fad19d439fb8ada1bc68efa5553d270d236cf0"
"3b1c179c684cfc93ae15b3c239c11e384303785cc0d828114c28e08091f42ec707aba712fe999c68");
TestOdo(0x80808080u, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopqopqrpqrsqrstrstustuvtuvw",
"dc5d9757b16bfa425f527817ee88a070595a662474d06bb96b439e25bc3097fc7068ab9d934fcd19"
"c9587478dd9ab8f79f2c85175c51e49306135e561561725b0aa7a44366a1135ff93194da22d1e9ba");
TestOdo(0x12345678, "As DigiByte relies on 80 byte header hashes, we want to have an example for that",
"13dddebb0d65daa0f3e4a5bd9a1b74af7ca5a7b32ef118fb1684b200e377ce504346adcd2354e818"
"bf530dd870386104f706f4fecde1cec5cee804aae2569821aa5b2db3ac048607be36714e2bce48c6");
TestOdo(1729, test1.substr(0x4ffb0, OdoCrypt::DIGEST_SIZE),
"de79362f40cf0c755b21cf30798fa828b21cba61222ebeccc5a1ee385183ff2a981926403529080f"
"6c5a650bb299770222e7dbc0bdd559f479fac21d08044d306513067f2bf6accdb8b55942a5430e1c");
TestOdo(0xD59, "Mora labelled me Unknown Sample, which the overseer translated as Odo'ital......",
"a7dd19a7fcdf3b7c0a8da1765553d903ff42687fe2f36c3930b82d7a68e426a90f49f1fc4b06263d"
"cf95d70a1b436337586955ef61c976f97785da2d2c8144b6767f824d53dd518c2cfdce1e9bd74fe1");
}
BOOST_AUTO_TEST_CASE(poly1305_testvector)
{
// RFC 7539, section 2.5.2.
@ -784,19 +753,6 @@ BOOST_AUTO_TEST_CASE(sha256d64)
}
}
BOOST_AUTO_TEST_CASE(odo_permutation)
{
char buf[OdoCrypt::DIGEST_SIZE];
for (int i = 0; i < OdoCrypt::DIGEST_SIZE; i++)
buf[i] = i;
for (int i = 0; i < 20; i++)
OdoCrypt(i).Encrypt(buf, buf);
for (int i = 19; i >= 0; i--)
OdoCrypt(i).Decrypt(buf, buf);
for (int i = 0; i < OdoCrypt::DIGEST_SIZE; i++)
BOOST_CHECK(buf[i] == i);
}
static void TestSHA3_256(const std::string& input, const std::string& output)
{
const auto in_bytes = ParseHex(input);

View file

@ -334,7 +334,7 @@ static void check_computeblockversion(const Consensus::Params& params, Consensus
// Next we will advance to the next period and transition to STARTED,
}
lastBlock = firstChain.Mine(params.nMinerConfirmationWindow * 3, nTime).Tip();
lastBlock = firstChain.Mine(params.nMinerConfirmationWindow * 3, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip();
// so ComputeBlockVersion should now set the bit,
BOOST_CHECK((g_versionbitscache.ComputeBlockVersion(lastBlock, params) & (1 << bit)) != 0);
// and should also be using the VERSIONBITS_TOP_BITS.