Skip to content

Commit

Permalink
chore: rpc docs (#1737)
Browse files Browse the repository at this point in the history
* chore: rpc docs

* chore: rpc dockerfile

* chore: node env

* chore: ignore cve

* chore: production packages

* chore: update comment

* chore: code review

* chore: code review

* chore: fix

* chore: fix

* Revert "chore: fix"

This reverts commit b20a93c.

* chore: fix

* chore: add back trivy ignore
  • Loading branch information
claytonneal authored Jan 23, 2025
1 parent 9999f37 commit 75fb28d
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docker/rpc-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ COPY ./package.json ./package.json
COPY ./turbo.json ./turbo.json
COPY ./yarn.lock ./yarn.lock
COPY ./tsconfig.json ./tsconfig.json
COPY ./docker/rpc-proxy/adjust-packages.sh ./adjust-packages.sh

# Install all the dependencies and build the app
RUN yarn install && yarn build

# Clean the package.json files ready for production
RUN apk add --no-cache jq
RUN chmod +x ./adjust-packages.sh
RUN /bin/sh ./adjust-packages.sh ./

# Stage 2: Serve the app using node
FROM node:20.17.0-alpine3.20 AS runner

Expand All @@ -37,7 +43,6 @@ COPY --from=builder /app/packages/errors/dist /app/packages/errors/dist
COPY --from=builder /app/packages/errors/package.json /app/packages/errors/package.json
## Just PROD dependencies
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/yarn.lock /app/yarn.lock
WORKDIR /app
RUN yarn workspace @vechain/sdk-rpc-proxy install --production --frozen-lockfile --ignore-scripts --prefer-offline \
&& yarn cache clean \
Expand Down
48 changes: 48 additions & 0 deletions docker/rpc-proxy/adjust-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# -----------------------------------------------------------------------------
# Info:
# - input: directory to search for package.json files
# - output:
# package.json without devDependencies section
# package.json without version selectors in dependencies
# -----------------------------------------------------------------------------

# Check if the search directory is provided
if [ -z "$1" ]; then
echo "Usage: $0 <path-to-directory>"
exit 1
fi
SEARCH_DIR="$1"

# Check if the search directory exists
if [ ! -d "$SEARCH_DIR" ]; then
echo "Error: Directory '$SEARCH_DIR' not found."
exit 1
fi


# Find all package.json files in the specified directory (excluding node_modules)
find "$SEARCH_DIR" -type f -name "package.json" ! -path "*/node_modules/*" | while read PACKAGE_JSON; do
echo "Processing: $PACKAGE_JSON"


# Remove the "devDependencies" section and overwrite the file
if jq -e '.devDependencies' "$PACKAGE_JSON" > /dev/null; then
jq 'del(.devDependencies)' "$PACKAGE_JSON" > temp.json && mv temp.json "$PACKAGE_JSON"
echo "devDependencies removed from $PACKAGE_JSON"
else
echo "No devDependencies section found in $PACKAGE_JSON. No changes made."
fi

# Remove version selectors from dependencies
# Check if the dependencies section exists in the package.json file
if jq -e '.dependencies' "$PACKAGE_JSON" > /dev/null; then
# Remove version selectors from dependencies
jq '(.dependencies |= with_entries(.value |= ltrimstr("^") | ltrimstr("~")))' "$PACKAGE_JSON" > temp.json && mv temp.json "$PACKAGE_JSON"
echo "Version selectors (caret/tilde) removed from dependencies in $PACKAGE_JSON"
else
echo "No dependencies section found in $PACKAGE_JSON. No changes made."
fi

done
70 changes: 70 additions & 0 deletions packages/rpc-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,73 @@ docker run -d -p 8545:8545 -v ./config.json:/app/config.json -t vechain-rpc-prox

If you do not pass a config.json file, the default solo network standard configuration will be used. Make sure to
provide your desired configuration file.

## JSON RPC Methods Support Status

Below is the support status for JSON RPC methods in VeChain via `sdk-rpc-proxy`.

| JSON RPC Method | Support Status |
|------------------------------------------|---------------------|
| debug_traceBlockByHash | Fully Supported |
| debug_traceBlockByNumber | Fully Supported |
| debug_traceCall | Fully Supported |
| debug_traceTransaction | Fully Supported |
| eth_accounts | Fully Supported |
| eth_blockNumber | Fully Supported |
| eth_call | Partially Supported |
| eth_chainId | Fully Supported |
| eth_coinbase | Fully Supported |
| eth_createAccessList | Fully Supported |
| eth_estimateGas | Partially Supported |
| eth_gasPrice | Fully Supported |
| eth_getBalance | Fully Supported |
| eth_getBlockByHash | Partially Supported |
| eth_getBlockByNumber | Partially Supported |
| eth_getBlockReceipts | Fully Supported |
| eth_getBlockTransactionCountByHash | Fully Supported |
| eth_getBlockTransactionCountByNumber | Fully Supported |
| eth_getCode | Fully Supported |
| eth_getLogs | Partially Supported |
| eth_getStorageAt | Fully Supported |
| eth_getTransactionByBlockHashAndIndex | Fully Supported |
| eth_getTransactionByBlockNumberAndIndex | Fully Supported |
| eth_getTransactionByHash | Fully Supported |
| eth_getTransactionCount | Partially Supported |
| eth_getTransactionReceipt | Fully Supported |
| eth_getUncleByBlockHashAndIndex | Partially Supported |
| eth_getUncleByBlockNumberAndIndex | Partially Supported |
| eth_getUncleCountByBlockHash | Partially Supported |
| eth_getUncleCountByBlockNumber | Partially Supported |
| eth_requestAccounts | Fully Supported |
| eth_sendRawTransaction | Fully Supported |
| eth_sendTransaction | Fully Supported |
| eth_signTransaction | Fully Supported |
| eth_signTypedDataV4 | Fully Supported |
| eth_subscribe | Fully Supported |
| eth_syncing | Partially Supported |
| eth_unsubscribe | Fully Supported |
| evm_mine | Fully Supported |
| net_listening | Fully Supported |
| net_peerCount | Fully Supported |
| net_version | Fully Supported |
| txpool_content | Partially Supported |
| txpool_contentFrom | Partially Supported |
| txpool_inspect | Partially Supported |
| txpool_status | Partially Supported |
| web3_clientVersion | Fully Supported |
| web3_sha3 | Fully Supported |
| eth_getUncleByBlockHash | Not Supported |
| eth_getUncleByBlockNumber | Not Supported |
| eth_newFilter | Not Supported |
| eth_newBlockFilter | Not Supported |
| eth_newPendingTransactionFilter | Not Supported |
| eth_uninstallFilter | Not Supported |
| eth_getFilterChanges | Not Supported |
| eth_getFilterLogs | Not Supported |
| eth_getProof | Not Supported |
| txpool_inspectFrom | Not Supported |

### Notes
- **Fully Supported**: The method is implemented and works as expected.
- **Partially Supported**: The method is implemented but may have limitations or deviations from the Ethereum standard.
- **Not Supported**: The method is not implemented or cannot be supported due to protocol constraints.

1 comment on commit 75fb28d

@github-actions
Copy link

Choose a reason for hiding this comment

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

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.98% (4371/4416) 97.14% (1394/1435) 98.9% (905/915)
Title Tests Skipped Failures Errors Time
core 836 0 πŸ’€ 0 ❌ 0 πŸ”₯ 2m 23s ⏱️
network 731 0 πŸ’€ 0 ❌ 0 πŸ”₯ 5m 6s ⏱️
errors 40 0 πŸ’€ 0 ❌ 0 πŸ”₯ 17.192s ⏱️
logging 3 0 πŸ’€ 0 ❌ 0 πŸ”₯ 18.779s ⏱️
hardhat-plugin 19 0 πŸ’€ 0 ❌ 0 πŸ”₯ 59.577s ⏱️
aws-kms-adapter 23 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 18s ⏱️
ethers-adapter 5 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 15s ⏱️
rpc-proxy 37 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 5s ⏱️

Please sign in to comment.