-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/rpc helper #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/rpc helper #43
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nt variables for improved flexibility and backward compatibility
…te variable loading
…events, and window manager for consistency and improved error handling
…introduce getEnvInt utility for improved environment variable handling
…g method for improved clarity and maintainability
…variable loading with direct calls to contract methods for improved error handling
…improved clarity and maintainability
…ions in processor and api for improved error handling and clarity
…consistency across the codebase
…r improved stability and performance
…1.0.4 in go.mod and go.sum for compatibility improvements
… for compatibility improvements
anomit
approved these changes
Jul 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployed and operational on devnet sequencer against the master
branch of rpc helper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/PowerLoom/product/issues/240
Checklist
Current behaviour
The application currently uses direct Ethereum client connections via
ethclient.Client
with custom retry logic implemented through theMustQuery
function. Each contract call is wrapped in exponential backoff retry logic, and there's no centralized error handling or alerting system for RPC failures. The configuration only supports a single RPC URL viaPROST_RPC_URL
environment variable, limiting redundancy and fault tolerance.New expected behaviour
The application now uses the
go-rpc-helper
library which provides:Change logs
Added
github.com/powerloom/go-rpc-helper v1.0.1
libraryRPC_NODES
environment variable (JSON array format)ARCHIVE_RPC_NODES
environment variableRPC_MAX_RETRIES
,RPC_RETRY_DELAY_MS
,RPC_MAX_RETRY_DELAY_S
,RPC_REQUEST_TIMEOUT_S
SLACK_REPORTING_URL
for RPC failuresToRPCConfig()
method in Settings struct to convert configuration to RPC helper formatgetEnvInt()
utility function for parsing integer environment variablesPROST_RPC_URL
environment variableChanged
ethclient.Client
usage withRPCHelper
from go-rpc-helper libraryConfigureClient()
to initialize RPC helper instead of direct client connectionLoadContractStateVariables()
to use direct contract calls with better error handlingRPCHelper.BlockNumber()
andRPCHelper.HeaderByNumber()
RPCHelper.FilterLogs()
with built-in retry logicMustQuery
wrapperFixed
Removed
MustQuery
function and its custom retry logic (replaced by RPC helper's built-in retry)MustQuery
constant from constants.go (no longer needed)Deployment Instructions
Environment Variable Updates Required:
Replace single RPC URL with array format:
PROST_RPC_URL=https://rpc.example.com
RPC_NODES=["https://rpc1.example.com", "https://rpc2.example.com"]
Optional: Configure archive nodes:
ARCHIVE_RPC_NODES=["https://archive1.example.com", "https://archive2.example.com"]
Optional: Configure RPC retry parameters:
RPC_MAX_RETRIES=3
(default: 3)RPC_RETRY_DELAY_MS=500
(default: 500)RPC_MAX_RETRY_DELAY_S=30
(default: 30)RPC_REQUEST_TIMEOUT_S=30
(default: 30)Webhook alerting (optional):
SLACK_REPORTING_URL
is configured for RPC failure alerts