Skip to content

fix: arweave mempool and raw request errors handling#843

Closed
charmful0x wants to merge 4 commits into
neo/edgefrom
fix/mempool-offsets
Closed

fix: arweave mempool and raw request errors handling#843
charmful0x wants to merge 4 commits into
neo/edgefrom
fix/mempool-offsets

Conversation

@charmful0x
Copy link
Copy Markdown

@charmful0x charmful0x commented Apr 13, 2026

findings

  • to_tx_message/6 could crash with badmatch on non-not_found data fetch errors due to {ok, Data} = ...
  • invalid /raw ids could throw cannot_encode_path (err 500)
  • non-numeric pending chunk offsets could crash with badarg in hb_util:int/1 (err 500)

patches

  • to_tx_message/6 now do (as it was doing before impr: mempool Arweave transaction headers and data support #842 ):
    - {ok, RawData} -> tx with data
    - {error, not_found} -> header only tx
    - other errors -> returned as Error

  • high level guard head_raw/3 with ?IS_ID, so invalid /raw ids return not_found instead of throwing cannot_encode_path (vs https://arweave.net/raw/hello)

  • wrap pending offset parsing in pending/3, so non-numeric offsets return not_found instead of crashing with badarg

tests

  • tx_raw_fetch_error_round_trips_test
  • `head_raw_invalid_id_returns_not_found_test
  • pending_invalid_offset_returns_not_found_test

and all tests pass

 [done in 85.576 s]
=======================================================
All 38 tests passed.

note

i noticed that pending offsets still have one edge case:

  • non-numeric offsets like offset=abc now resolve locally as 404 (as described in the patch)
  • BUT, negative offsets like offset=-1 still parse and round-trip upstream arweave nodes, which currently returns {"error":"invalid_offset"}

^
image

should both be canonalized? hyperbeam mimicking arweave ideally in both cases?

also should i target feat/mempool-offsets instead of neo/edge @samcamwilliams ?

followup

  • pending/3 offset validation now return error shape equal to arweave node and 400 status code

http://tip-1.arweave.xyz:1984/unconfirmed_chunk/aa/-1
image

@charmful0x
Copy link
Copy Markdown
Author

closing this and moving to work cleanly on #857 targeting feat/mempool-offsets

@charmful0x charmful0x closed this Apr 16, 2026
@charmful0x charmful0x deleted the fix/mempool-offsets branch April 20, 2026 17:34
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.

1 participant