feat: Hook up le_arr_len host function

This commit is contained in:
TimothyBanks
2026-08-10 17:18:56 -04:00
parent c619ae0263
commit 930ba88921
11 changed files with 103 additions and 1 deletions

View File

@@ -313,6 +313,23 @@ HostContext::getCurrentLedgerObjArrayLen(std::int32_t field) const noexcept
});
}
std::int32_t
HostContext::getLedgerObjArrayLen(std::int32_t cacheIdx, std::int32_t field) const noexcept
{
return guarded(hostFunctions_.getJournal(), kHostInternal, [&] {
auto const& knownSFields = SField::getKnownCodeToField();
auto const it = knownSFields.find(field);
if (it == knownSFields.end())
return hfErrorToInt(HostFunctionError::InvalidField);
auto const len = hostFunctions_.getLedgerObjArrayLen(cacheIdx, *it->second);
if (!len)
return hfErrorToInt(len.error());
return *len;
});
}
std::int32_t
HostContext::sha512Half(rust::Slice<std::uint8_t const> data, rust::Slice<std::uint8_t> out)
const noexcept