Skip to content

Support route to multiple nodes - #1106

Open
speeddragon wants to merge 29 commits into
edgefrom
feat/router-node-rebased
Open

Support route to multiple nodes #1106
speeddragon wants to merge 29 commits into
edgefrom
feat/router-node-rebased

Conversation

@speeddragon

@speeddragon speeddragon commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Based on #988, rebased on current edge.

This includes #1097, since it needs it for the gateway-shim@1.0 redirect to work.
Uses permaweb/gateway-shim-1.0#1

Config

Config example:

  "store": [
    {
      "ao-types": "store-module=atom",
      "store-module": "hb_store_remote_node",
      "access": ["read"],
      "nodes": [
          {
              "prefix": "NODE1",
              "opts": {
                  "http-reference": "REDACTED"
              }
          },
          {
              "prefix": "NODE",
              "opts": {
                  "http-reference": "REDACTED"
              }
          }
      ],
      "admissible": {
        "device": "cache-admissibility@1.0",
        "path": "expected-response",
        "decorator": { "device": "stamp-decorator@1.0" },
        "commit-hook-response": true,
        "on": {
          "admissible-response": [
            {
              "device": "relay@1.0",
              "path": "call",
              "method": "POST",
              "peer": "NODE_COLLECTOR",
              "relay-path": "/PROCCESS_ID/push"
            }
          ]
        }
      }
    }
  ]

TODO:

When deployed

  • Verify is-admissible is received properly by lua process.

Comment thread src/preloaded/util/dev_relay.erl
Comment thread src/core/http/hb_http.erl
Device -> WithPrivIP#{<<"device">> => Device}
end,
Host = cowboy_req:host(Req),
Host = cowboy_req:header(<<"host">>, Req, cowboy_req:host(Req)),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

From #1097

Comment thread src/core/http/hb_http_multi.erl Outdated
Comment on lines +258 to +260
{ok, #{<<"ao-result">> := Key} = Res} ->
?event(debug_multi, {admissible_result, {result, Res}}),
hb_util:atom(maps:get(Key, Res, false)) == true;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For HyperBEAM-to-HyperBEAM node communication, we need to know where the message is.

Comment thread src/preloaded/name/dev_name.erl
Comment on lines +313 to +319
[ID | Rest] when length(Rest) >= 2 ->
{KeyParts, [Value]} =
lists:split(length(Rest) - 1, Rest),
Key =
iolist_to_binary(
lists:join(<<":">>, KeyParts)
),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This supports keys that contain :. Eg: qScPIDiicX8dyvkeXlyLcfNknLiNnJLqbjhdcg--a5w.

@Lucifer0x17, this isn't mandatory for this PR, right? I'm not sure why it was originally added.

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.

it's a correctness fix from the router port for colon-containing committed field names, independent of the multi-node feature but load-bearing for the NASA flow that produced those names, and safe to keep.

some manifest were failing to load like sam.weave.space and stuff

Comment thread src/core/store/hb_store_remote_node.erl Outdated
Comment thread src/core/http/hb_http_multi.erl Outdated
Comment on lines +245 to +250
hb_private:set(
Response#{ <<"path">> => Path },
<<"admissibility/node">>,
Node,
Opts
),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Previously, we set http-reference in the Base. I don't see a clear advantage/disadvantage (maybe readability), but this avoids modifying the body.

Comment thread src/core/http/hb_http_multi.erl Outdated
Comment on lines +294 to +303
apply_decorator(Base, Req, Decorator, Opts) ->
DecoratorBase =
hb_message:without_unless_signed([<<"path">>], Decorator, Opts),
{ok, Decorated} =
hb_ao:resolve(
DecoratorBase,
Req#{ <<"path">> => <<"decorator">>, <<"body">> => Base },
Opts
),
Decorated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The goal here is to modify add to Base the http-reference configuration via dev_stamp_decorator.

@speeddragon
speeddragon force-pushed the feat/router-node-rebased branch from 3703273 to 2b2714c Compare September 2, 2026 13:56
Lucifer0x17 and others added 20 commits September 7, 2026 17:06
Ports the feat/chance_and_router_conf router work onto post-#915 edge.
Edge already carries the shared neo/edge Arweave and bundler layer, so the
net delta is the router-specific work: dev_chance@1.0, the multi-node
verifying read in hb_store_remote_node (parallel fan-out + cache@1.0
expected-response gate, no local store), the dev_cache trust gate, the
dev_manifest b32 redirect, and host/port plumbing in hb_http.

Source: feat/chance_and_router_conf. Carries four non-router fixes that
auto-merged from that branch:
  333a94b uncommit test_process/1 base before merging the execution stack
  f973947 bail from ensure_started/1 cleanly when sidecar dir is absent
  bb7521e symmetrical handling of `status` encoding (dev_httpsig)
  f70c3b8 relay-path dropped when matched at root path (dev_relay)

Co-Authored-By: Sam Williams <sam@arweave.org>
…ification

dev_meta: log the raw request singleton instead of wrapping it in hb_cache:ensure_all_loaded, which forced store reads on every request even when the http topic is off
Fire + sign on admitted reads; thread the hook config via the admissibility spec, not the runtime opts.
Thread the responding store node through the multi-read fan-out so the
admissible-response push carries that node's http-reference, not empty.

- hb_store_remote_node: wrap nodes as {prefix, opts}
- hb_http_multi: pass the responding node into the admissibility check,
  stamp its http-reference onto the base
- hb_http: route a {prefix} node by prefix, preserving the path
The edge port flattened the hook lookup (deep_get -> maps:get), so
device-scoped hooks like on.~cache@1.0.admissible-response stopped
resolving. Restore nested resolution for path-form hook names while
keeping flat names on the fast direct lookup.

- hb_hook: list HookName -> deep_get (walk nested); binary -> maps:get
- dev_cache: fire the device-scoped path [~cache@1.0, admissible-response];
  drop a redundant debug event in the async hook
The hook fires inside the multi_read fan-out, so it inherits the remote-node
store. Once chance@1.0 loads as a remote device, the hook's archive read
re-enters the fan-out and the relay never fires. Drop the store from the hook
opts so device reads hit the node default store (local + gateway); the
admissibility verify keeps the store, only the hook drops it.
@speeddragon
speeddragon force-pushed the feat/router-node-rebased branch from 75865e8 to 771aefb Compare September 7, 2026 16:07
@speeddragon
speeddragon marked this pull request as ready for review September 9, 2026 03:39
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