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(providers): updating Pokt endpoint #479

Merged
merged 1 commit into from
Jan 22, 2024
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
1 change: 1 addition & 0 deletions SUPPORTED_CHAINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Chain name with associated `chainId` query param to use.
- Arbitrum Goerli (`eip155:421613`)
- Polygon (`eip155:137`)
- Polygon Mumbai (`eip155:80001`)
- Polygon Zkevm (`eip155:1101`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We forgot to add it to the list despite we were supporting it for at least 7 months.

- Celo (`eip155:42220`)
- Aurora (`eip155:1313161554`)
- Aurora Testnet (`eip155:1313161555`)
Expand Down
20 changes: 8 additions & 12 deletions src/env/pokt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ fn default_supported_chains() -> HashMap<String, (String, Weight)> {
Weight::new(Priority::Normal).unwrap(),
),
),
// Avax C-Chain
// (
// "eip155:43114".into(),
// (
// "avax-mainnet".into(),
// Weight::new(Priority::Normal).unwrap(),
// ),
// ),
// AVAX mainnet
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why this was commented, but we are supporting eip155:43114 in other providers as well as Grove/Pokt supports it.

(
"eip155:43114".into(),
(
"avax-mainnet".into(),
Weight::new(Priority::Normal).unwrap(),
),
),
// Gnosis
(
"eip155:100".into(),
Expand All @@ -76,10 +76,6 @@ fn default_supported_chains() -> HashMap<String, (String, Weight)> {
"eip155:5".into(),
("eth-goerli".into(), Weight::new(Priority::Normal).unwrap()),
),
(
Copy link
Contributor Author

@geekbrother geekbrother Jan 17, 2024

Choose a reason for hiding this comment

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

Is not supported by Pokt/Grove anymore https://docs.grove.city/guides/getting-started/supported-blockchains.
We don't need to remove it from the supported list because it's supported by Infura.

"eip155:11155111".into(),
("sepolia".into(), Weight::new(Priority::Normal).unwrap()),
),
// Optimism
(
"eip155:10".into(),
Expand Down
5 changes: 1 addition & 4 deletions src/providers/pokt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ impl RpcProvider for PoktProvider {
.get(chain_id)
.ok_or(RpcError::ChainNotFound)?;

let uri = format!(
"https://{}.gateway.pokt.network/v1/lb/{}",
chain, self.project_id
);
let uri = format!("https://{}.rpc.grove.city/v1/{}", chain, self.project_id);

let hyper_request = hyper::http::Request::builder()
.method(Method::POST)
Expand Down
34 changes: 29 additions & 5 deletions tests/functional/http/pokt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,44 @@ use {
#[test_context(ServerContext)]
#[tokio::test]
#[ignore]
async fn pokt_provider_eip155_43114_and_56_and_100(ctx: &mut ServerContext) {
// Avax
async fn pokt_provider_eip155(ctx: &mut ServerContext) {
// Avax mainnet
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:43114", "0xa86a").await;

// Gnosis
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:100", "0x64").await;

// Binance mainnet
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:56", "0x38").await;

// Gnosis
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:100", "0x64").await
// Ethereum
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding missing tests for supported chains.

check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:1", "0x1").await;

// Goerli
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:5", "0x5").await;

// Optimism
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:10", "0xa").await;

// Arbitrum
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:42161", "0xa4b1").await;

// Polygon mainnet
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:137", "0x89").await;

// Polygon mumbai
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:80001", "0x13881").await;

// Polygon zkevm
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:1101", "0x44d").await;

// Polygon celo
check_if_rpc_is_responding_correctly_for_supported_chain(ctx, "eip155:42220", "0xa4ec").await
}

#[test_context(ServerContext)]
#[tokio::test]
async fn solana_mainnet(ctx: &mut ServerContext) {
async fn pokt_provider_solana_mainnet(ctx: &mut ServerContext) {
let addr = format!(
"{}/v1?projectId={}&chainId=",
ctx.server.public_addr, ctx.server.project_id
Expand Down