mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-25 21:15:49 +00:00
change HookOn to uint256
This commit is contained in:
@@ -240,6 +240,268 @@ namespace hook_api
|
||||
const double fee_base_multiplier = 1.1f;
|
||||
|
||||
|
||||
// RH TODO: there's definitely a mucher nicer way to do this, but it involves modifying the base_uint
|
||||
// class and we don't want to do that yet.
|
||||
static const std::array<ripple::uint256, 256> UINT256_BIT =
|
||||
{
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000001"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000002"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000004"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000008"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000010"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000020"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000040"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000080"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000100"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000200"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000400"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000800"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000001000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000002000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000004000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000008000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000010000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000020000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000040000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000080000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000100000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000200000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000400000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000800000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000001000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000002000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000004000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000008000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000010000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000020000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000040000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000080000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000100000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000200000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000400000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000800000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000001000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000002000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000004000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000008000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000010000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000020000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000040000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000080000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000100000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000200000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000400000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000800000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000001000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000002000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000004000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000008000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000010000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000020000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000040000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000080000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000100000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000200000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000400000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000800000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000001000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000002000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000004000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000008000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000010000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000020000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000040000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000080000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000100000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000200000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000400000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000800000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000001000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000002000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000004000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000008000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000010000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000020000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000040000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000080000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000100000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000200000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000400000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000800000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000001000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000002000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000004000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000008000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000010000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000020000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000040000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000080000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000100000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000200000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000400000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000800000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000001000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000002000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000004000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000008000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000010000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000020000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000040000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000080000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000100000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000200000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000400000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000800000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000001000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000002000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000004000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000008000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000010000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000020000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000040000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000080000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000100000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000200000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000400000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000800000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000001000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000002000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000004000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000008000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000010000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000020000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000040000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000080000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000100000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000200000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000400000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000800000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000001000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000002000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000004000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000008000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000010000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000020000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000040000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000080000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000100000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000200000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000400000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000800000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000001000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000002000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000004000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000008000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000010000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000020000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000040000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000080000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000100000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000200000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000400000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000800000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000001000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000002000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000004000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000008000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000010000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000020000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000040000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000080000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000100000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000200000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000400000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000800000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000001000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000002000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000004000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000008000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000010000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000020000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000040000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000080000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000100000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000200000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000400000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000800000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000001000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000002000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000004000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000008000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000010000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000020000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000040000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000080000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000100000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000200000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000400000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000800000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000001000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000002000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000004000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000008000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000010000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000020000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000040000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000080000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000100000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000200000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000400000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000800000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000001000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000002000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000004000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000008000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000010000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000020000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000040000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000080000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000100000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000200000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000400000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000800000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000001000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000002000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000004000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000008000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000010000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000020000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000040000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000080000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000100000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000200000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000400000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000800000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000001000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000002000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000004000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000008000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000010000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000020000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000040000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000080000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000100000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000200000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000400000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000800000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0001000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0002000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0004000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0008000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0010000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0020000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0040000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0080000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0100000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0200000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0400000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0800000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("1000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("2000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("4000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("8000000000000000000000000000000000000000000000000000000000000000")
|
||||
};
|
||||
|
||||
// RH NOTE: Find descriptions of api functions in ./impl/applyHook.cpp and hookapi.h (include for hooks)
|
||||
static const std::set<std::string> import_whitelist
|
||||
{
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace hook_api
|
||||
namespace hook
|
||||
{
|
||||
|
||||
bool canHook(ripple::TxType txType, uint64_t hookOn);
|
||||
bool canHook(ripple::TxType txType, ripple::uint256 hookOn);
|
||||
|
||||
struct HookResult;
|
||||
|
||||
|
||||
@@ -748,12 +748,15 @@ hook::removeHookNamespaceEntry(
|
||||
// from the right is 0 then the hook will trigger on ESCROW_FINISH. If it is 1 then ESCROW_FINISH will not trigger
|
||||
// the hook. However ttHOOK_SET = 22 is active high, so by default (HookOn == 0) ttHOOK_SET is not triggered by
|
||||
// transactions. If you wish to set a hook that has control over ttHOOK_SET then set bit 1U<<22.
|
||||
bool hook::canHook(ripple::TxType txType, uint64_t hookOn) {
|
||||
bool hook::canHook(ripple::TxType txType, ripple::uint256 hookOn) {
|
||||
|
||||
// invert ttHOOK_SET bit
|
||||
hookOn ^= (1ULL << ttHOOK_SET);
|
||||
hookOn ^= UINT256_BIT[ttHOOK_SET];
|
||||
|
||||
// invert entire field
|
||||
hookOn ^= 0xFFFFFFFFFFFFFFFFULL;
|
||||
return (hookOn >> txType) & 1;
|
||||
hookOn = ~hookOn;
|
||||
|
||||
return (hookOn & UINT256_BIT[txType]) != beast::zero;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1150,9 +1150,9 @@ SetHook::setHook()
|
||||
std::optional<ripple::uint256> newNamespace;
|
||||
std::optional<ripple::Keylet> newDirKeylet;
|
||||
|
||||
std::optional<uint64_t> oldHookOn;
|
||||
std::optional<uint64_t> newHookOn;
|
||||
std::optional<uint64_t> defHookOn;
|
||||
std::optional<uint256> oldHookOn;
|
||||
std::optional<uint256> newHookOn;
|
||||
std::optional<uint256> defHookOn;
|
||||
|
||||
// when hsoCREATE is invoked it populates this variable in case the hook definition already exists
|
||||
// and the operation falls through into a hsoINSTALL operation instead
|
||||
@@ -1205,10 +1205,10 @@ SetHook::setHook()
|
||||
oldDirKeylet = keylet::hookStateDir(account_, *oldNamespace);
|
||||
oldDirSLE = view().peek(*oldDirKeylet);
|
||||
if (oldDefSLE)
|
||||
defHookOn = oldDefSLE->getFieldU64(sfHookOn);
|
||||
defHookOn = oldDefSLE->getFieldH256(sfHookOn);
|
||||
|
||||
if (oldHook->get().isFieldPresent(sfHookOn))
|
||||
oldHookOn = oldHook->get().getFieldU64(sfHookOn);
|
||||
oldHookOn = oldHook->get().getFieldH256(sfHookOn);
|
||||
else if (defHookOn)
|
||||
oldHookOn = *defHookOn;
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ SetHook::setHook()
|
||||
}
|
||||
|
||||
if (hookSetObj->get().isFieldPresent(sfHookOn))
|
||||
newHookOn = hookSetObj->get().getFieldU64(sfHookOn);
|
||||
newHookOn = hookSetObj->get().getFieldH256(sfHookOn);
|
||||
|
||||
if (hookSetObj->get().isFieldPresent(sfHookNamespace))
|
||||
{
|
||||
@@ -1322,7 +1322,7 @@ SetHook::setHook()
|
||||
// initially carry over the prior non-array values, whatever those were
|
||||
newHook.setFieldH256(sfHookHash, oldHook->get().getFieldH256(sfHookHash));
|
||||
if (oldHook->get().isFieldPresent(sfHookOn))
|
||||
newHook.setFieldU64(sfHookOn, oldHook->get().getFieldU64(sfHookOn));
|
||||
newHook.setFieldH256(sfHookOn, oldHook->get().getFieldH256(sfHookOn));
|
||||
if (oldHook->get().isFieldPresent(sfHookNamespace))
|
||||
newHook.setFieldH256(sfHookNamespace, oldHook->get().getFieldH256(sfHookNamespace));
|
||||
|
||||
@@ -1347,7 +1347,7 @@ SetHook::setHook()
|
||||
newHook.makeFieldAbsent(sfHookOn);
|
||||
}
|
||||
else
|
||||
newHook.setFieldU64(sfHookOn, *newHookOn);
|
||||
newHook.setFieldH256(sfHookOn, *newHookOn);
|
||||
}
|
||||
|
||||
// parameters
|
||||
@@ -1488,7 +1488,7 @@ SetHook::setHook()
|
||||
|
||||
auto newHookDef = std::make_shared<SLE>( keylet );
|
||||
newHookDef->setFieldH256(sfHookHash, *createHookHash);
|
||||
newHookDef->setFieldU64( sfHookOn, *newHookOn);
|
||||
newHookDef->setFieldH256( sfHookOn, *newHookOn);
|
||||
newHookDef->setFieldH256( sfHookNamespace, *newNamespace);
|
||||
newHookDef->setFieldArray( sfHookParameters,
|
||||
hookSetObj->get().isFieldPresent(sfHookParameters)
|
||||
@@ -1566,7 +1566,7 @@ SetHook::setHook()
|
||||
|
||||
// change which definition we're using to the new target
|
||||
defNamespace = newDefSLE->getFieldH256(sfHookNamespace);
|
||||
defHookOn = newDefSLE->getFieldU64(sfHookOn);
|
||||
defHookOn = newDefSLE->getFieldH256(sfHookOn);
|
||||
|
||||
// set the namespace if it differs from the definition namespace
|
||||
if (newNamespace && *defNamespace != *newNamespace)
|
||||
@@ -1574,7 +1574,7 @@ SetHook::setHook()
|
||||
|
||||
// set the hookon field if it differs from definition
|
||||
if (newHookOn && *defHookOn != *newHookOn)
|
||||
newHook.setFieldU64(sfHookOn, *newHookOn);
|
||||
newHook.setFieldH256(sfHookOn, *newHookOn);
|
||||
|
||||
// parameters
|
||||
TER result =
|
||||
|
||||
@@ -211,9 +211,9 @@ calculateHookChainFee(
|
||||
}
|
||||
|
||||
// check if the hook can fire
|
||||
uint64_t hookOn = (hookObj->isFieldPresent(sfHookOn)
|
||||
? hookObj->getFieldU64(sfHookOn)
|
||||
: hookDef->getFieldU64(sfHookOn));
|
||||
uint256 hookOn = (hookObj->isFieldPresent(sfHookOn)
|
||||
? hookObj->getFieldH256(sfHookOn)
|
||||
: hookDef->getFieldH256(sfHookOn));
|
||||
|
||||
uint32_t flags = 0;
|
||||
if (hookObj->isFieldPresent(sfFlags))
|
||||
@@ -990,9 +990,9 @@ executeHookChain(
|
||||
}
|
||||
|
||||
// check if the hook can fire
|
||||
uint64_t hookOn = (hookObj->isFieldPresent(sfHookOn)
|
||||
? hookObj->getFieldU64(sfHookOn)
|
||||
: hookDef->getFieldU64(sfHookOn));
|
||||
uint256 hookOn = (hookObj->isFieldPresent(sfHookOn)
|
||||
? hookObj->getFieldH256(sfHookOn)
|
||||
: hookDef->getFieldH256(sfHookOn));
|
||||
|
||||
if (!hook::canHook(ctx_.tx.getTxnType(), hookOn))
|
||||
continue; // skip if it can't
|
||||
|
||||
@@ -422,7 +422,6 @@ extern SF_UINT64 const sfEmitBurden;
|
||||
extern SF_UINT64 const sfNFTokenOfferNode;
|
||||
|
||||
// 64-bit integers (uncommon)
|
||||
extern SF_UINT64 const sfHookOn;
|
||||
extern SF_UINT64 const sfHookInstructionCount;
|
||||
extern SF_UINT64 const sfHookReturnCode;
|
||||
extern SF_UINT64 const sfReferenceCount;
|
||||
@@ -442,6 +441,7 @@ extern SF_UINT256 const sfLedgerHash;
|
||||
extern SF_UINT256 const sfParentHash;
|
||||
extern SF_UINT256 const sfTransactionHash;
|
||||
extern SF_UINT256 const sfAccountHash;
|
||||
extern SF_UINT256 const sfHookOn;
|
||||
extern SF_UINT256 const sfPreviousTxnID;
|
||||
extern SF_UINT256 const sfLedgerIndex;
|
||||
extern SF_UINT256 const sfWalletLocator;
|
||||
|
||||
@@ -173,7 +173,7 @@ CONSTRUCT_TYPED_SFIELD(sfNFTokenOfferNode, "NFTokenOfferNode", UINT64,
|
||||
CONSTRUCT_TYPED_SFIELD(sfEmitBurden, "EmitBurden", UINT64, 13);
|
||||
|
||||
// 64-bit integers (uncommon)
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookOn, "HookOn", UINT64, 16);
|
||||
// 16 used to be HookOn until it was expanded to UINT256
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookInstructionCount, "HookInstructionCount", UINT64, 17);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookReturnCode, "HookReturnCode", UINT64, 18);
|
||||
CONSTRUCT_TYPED_SFIELD(sfReferenceCount, "ReferenceCount", UINT64, 19);
|
||||
@@ -208,7 +208,7 @@ CONSTRUCT_TYPED_SFIELD(sfBookDirectory, "BookDirectory", UINT256,
|
||||
CONSTRUCT_TYPED_SFIELD(sfInvoiceID, "InvoiceID", UINT256, 17);
|
||||
CONSTRUCT_TYPED_SFIELD(sfNickname, "Nickname", UINT256, 18);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAmendment, "Amendment", UINT256, 19);
|
||||
// 20 is currently unused
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookOn, "HookOn", UINT256, 20);
|
||||
CONSTRUCT_TYPED_SFIELD(sfDigest, "Digest", UINT256, 21);
|
||||
CONSTRUCT_TYPED_SFIELD(sfChannel, "Channel", UINT256, 22);
|
||||
CONSTRUCT_TYPED_SFIELD(sfConsensusHash, "ConsensusHash", UINT256, 23);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
#include <ripple/app/hook/Enum.h>
|
||||
#include <ripple/app/tx/impl/SetHook.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
@@ -470,7 +471,7 @@ public:
|
||||
for (auto const& [key, value] : JSSMap{
|
||||
{jss::HookGrants, Json::arrayValue},
|
||||
{jss::HookParameters, Json::arrayValue},
|
||||
{jss::HookOn, "0"},
|
||||
{jss::HookOn, "0000000000000000000000000000000000000000000000000000000000000000"},
|
||||
{jss::HookApiVersion, "0"},
|
||||
{jss::HookNamespace, to_string(uint256{beast::zero})}})
|
||||
{
|
||||
@@ -631,7 +632,7 @@ public:
|
||||
for (auto const& [key, value] : JSSMap{
|
||||
{jss::HookGrants, Json::arrayValue},
|
||||
{jss::HookParameters, Json::arrayValue},
|
||||
{jss::HookOn, "0"},
|
||||
{jss::HookOn, "0000000000000000000000000000000000000000000000000000000000000000"},
|
||||
{jss::HookApiVersion, "0"},
|
||||
})
|
||||
{
|
||||
@@ -773,7 +774,7 @@ public:
|
||||
Json::Value iv;
|
||||
iv[jss::CreateCode] = strHex(accept_wasm);
|
||||
iv[jss::HookApiVersion] = 0U;
|
||||
iv[jss::HookOn] = uint64_hex(0);
|
||||
iv[jss::HookOn] = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
jv[jss::Hooks][0U] = Json::Value{};
|
||||
jv[jss::Hooks][0U][jss::Hook] = iv;
|
||||
|
||||
@@ -789,7 +790,7 @@ public:
|
||||
Json::Value iv;
|
||||
iv[jss::CreateCode] = strHex(accept_wasm);
|
||||
iv[jss::HookNamespace] = to_string(uint256{beast::zero});
|
||||
iv[jss::HookOn] = uint64_hex(0);
|
||||
iv[jss::HookOn] = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
jv[jss::Hooks][0U] = Json::Value{};
|
||||
jv[jss::Hooks][0U][jss::Hook] = iv;
|
||||
|
||||
@@ -806,7 +807,7 @@ public:
|
||||
iv[jss::CreateCode] = strHex(accept_wasm);
|
||||
iv[jss::HookNamespace] = to_string(uint256{beast::zero});
|
||||
iv[jss::HookApiVersion] = 1U;
|
||||
iv[jss::HookOn] = uint64_hex(0);
|
||||
iv[jss::HookOn] = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
jv[jss::Hooks][0U] = Json::Value{};
|
||||
jv[jss::Hooks][0U][jss::Hook] = iv;
|
||||
|
||||
@@ -987,7 +988,7 @@ public:
|
||||
iv[jss::CreateCode] = strHex(accept_wasm);
|
||||
iv[jss::HookNamespace] = to_string(uint256{beast::zero});
|
||||
iv[jss::HookApiVersion] = 0U;
|
||||
iv[jss::HookOn] = uint64_hex(0);
|
||||
iv[jss::HookOn] = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
iv[jss::HookParameters] = Json::Value{Json::arrayValue};
|
||||
iv[jss::HookParameters][0U] = Json::Value{};
|
||||
iv[jss::HookParameters][0U][jss::HookParameter] = Json::Value{};
|
||||
@@ -1066,7 +1067,7 @@ public:
|
||||
grants[0U][jss::HookGrant][jss::HookHash] = accept_hash_str;
|
||||
|
||||
for (auto const& [key, value] : JSSMap{
|
||||
{jss::HookOn, "1"},
|
||||
{jss::HookOn, "0000000000000000000000000000000000000000000000000000000000000001"},
|
||||
{jss::HookNamespace,
|
||||
"CAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE"
|
||||
"CAFECAFE"},
|
||||
@@ -1093,7 +1094,7 @@ public:
|
||||
|
||||
// check all fields were updated to correct values
|
||||
BEAST_REQUIRE(hooks[0].isFieldPresent(sfHookOn));
|
||||
BEAST_EXPECT(hooks[0].getFieldU64(sfHookOn) == 1ULL);
|
||||
BEAST_EXPECT(hooks[0].getFieldH256(sfHookOn) == hook_api::UINT256_BIT[0]);
|
||||
|
||||
auto const ns = uint256::fromVoid(
|
||||
(std::array<uint8_t, 32>{
|
||||
@@ -1129,7 +1130,7 @@ public:
|
||||
// reset hookon and namespace to defaults
|
||||
{
|
||||
for (auto const& [key, value] : JSSMap{
|
||||
{jss::HookOn, "0"},
|
||||
{jss::HookOn, "0000000000000000000000000000000000000000000000000000000000000000"},
|
||||
{jss::HookNamespace, to_string(uint256{beast::zero})}})
|
||||
{
|
||||
Json::Value iv;
|
||||
@@ -1369,7 +1370,7 @@ public:
|
||||
grants[0U][jss::HookGrant][jss::HookHash] = accept_hash_str;
|
||||
|
||||
for (auto const& [key, value] : JSSMap{
|
||||
{jss::HookOn, "1"},
|
||||
{jss::HookOn, "0000000000000000000000000000000000000000000000000000000000000001"},
|
||||
{jss::HookNamespace,
|
||||
"CAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE"
|
||||
"CAFECAFE"},
|
||||
@@ -1571,7 +1572,7 @@ public:
|
||||
// hsoUPDATE
|
||||
{
|
||||
STObject hso{sfHook};
|
||||
hso.setFieldU64(sfHookOn, 1LLU);
|
||||
hso.setFieldH256(sfHookOn, hook_api::UINT256_BIT[0]);
|
||||
BEAST_EXPECT(SetHook::inferOperation(hso) == hsoUPDATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ hso(std::vector<uint8_t> const& wasmBytes, void (*f)(Json::Value& jv) = 0);
|
||||
Json::Value
|
||||
hso_delete(void (*f)(Json::Value& jv) = 0);
|
||||
|
||||
std::string uint64_hex(uint64_t x);
|
||||
|
||||
} // namespace jtx
|
||||
} // namespace test
|
||||
} // namespace ripple
|
||||
|
||||
@@ -45,27 +45,6 @@ hook(Account const& account, std::optional<std::vector<Json::Value>> hooks, std:
|
||||
return jv;
|
||||
}
|
||||
|
||||
|
||||
std::string uint64_hex(uint64_t x)
|
||||
{
|
||||
auto const nibble = [](uint64_t n) -> char
|
||||
{
|
||||
n &= 0x0FU;
|
||||
return
|
||||
n <= 9 ? '0' + n :
|
||||
'A' + (n - 10);
|
||||
};
|
||||
return std::string("") +
|
||||
nibble(x >> 60U) + nibble(x >> 56U) +
|
||||
nibble(x >> 52U) + nibble(x >> 48U) +
|
||||
nibble(x >> 44U) + nibble(x >> 40U) +
|
||||
nibble(x >> 36U) + nibble(x >> 32U) +
|
||||
nibble(x >> 28U) + nibble(x >> 24U) +
|
||||
nibble(x >> 20U) + nibble(x >> 16U) +
|
||||
nibble(x >> 12U) + nibble(x >> 8U) +
|
||||
nibble(x >> 4U) + nibble(x >> 0U);
|
||||
}
|
||||
|
||||
Json::Value
|
||||
hso_delete(void (*f)(Json::Value& jv))
|
||||
{
|
||||
@@ -89,7 +68,7 @@ hso(std::vector<uint8_t> const& wasmBytes, void (*f)(Json::Value& jv))
|
||||
Json::Value jv;
|
||||
jv[jss::CreateCode] = strHex(wasmBytes);
|
||||
{
|
||||
jv[jss::HookOn] = uint64_hex(0);
|
||||
jv[jss::HookOn] = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
jv[jss::HookNamespace] = to_string(uint256{beast::zero});
|
||||
jv[jss::HookApiVersion] = Json::Value{0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user