Skip to content
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

feat: added public addresses with failover #365

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

noryev
Copy link
Contributor

@noryev noryev commented Sep 16, 2024

Summary

This pull request makes the following changes:

  • Added public RPC addresses
  • Failover code to revert to alternate RPC address

We are saturating our RPC endpoint. This fix uses a public rpc with a failover

Task/Issue reference

Closes: add_link_here

Test plan

These modifications were tested using my local GPU RP on the lilypad testnet- as a lilypad resource provider

Details (optional)

Add any additional details that will help to review this pull request.

Related issues or PRs (optional)

Add any related issues or PRs.

pkg/web3/sdk.go Outdated
@@ -229,7 +238,8 @@ func NewContractSDK(options Web3Options) (*Web3SDK, error) {
TransactOpts: transactOpts,
Contracts: contracts,
}
log.Debug().Msgf("Public Address: %s", web3SDK.GetAddress())
// fmt.Printf("Public Address: %s\n", web3SDK.GetAddress())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Left over commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @narbs91, I removed the commented code.

@noryev noryev force-pushed the feat-public-RPC-with-failover branch from 00ebd4d to c24eebc Compare September 17, 2024 02:07
@noryev noryev force-pushed the feat-public-RPC-with-failover branch from c24eebc to 0d09857 Compare September 17, 2024 02:18
var client *ethclient.Client
var err error
for _, url := range rpcs {
client, err = ethclient.Dial(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

using dial is useless for select available rpc. since arb not check cu when connect.

my sugesstion is to use module like index := address%len(rpcsClients). or a more simple way to use random select

@noryev noryev merged commit 973f396 into main Sep 17, 2024
5 checks passed
@noryev noryev deleted the feat-public-RPC-with-failover branch September 17, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants