Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
{ "source": "/docs/polygon-zkevm-methods", "destination": "/docs/protocols-networks" },
{ "source": "/docs/polygon-zkevm-tooling", "destination": "/docs/protocols-networks" },
{ "source": "/docs/polygon-zkevm-tutorial-deploy-a-smart-contract-using-hardhat", "destination": "/docs/protocols-networks" },
{ "source": "/reference/polygon-trace_transaction", "destination": "/reference/polygon-tracetransaction" },
{ "source": "/reference/polygon-trace_block", "destination": "/reference/polygon-traceblockbynumber" },
{ "source": "/docs/moonbeam-methods", "destination": "/docs/protocols-networks" },
{ "source": "/docs/moonbeam-tooling", "destination": "/docs/protocols-networks" },
{ "source": "/docs/moonbeam-monitoring-the-conviction-voting-contract", "destination": "/docs/protocols-networks" },
Expand Down Expand Up @@ -1814,11 +1816,14 @@
"reference/polygon-traceblockbynumber",
"reference/polygon-tracetransaction",
"reference/polygon-tracecall",
"reference/polygon-trace_transaction",
"reference/polygon-trace_block",
"reference/polygon-chain-data-rpc-methods",
"reference/chainid",
"reference/syncing",
"reference/polygon-borgetauthor",
"reference/polygon-borgetcurrentproposer",
"reference/polygon-borgetcurrentvalidators",
"reference/polygon-borgetroothash",
"reference/polygon-borgetsignersathash",
"reference/polygon-gas-data-rpc-methods",
"reference/estimategas",
"reference/gasprice",
Expand All @@ -1827,6 +1832,7 @@
"reference/getbalance",
"reference/getcode",
"reference/getstorageat",
"reference/polygon-getproof",
"reference/polygon-logs-rpc-methods",
"reference/getlogs",
"reference/newfilter",
Expand Down
4 changes: 3 additions & 1 deletion docs/polygon-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Polygon runs on the Bor client, which does not implement the Erigon-only Parity

The `debug_trace*` methods return equivalent execution traces on Bor. The `erigon_*` convenience methods have no Bor equivalent — use the standard `eth_*` methods instead.

On Bor, `eth_getProof` returns state proofs only for roughly the latest 128 blocks; historical proof queries are not available.

| Method | Availability | Comment |
| ---------------------------------------- | ------------ | ------- |
| eth\_accounts | <Icon icon="square-check" iconType="solid" /> | |
Expand All @@ -38,7 +40,7 @@ The `debug_trace*` methods return equivalent execution traces on Bor. The `erigo
| eth\_getFilterChanges | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getFilterLogs | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getLogs | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getProof | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getProof | <Icon icon="square-check" iconType="solid" /> | Latest ~128 blocks only on Bor; no historical proofs |
| eth\_getStorageAt | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getTransactionByBlockHashAndIndex | <Icon icon="square-check" iconType="solid" /> | |
| eth\_getTransactionByBlockNumberAndIndex | <Icon icon="square-check" iconType="solid" /> | |
Expand Down
141 changes: 141 additions & 0 deletions openapi/polygon_node_api/account_info/eth_getProof.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"openapi": "3.0.0",
"info": {
"title": "eth_getProof example",
"version": "1.0.0",
"description": "Get the account and storage values of the specified account including the Merkle proof."
},
"servers": [
{
"url": "https://nd-828-700-214.p2pify.com"
}
],
"paths": {
"/a9bca2f0f84b54086ceebe590316fff3": {
Comment on lines +8 to +14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Remove and rotate the exposed endpoint credential.

This publishes a concrete node URL and opaque access path in a public OpenAPI document. Revoke/rotate it, then use the repository’s endpoint injection mechanism or placeholders such as YOUR_API_KEY.

As per coding guidelines, public content must “never include secrets, internal infrastructure details,” and must use placeholders for secrets.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi/polygon_node_api/account_info/eth_getProof.json` around lines 8 - 14,
Remove the concrete server URL and opaque access path from the OpenAPI document,
revoke or rotate the exposed endpoint credential, and replace both values with
the repository’s endpoint injection mechanism or appropriate placeholders such
as YOUR_API_KEY. Preserve the documented API structure while ensuring no secret
or internal infrastructure detail remains committed.

Source: Coding guidelines

