Skip to content

Fix raw key write issue#954

Draft
shyba wants to merge 2 commits into
edgefrom
expr/hb-store-perf
Draft

Fix raw key write issue#954
shyba wants to merge 2 commits into
edgefrom
expr/hb-store-perf

Conversation

@shyba

@shyba shyba commented Jun 8, 2026

Copy link
Copy Markdown

With #882, key from read, write, and type operations call hb_path:to_binary/1 (previously was calling to_path), breaking index operations for hb_store_arweave, since they use the native_id function (returns a 32 byte binary) of a TXID (43 byte string), which might contain the 2F binary for the forward slash, the key separator for groups used by hb_path:to_binary/1 function, breaking the behaviour of the index for these TXIDs.

@shyba shyba force-pushed the expr/hb-store-perf branch from aa82a8d to d7a2a95 Compare June 8, 2026 19:00
@shyba shyba force-pushed the expr/hb-store-perf branch from d7a2a95 to 21b7b20 Compare June 8, 2026 21:53
Comment on lines +136 to +139
write(Opts, #{ <<"write">> := {Path, Value}, <<"raw">> := true }, _NodeOpts)
when is_binary(Path) ->
% Opaque binary key (raw Arweave ID) written verbatim so a raw read matches.
write(Opts, Path, Value);

@speeddragon speeddragon Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write doesn't have the same structure as read and type. We also cannot write raw binary via HTTP API requests. Write uses all the key values to write into the store.

One option would be to set allow-raw-key in the store configuration, so we can avoid the hb_path:to_binary call when reading and writing, falling back to the old behaviour.

Another could be similar to this, maybe with another structure to confuse the usage of HTTP requests? Eg, write(Opts, {raw, Map}, Nodeopts), where Map can be multiple key values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants