Skip to content

Convert metamask to LAVA @artifact_processor (4-report split + fixes)#1576

Merged
abrignoni merged 1 commit into
mainfrom
convert-metamask
Jun 24, 2026
Merged

Convert metamask to LAVA @artifact_processor (4-report split + fixes)#1576
abrignoni merged 1 commit into
mainfrom
convert-metamask

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Modernizes MetaMask (persist-root JSON store) to the LAVA pipeline. Four reports → four processors per the multi-report rule.

Split

get_metamask (four ArtifactHtmlReports) → metamaskWallets, metamaskContacts, metamaskTransactions, metamaskBrowser (context form; shared _load_metamask loader parses the nested engine/browser JSON once per call).

Bugs fixed during conversion

  • Reserved-word trap: the Transactions From/To headers sanitize to the SQL reserved words from/to (the same class of bug as the earlier Values crash) — renamed to From Address/To Address.
  • Timestamp correctness: import/transaction times used naive datetime.fromtimestamp (renders in the processing machine's local tz). Now convert_unix_ts_to_utc → proper UTC.
  • Duplicate rows: removed the spurious for i in json_object: loop that re-emitted every row once per top-level engine key.
  • Swapped Browser columns: data was appended (url, name) under headers ('Name','URL') — now aligned.
  • Hardened all lookups with .get() so a missing controller/section no longer raises KeyError.

Validation

  • pylint 10.00/10; compile/ast OK; no legacy refs.
  • Functional test with a synthetic persist-root: balances (1 ETH / 0.1 ETH) compute correctly, timestamps resolve to UTC (2021-01-01 / 2021-02-01), Browser columns aligned.
  • Mandatory reserved-word audit PASS for all four tables. No external imports of get_metamask.

Splits the single get_metamask (four ArtifactHtmlReports from persist-root
JSON) into one processor per table: metamaskWallets, metamaskContacts,
metamaskTransactions, metamaskBrowser. Context form; shared _load_metamask loader.

Fixes carried in the conversion:
- Reserved-word trap: Transactions headers 'From'/'To' (sanitize to the SQL
  reserved words from/to) renamed to 'From Address'/'To Address'.
- Timestamp correctness: import/transaction times were naive
  datetime.fromtimestamp (machine-local). Now convert_unix_ts_to_utc (UTC).
- Removed the spurious 'for i in json_object' loop that re-emitted every row
  once per top-level engine key (duplicate rows).
- Fixed the Browser report's swapped columns (data was (url, name) under
  headers ('Name','URL')).
- Hardened with .get() lookups so missing controllers/keys no longer KeyError.
@abrignoni abrignoni merged commit 43c9b60 into main Jun 24, 2026
1 check passed
@abrignoni abrignoni deleted the convert-metamask branch June 24, 2026 01:05
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