Compare commits

...

2 Commits

Author SHA1 Message Date
Richard Holland
8c235ec8b1 Merge branch 'dev' into manifestKeylet 2026-09-26 13:28:35 +10:00
Richard Holland
37dfdc64b3 fix keylet api 2026-09-26 13:22:36 +10:00
3 changed files with 31 additions and 0 deletions

View File

@@ -38,6 +38,7 @@
#define KEYLET_HOOK_DEFINITION 24
#define KEYLET_HOOK_STATE_DIR 25
#define KEYLET_CRON 26
#define KEYLET_MANIFEST 37
#define COMPARE_EQUAL 1U
#define COMPARE_LESS 2U

View File

@@ -313,6 +313,7 @@ enum keylet_code : uint32_t {
MPTOKEN = 34,
CREDENTIAL = 35,
PERMISSIONED_DOMAIN = 36,
MANIFEST = 37,
};
}

View File

@@ -2212,6 +2212,35 @@ DEFINE_HOOK_FUNCTION(
return serialize_keylet(kl, memory, write_ptr, write_len);
}
// keylets that take a validator public key
case keylet_code::MANIFEST: {
if (!applyCtx.view().rules().enabled(featureOnChainManifests))
return INVALID_ARGUMENT;
if (a == 0 || b == 0)
return INVALID_ARGUMENT;
if (c != 0 || d != 0 || e != 0 || f != 0)
return INVALID_ARGUMENT;
uint32_t read_ptr = a, read_len = b;
if (NOT_IN_BOUNDS(read_ptr, read_len, memory_length))
return OUT_OF_BOUNDS;
ripple::Slice const pkSlice{memory + read_ptr, read_len};
// Reject anything that is not a well-formed public key before
// constructing one: the PublicKey ctor throws on bad input.
if (!publicKeyType(pkSlice))
return INVALID_ARGUMENT;
ripple::Keylet kl =
ripple::keylet::manifest(ripple::PublicKey(pkSlice));
return serialize_keylet(kl, memory, write_ptr, write_len);
}
// keylets that take 20 byte account id, and (4 byte uint for 32
// byte hash)
case keylet_code::ORACLE: {