"post": {
"tags": [
"Ethereum Operations"
],
"summary": "eth_getProof",
"operationId": "eth_getProof",
Comment on lines +15 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Document Bor’s proof-retention limit in the OpenAPI operation.

The standalone contract does not disclose that proofs are available only for roughly the latest 128 blocks, while docs/polygon-methods.mdx lines 21-22 do. Add this constraint to the operation description so generated API clients and Try-it users do not attempt unsupported historical queries.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi/polygon_node_api/account_info/eth_getProof.json` around lines 15 -
20, Update the eth_getProof OpenAPI operation metadata near the summary and
operationId to add a description documenting Bor’s proof-retention limit of
approximately the latest 128 blocks, consistent with the existing
polygon-methods documentation.

"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"jsonrpc",
"method",
"id",
"params"
],
"properties": {
"jsonrpc": {
"type": "string",
"default": "2.0"
},
"method": {
"type": "string",
"default": "eth_getProof"
},
"id": {
"type": "integer",
"default": 1
},
"params": {
"type": "array",
"default": [
"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
[],
"latest"
],
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Result",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jsonrpc": {
"type": "string"
},
"id": {
"type": "integer"
},
"result": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"accountProof": {
"type": "array",
"items": {
"type": "string"
}
},
"balance": {
"type": "string"
},
"codeHash": {
"type": "string"
},
"nonce": {
"type": "string"
},
"storageHash": {
"type": "string"
},
"storageProof": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
},
"proof": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
86 changes: 86 additions & 0 deletions openapi/polygon_node_api/bor/bor_getAuthor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"openapi": "3.0.0",
"info": {
"title": "bor_getAuthor example",
"version": "1.0.0",
"description": "Get the address that produced (signed) a given block."
},
"servers": [
{
"url": "https://nd-828-700-214.p2pify.com"
}
],
"paths": {
"/a9bca2f0f84b54086ceebe590316fff3": {
"post": {
"tags": [
"Ethereum Operations"
],
Comment on lines +16 to +18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files in openapi/polygon_node_api/bor:"
git ls-files 'openapi/polygon_node_api/bor/*.json' | sort

echo
echo "Tag lines for Bor operation files:"
python3 - <<'PY'
import json, pathlib
root = pathlib.Path('openapi/polygon_node_api/bor')
for p in sorted(root.glob('*.json')):
    try:
        data = json.loads(p.read_text())
    except Exception as e:
        print(f"{p}: parse error {e}")
        continue
    if "tags" in data:
        for line_no in range(1, min(len(p.read_text().splitlines()), 40)+1):
            if '"tags"' in p.read_text().splitlines()[line_no-1]:
                pass
    print(f"{p}: tags={data.get('tags')}")
PY

echo
echo "OpenAPI tag definitions across polygon_node_api / openapi (if present):"
rg -n '"tags":|^- name:|tags:' openapi -g '*.json' -g '*.yaml' -g '*.yml' | head -200

Repository: chainstack/dev-portal

Length of output: 16534


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Search for specific current tag in Bor files and broader occurrences:"
rg -n '"Ethereum Operations"|tags|name:' openapi/polygon_node_api/bor openapi/polygon* eth ethereum -g '*.json' -g '*.yaml' -g '*.yml' 2>/dev/null | head -50 || true

echo
echo "One Bor file top block:"
cat -n openapi/polygon_node_api/bor/bor_getAuthor.json | sed -n '1,80p'

echo
echo "Count exact current tag in repo JSON:"
rg -n '"Ethereum Operations"' -g '*.json' . | wc -l

Repository: chainstack/dev-portal

Length of output: 7249


Use a Bor-native tag for Polygon Bor operations.

These Bor methods are currently grouped under "Ethereum Operations" just like standard Eth RPC calls. Apply a Bor-specific tag consistently across the Bor files so they don’t get mixed into the Ethereum RPC section.

📍 Affects 5 files
  • openapi/polygon_node_api/bor/bor_getAuthor.json#L16-L18 (this comment)
  • openapi/polygon_node_api/bor/bor_getCurrentProposer.json#L16-L18
  • openapi/polygon_node_api/bor/bor_getCurrentValidators.json#L16-L18
  • openapi/polygon_node_api/bor/bor_getRootHash.json#L16-L18
  • openapi/polygon_node_api/bor/bor_getSignersAtHash.json#L16-L18
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi/polygon_node_api/bor/bor_getAuthor.json` around lines 16 - 18,
Replace the "Ethereum Operations" tag with a consistent Bor-specific tag in
bor_getAuthor.json, bor_getCurrentProposer.json, bor_getCurrentValidators.json,
bor_getRootHash.json, and bor_getSignersAtHash.json so all Bor methods are
grouped separately from standard Ethereum RPC operations.

Source: MCP tools

"summary": "bor_getAuthor",
"operationId": "bor_getAuthor",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"jsonrpc",
"method",
"id",
"params"
],
"properties": {
"jsonrpc": {
"type": "string",
"default": "2.0"
},
"method": {
"type": "string",
"default": "bor_getAuthor"
},
"id": {
"type": "integer",
"default": 1
},
"params": {
"type": "array",
"default": [
"0x561294b"
],
"items": {
"type": "string"
}
}
Comment on lines +46 to +54

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files matching bor RPC OpenAPI params:\n'
git ls-files 'openapi/polygon_node_api/bor/*.json' | sort

printf '\nOpenAPI param snippets:\n'
for f in $(git ls-files 'openapi/polygon_node_api/bor/*.json' | sort); do
  echo "--- $f"
  rg -n -C 3 '"params"' "$f" || true
done

printf '\nReference docs matching bor rpc parameter sections:\n'
git ls-files 'reference/*bor*.mdx' 'reference/polygon-bor*.mdx' | sort | sed -n '1,80p'

Repository: chainstack/dev-portal

Length of output: 3654


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, pathlib, re

base = pathlib.Path("openapi/polygon_node_api/bor")
docs = {
    "reference/polygon-borgetauthor.mdx": "GET_AUTHOR",
    "reference/polygon-borgetcurrentproposer.mdx": "GET_CURRENT_PROPOSER",
    "reference/polygon-borgetcurrentvalidators.mdx": "GET_CURRENT_VALIDATORS",
    "reference/polygon-borgetroothash.mdx": "GET_ROOT_HASH",
    "reference/polygon-borgetsignersathash.mdx": "GET_SIGNERS_AT_HASH",
}
patterns = {
    "GET_AUTHOR": [re.compile(r"params:\s*.block.*\n\s*type:\s*string", re.S)],
    "GET_CURRENT_PROPOSER": [re.compile(r"params:\s*—\n.*blocks\s*.*\n\s*type:\s*array", re.S), re.compile(r"params:\s*—\n", re.S)],
    "GET_CURRENT_VALIDATORS": [re.compile(r"params:\s*—\n.*blocks\s*.*\n\s*type:\s*array", re.S), re.compile(r"params:\s*—\n", re.S)],
    "GET_ROOT_HASH": [re.compile(r"params:\s*•.*fromIndex\s*\n.*integer", re.S), re.compile(r"params:\s*•.*toIndex\s*\n.*integer", re.S)],
    "GET_SIGNERS_AT_HASH": [re.compile(r"params:\s*•.*block.*hash.*\n\s*type:\s*string", re.S)],
}

for json_path in sorted(base.glob("*.json")):
    data = json.loads(json_path.read_text())
    params = data["components"]["schemas"]["RequestBody"]["properties"]["params"]
    # Extract constraints only present
    constraints = {}
    for k in ("type","minItems","maxItems","enum","items"):
        if k in params:
            constraints[k] = params[k]
    name = json_path.stem
    print(f"{json_path}: {constraints}")

print("\nReference doc param-count evidence:")
for doc_path, key in docs.items():
    text = pathlib.Path(doc_path).read_text(errors="replace")
    print(f"\n--- {doc_path}")
    count = 0
    # Show context around "params" heading for no-parameter docs
    if "GET_CURRENT_PROPOSER" in key or "GET_CURRENT_VALIDATORS" in key:
        # look for methods table params section by counting param rows if available
        for m in re.finditer(r"(Get Current Proposer|Get Current Validators)", text):
            start=max(0,m.start()-200); end=min(len(text), m.start()+1600)
            sec=text[start:end]; print(sec[:2200])
            rows=sec.count("- `blocks`")
            print("blocks rows:", rows)
    else:
        for m in re.finditer(r"^\s*####\s*Params", text, re.M):
            sec=text[m.start():]
            # count explicit params starting with leading bullets/dashes/numbers
            rows = re.findall(r"^[\s]*(?:•|-|\d+)\s", sec.splitlines(True)[1:12], re.M)
            print(sec[:2200])
            print("rows:", rows)
            break
PY

Repository: chainstack/dev-portal

Length of output: 256


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, pathlib, re

for json_path in sorted(pathlib.Path("openapi/polygon_node_api/bor").glob("*.json")):
    data = json.loads(json_path.read_text())
    def walk(obj, path=""):
        if isinstance(obj, dict):
            if obj.get("type") == "array" and "params" in path:
                print(f"{json_path}:{path}")
                for k in ("type","minItems","maxItems","enum","items"):
                    if k in obj:
                        print("  ", k, ":", obj[k])
            for k,v in obj.items():
                walk(v, f"{path}.{k}")
        elif isinstance(obj, list):
            for i,v in enumerate(obj):
                walk(v, f"{path}[{i}]")
    walk(data)
PY

printf '\nDocument params sections for no-param methods:\n'
for f in reference/polygon-borgetcurrentproposer.mdx reference/polygon-borgetcurrentvalidators.mdx; do
  echo "--- $f"
  sed -n '1,220p' "$f" | rg -C 8 'Params|`params`|blocks|type:' || true
done

printf '\nDocument params sections for single/two-param methods:\n'
for f in reference/polygon-borgetauthor.mdx reference/polygon-borgetroothash.mdx reference/polygon-borgetsignersathash.mdx; do
  echo "--- $f"
  sed -n '1,240p' "$f" | rg -C 6 'Params|`params`|block hash|fromIndex|toIndex|type:' || true
done

echo 'json:'
python3 - <<'PY'
import json, pathlib, re

for json_path in sorted(pathlib.Path("openapi/polygon_node_api/bor").glob("*.json")):
    data = json.loads(json_path.read_text())
    print(json_path.name, json.dumps(data.get("params") or data.get("requestBody", {}).get("content", {}).get("application/json", {}).get("schema", {}), indent=2))
PY

Repository: chainstack/dev-portal

Length of output: 2939


Enforce exact Bor RPC parameter counts.

These schemas currently only declare type: array and items, so the generated request contracts accept any-length params arrays even though the docs only document the exact Bor API signatures.

  • bor_getAuthor: require exactly one string.
  • bor_getCurrentProposer: require zero parameters.
  • bor_getCurrentValidators: require zero parameters.
  • bor_getRootHash: require exactly two integers.
  • bor_getSignersAtHash: require exactly one string.
📍 Affects 5 files
  • openapi/polygon_node_api/bor/bor_getAuthor.json#L46-L54 (this comment)
  • openapi/polygon_node_api/bor/bor_getCurrentProposer.json#L46-L49
  • openapi/polygon_node_api/bor/bor_getCurrentValidators.json#L46-L49
  • openapi/polygon_node_api/bor/bor_getRootHash.json#L46-L55
  • openapi/polygon_node_api/bor/bor_getSignersAtHash.json#L46-L54
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi/polygon_node_api/bor/bor_getAuthor.json` around lines 46 - 54,
Enforce exact params array lengths in bor_getAuthor.json (lines 46-54) with one
string, bor_getCurrentProposer.json (lines 46-49) with zero items,
bor_getCurrentValidators.json (lines 46-49) with zero items,
bor_getRootHash.json (lines 46-55) with exactly two integers, and
bor_getSignersAtHash.json (lines 46-54) with one string; add the appropriate
array length constraints while preserving each existing item type and default.

}
}
}
}
},
"responses": {
"200": {
"description": "Result",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jsonrpc": {
"type": "string"
},
"id": {
"type": "integer"
},
"result": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
81 changes: 81 additions & 0 deletions openapi/polygon_node_api/bor/bor_getCurrentProposer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"openapi": "3.0.0",
"info": {
"title": "bor_getCurrentProposer example",
"version": "1.0.0",
"description": "Get the address of the current block proposer."
},
"servers": [
{
"url": "https://nd-828-700-214.p2pify.com"
}
],
"paths": {
"/a9bca2f0f84b54086ceebe590316fff3": {
"post": {
"tags": [
"Ethereum Operations"
],
"summary": "bor_getCurrentProposer",
"operationId": "bor_getCurrentProposer",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"jsonrpc",
"method",
"id",
"params"
],
"properties": {
"jsonrpc": {
"type": "string",
"default": "2.0"
},
"method": {
"type": "string",
"default": "bor_getCurrentProposer"
},
"id": {
"type": "integer",
"default": 1
},
"params": {
"type": "array",
"default": []
}
}
}
}
}
},
"responses": {
"200": {
"description": "Result",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jsonrpc": {
"type": "string"
},
"id": {
"type": "integer"
},
"result": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
Loading