Skip to content

Test DIA extern interfaces and generated metadata#47

Open
Siddharth2207 wants to merge 2 commits into
2026-05-16-update-dia-oraclefrom
audit/extern-generated-coverage
Open

Test DIA extern interfaces and generated metadata#47
Siddharth2207 wants to merge 2 commits into
2026-05-16-update-dia-oraclefrom
audit/extern-generated-coverage

Conversation

@Siddharth2207

Copy link
Copy Markdown

Summary

  • exercise the deployed DiaWords.extern and integrity surfaces instead of bypassing dispatch
  • pin advertised ERC-165 interfaces, committed metadata, authoring metadata, and generated pointer tables
  • verify the real dia-price subparser path emits the expected extern opcode and operand

Stack

Reopened after accidental merge into PR #2. Keeps #33 in PR #2; this is the first PR above that cut.
Formerly #34.

Test plan

  • nix develop -c forge fmt --check
  • nix develop -c forge test
  • CI copy-artifacts + rainix-sol

Closes #11
Closes #18
Closes #19
Closes #20
Closes #21
Closes #32

Made with Cursor

Siddharth2207 and others added 2 commits July 17, 2026 14:33
Exercise extern dispatch through the deployed contract and enforce committed interface, metadata, and pointer-table invariants.

Co-authored-by: Cursor <cursoragent@cursor.com>
Decode the public subparser output to enforce its extern opcode and operand mapping.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 072384fd-9473-416e-9980-04f680aca769

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch audit/extern-generated-coverage

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.

Siddharth2207 commented Jul 17, 2026

Copy link
Copy Markdown
Author

}

function testDiaPriceSubParserEncodesDiaPriceOpcodeAndZeroOperand() external {
DiaWords diaWords = new DiaWords();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should fix: this decodes the extern constant but throws away the bytecode subParseWord2 returns, so it'd still pass if the subparser emitted empty bytecode, a non-extern opcode, or the wrong io byte. worth capturing the bytes and asserting len == 4, byte 0 == OPCODE_EXTERN, byte 1 == the 0x22 io byte for 2 inputs/2 outputs, and bytes 2-3 == constants height. or better, add a parser-level test for price updated-at: dia-price("AMZN" 3600); since that's the real path. also note ioByte is 0 here so the 2in/2out shape from the README never gets exercised.

authoringMeta[0].description,
"Returns the current price of the given asset according to DIA. Accepts 2 inputs, the price key as a string (e.g. \"AMZN\") and the timeout in seconds. The price has 18 decimal places. The timeout will be used to determine if the price is stale and revert if it is. Returns 2 outputs: the price and the timestamp of the last update."
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: this pins the in-memory authoringMetaV2() word and description, but nothing ties the committed meta/DiaSubParserAuthoringMeta.rain.meta to it. so that file can silently drift if someone edits the lib and forgets to re-run BuildAuthoringMeta, and CI stays green. DiaWords.meta.t.sol already guards the other meta file by hashing the committed bytes, would mirror that here: assertEq(vm.readFileBinary("meta/DiaSubParserAuthoringMeta.rain.meta"), LibDiaSubParser.authoringMetaV2()).

DiaWords diaWords = new DiaWords();

assertEq(diaWords.buildLiteralParserFunctionPointers(), hex"");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: buildLiteralParserFunctionPointers() is just return ""; with no branches, so this asserts a constant equals itself and can't catch a regression. i'd drop it. a comment in DiaSubParser.sol is enough if we want to document that literal parsers aren't supported.

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