diff --git a/src/test/app/ConsensusEntropy_test.cpp b/src/test/app/ConsensusEntropy_test.cpp index 24c136236..95166476a 100644 --- a/src/test/app/ConsensusEntropy_test.cpp +++ b/src/test/app/ConsensusEntropy_test.cpp @@ -538,7 +538,10 @@ class ConsensusEntropy_test : public beast::unit_test::suite if (bad_random_tier != INVALID_ARGUMENT) return accept(0, 0, bad_random_tier); - return accept(0, 0, 0); + // Sentinel distinct from any dice (0..5) / random result and + // from INVALID_ARGUMENT, so a regression that lets a bad + // requirement through returns its own code, not this one. + return accept(0, 0, 42); } )[test.hook]"]; @@ -559,7 +562,9 @@ class ConsensusEntropy_test : public beast::unit_test::suite auto const hookExecutions = meta->getFieldArray(sfHookExecutions); BEAST_REQUIRE(hookExecutions.size() == 1); - BEAST_EXPECT(hookReturnCode(hookExecutions[0]) == 0); + // 42 only if all four invalid requirements were rejected; any bad + // requirement leaking through returns its own (non-42) code. + BEAST_EXPECT(hookReturnCode(hookExecutions[0]) == 42); BEAST_EXPECT(hookExecutions[0].getFieldU8(sfHookResult) == 3); } diff --git a/src/test/app/ConsensusEntropy_test_hooks.h b/src/test/app/ConsensusEntropy_test_hooks.h index 72e3231e3..39f16ffec 100644 --- a/src/test/app/ConsensusEntropy_test_hooks.h +++ b/src/test/app/ConsensusEntropy_test_hooks.h @@ -280,7 +280,10 @@ inline std::map> consensusentropy_test_wasm = if (bad_random_tier != INVALID_ARGUMENT) return accept(0, 0, bad_random_tier); - return accept(0, 0, 0); + // Sentinel distinct from any dice (0..5) / random result and + // from INVALID_ARGUMENT, so a regression that lets a bad + // requirement through returns its own code, not this one. + return accept(0, 0, 42); } )[test.hook]", { @@ -313,7 +316,7 @@ inline std::map> consensusentropy_test_wasm = 0x04U, 0x41U, 0x00U, 0x10U, 0x03U, 0x22U, 0x01U, 0x42U, 0x79U, 0x52U, 0x04U, 0x40U, 0x41U, 0x00U, 0x41U, 0x00U, 0x20U, 0x01U, 0x10U, 0x02U, 0x0CU, 0x01U, 0x0BU, 0x41U, 0x00U, 0x41U, 0x00U, - 0x42U, 0x00U, 0x10U, 0x02U, 0x0BU, 0x21U, 0x01U, 0x20U, 0x00U, + 0x42U, 0x2AU, 0x10U, 0x02U, 0x0BU, 0x21U, 0x01U, 0x20U, 0x00U, 0x41U, 0x20U, 0x6AU, 0x24U, 0x00U, 0x20U, 0x01U, 0x0BU, }},