Skip to content

Feat/vary set - #1112

Draft
jfrain99 wants to merge 7 commits into
edgefrom
feat/vary-set
Draft

Feat/vary set#1112
jfrain99 wants to merge 7 commits into
edgefrom
feat/vary-set

Conversation

@jfrain99

@jfrain99 jfrain99 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@jfrain99
jfrain99 marked this pull request as ready for review September 1, 2026 14:58
@jfrain99
jfrain99 marked this pull request as draft September 1, 2026 14:58
Comment thread src/core/device/hb_device_load.erl Outdated
hb_store:write(
loaded_device_store(Opts),
#{ schema_key(Module) =>
term_to_binary(Schema, [compressed]) },

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.

Definitely want to avoid this if we can.

I get the sense the impulse is that we are trying to avoid hb_cache:write here for performance/infinite recursion reasons? If the latter we do have a raw mode of some kind IIRC.

The easiest solution is likely that we should just enforce and exploit that the loaded-device-store must be a hb_store_volatile, and subsequently we can store whole Erlang terms in its ets. I think this would be acceptable if the performance is truly too painful if we store the normal way because when we read from the hb_cache the hashpath would still return a normal AO-Core message result. This flow would be just like hb_cache:read does for remote stores that return full messages (etc) today.

Comment thread src/core/resolver/hb_ao.erl Outdated
Comment on lines +540 to +541
UserOpts = hb_maps:without(?TEMP_OPTS, Opts, Opts),
Key = hb_path:hd(Req, UserOpts),

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.

Is the UserOpts extraction here necessary? Also, we should add a small inline comment explaining what we are achieving with this as it wasn't immediately intuitive, at-least to me.

LoadedMsg;
failure ->
failure;
{error, not_found} ->

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.

Seems like it is covering for an issue somewhere else -- maybe in development but fixed by now?

Comment thread src/core/resolver/hb_types.erl Outdated
extract(Device, _Opts) when is_map(Device) ->
{error, {unsupported_device_type, Device}};
extract(Module, Opts) when is_atom(Module) ->
case hb_opts:get(<<"caching-schema">>, false, Opts) of

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.

What is caching-schema? Do we mean cache-device-schemas?

Comment thread src/core/resolver/hb_types.erl Outdated
Comment on lines +52 to +54
CacheKey = {?MODULE, extract, Module},
case erlang:get(CacheKey) of
{Version, Schema} ->

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.

Shouldn't all of this be in hb_device[_load?]? It is a second layer of caching inside the pdict exactly matching loaded-device-store? If so, we should cache this information in the pdict in the same place -- either exactly or in the analogous spot -- in that module.

Comment thread src/core/resolver/hb_types.erl Outdated
Comment on lines +66 to +69
module_version(Module) ->
try Module:module_info(md5)
catch _:_ -> code:which(Module)
end.

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.

Do we really want to use md5? All of the device atoms should be prefixed with the base58 of the sha256 of the source that made them. Isn't that the identity we want?

Comment thread src/core/resolver/hb_types.erl Outdated
{error, {abstract_code_unavailable, Module, Error}}
end.

module_beam(Module) ->

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.

I have no idea what is going on from here down in the file. There isn't a single function comment, let alone an inline. We can't merge AI-comprehended-only blobs of 700 lines into the kernel to be called on every single invocation, and if you do comprehend it please document it such that other readers can follow.

Comment thread src/preloaded/arweave/dev_arweave.erl Outdated
%% block hash length (43 characters), it is used as an ID. If it is parsable as
%% an integer, it is used as a block height. If it is not present, the current
%% block is used.
-spec block(#{ _ => _ }, #{ _ => _ }, map()) -> term().

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.

Instead of map() is #{} or even _ equivalent in our syntax? Or does it have to be #{ _ => _ }? map() is technically correct, but as much as we can minimize the Erlang map/AO message confusion that would be great. If neither work, can we define an opts() instead?

Comment on lines +145 to +149
Client = hb_opts:get(
relay_http_client,
hb_opts:get(http_client, ?DEFAULT_HTTP_CLIENT, Opts),
Opts
),

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.

Interesting!

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