Skip to content

fix: broken example code, incorrect docs, and typos#3

Open
golldyck wants to merge 1 commit intoOpenGradient:mainfrom
golldyck:fix/broken-examples-and-docs
Open

fix: broken example code, incorrect docs, and typos#3
golldyck wants to merge 1 commit intoOpenGradient:mainfrom
golldyck:fix/broken-examples-and-docs

Conversation

@golldyck
Copy link
Copy Markdown

@golldyck golldyck commented Apr 8, 2026

Problem

The examples/run_historical.sol file cannot compile due to 5 errors: wrong import path, non-existent function name, undefined variable, missing struct field, and undeclared state variables. The README.md has matching errors plus missing memory keywords and broken links.

Fix

Corrected all compilation errors in the example contract, fixed README code snippets to match the actual interface definitions, and fixed NatSpec typos in the interface files. Removed a redundant uint32 >= 0 gas-wasting check in TensorLib.

Changes

  • examples/run_historical.sol — Fixed import path (../lib/../src/lib/), renamed runHistoricalInferencerunInferenceOnPriceFeed, fixed input_queryinput, added candle_duration_in_mins field, declared results and resultNumber variables
  • README.md — Fixed function names, added missing struct fields, added memory keyword to struct assignments, prefixed URLs with https://
  • src/interfaces/OGInference.sol — Fixed NatSpec typo "OGInfernece" → "OGInference"
  • src/interfaces/OGHistorical.sol — Fixed copy-paste NatSpec "OGInference" → "OGHistorical"
  • src/lib/TensorLib.sol — Removed redundant uint32 >= 0 check

Testing

  • Verified examples/run_historical.sol compiles without errors
  • Confirmed all function names and struct fields match src/interfaces/ definitions
  • Checked README examples are consistent with the fixed code

Closes #4

@golldyck
Copy link
Copy Markdown
Author

golldyck commented Apr 8, 2026

Hi @adambalogh @kylexqian — this PR fixes bugs I found during a full audit of OpenGradient's public repositories. Would appreciate a review when you get a chance. Happy to address any feedback. Thanks!

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.

Bug: examples/run_historical.sol does not compile (5 errors)

1 participant