Skip to content

fix: report tx_execution_result as None when the light decode can't know it - #114

Open
2TheMoom wants to merge 1 commit into
genlayerlabs:v0.18from
2TheMoom:fix/tx-execution-result-none-on-light-decode
Open

fix: report tx_execution_result as None when the light decode can't know it#114
2TheMoom wants to merge 1 commit into
genlayerlabs:v0.18from
2TheMoom:fix/tx-execution-result-none-on-light-decode

Conversation

@2TheMoom

@2TheMoom 2TheMoom commented Sep 3, 2026

Copy link
Copy Markdown

What

GenLayerRawTransaction.from_transaction_data() (the light decode path behind get_transaction()) hardcoded tx_execution_result=0 for both the Asimov (v04, 21-field) and Bradbury (v06, 23-field) ABI shapes.

That field genuinely isn't present in the light getTransaction response on either shape — only getTransactionAllData (from_all_transaction_data) actually reads a real value, as the existing code comment on GenLayerTransaction.tx_execution_result already notes (# tx_execution_result: testnet (from getTransactionAllData)).

0 isn't a neutral placeholder here — it's the numeric code for ExecutionResult.NOT_VOTED. So every transaction decoded via the light path silently claimed "not voted" instead of "we don't actually know," making it impossible for calling code to tell a real not-voted result from an unread one.

Fix

  • Widen GenLayerRawTransaction.tx_execution_result to Optional[int] (this already matches the public GenLayerTransaction TypedDict's declared type).
  • Return None from _from_v04 and _from_v06 instead of 0.
  • decode()'s tx_execution_result_name lookup already falls back to ExecutionResult.NOT_VOTED for any key that doesn't match EXECUTION_RESULT_NUMBER_TO_NAME (which None/"None" doesn't), so the public dict's _name field is unchanged — only the raw tx_execution_result value becomes honestly nullable instead of a false 0.
  • Left from_all_transaction_data untouched; it already receives a real value from the caller and a regression test pins that.

Related

This started from genlayerlabs/genlayer-cli#308, which reports the same bug but against this repo's code under the wrong repository, and suggests reading tx_data[9] as the fix — that's incorrect, since tx_data[9] in the v06 shape is txExecutionHash, a bytes32 hash, not a result code (see the existing comment a few lines above it). There's no field to remap; the light ABI just doesn't carry this data.

Testing

Added tests/unit/transactions/test_raw_transaction_execution_result.py:

  • v04 and v06 light-decoded transactions now have tx_execution_result is None
  • decode() still reports tx_execution_result_name == "NOT_VOTED" for the unknown case (back-compat)
  • from_all_transaction_data (the real, non-light path) is unaffected and still returns a real int

Ran the full tests/unit/ suite locally: 96 passed, 2 pre-existing failures unrelated to this change (live-network smoke tests against rpc-bradbury.genlayer.com/rpc-asimov.genlayer.com hitting a transient TLS error in my environment — reproduced identically on a clean v0.18 checkout before my change).

…now it

from_transaction_data() (used by get_transaction()) hardcoded
tx_execution_result=0 for both the Asimov (v04) and Bradbury (v06) ABI
shapes, even though that field isn't present in the light getTransaction
response at all -- only getTransactionAllData (from_all_transaction_data)
actually reads a real value. 0 isn't a placeholder here, it's the numeric
code for ExecutionResult.NOT_VOTED, so every light-decoded transaction
silently claimed "not voted" instead of "unknown".

Widen tx_execution_result to Optional[int] and return None from both
light-path decoders instead. decode()'s tx_execution_result_name lookup
already falls back to NOT_VOTED for any non-matching key, so the public
dict shape and existing callers are unaffected -- only the raw dataclass
field becomes honestly nullable.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 8893525c-b3d9-4d1e-a4b4-7c2bdb9d9f8b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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