Skip to content

Commit 26ab15d

Browse files
authored
Change RPC provider to Zan (#3979)
<!-- Reference any GitHub issues resolved by this PR --> Closes #3973 ## Introduced changes <!-- A brief description of the changes --> - Change to new free public provider ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [ ] Updated relevant documentation - [ ] Added relevant tests - [x] Performed self-review of the code - [ ] Added changes to `CHANGELOG.md`
1 parent 1e7765e commit 26ab15d

File tree

16 files changed

+24
-39
lines changed

16 files changed

+24
-39
lines changed

.github/workflows/_build-binaries.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ on:
1111
required: false
1212
type: string
1313

14-
env:
15-
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
16-
1714
jobs:
1815
build-binaries:
1916
name: Build ${{ matrix.target }}

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ concurrency:
1212
group: ${{ github.head_ref || github.run_id }}
1313
cancel-in-progress: true
1414

15-
env:
16-
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
17-
1815
jobs:
1916
test-forge-unit:
2017
name: Test Forge / Unit Tests

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
needs: verify-version
6262
if: ${{ needs.verify-version.outputs.versionIsValid == 'true' }}
6363
uses: ./.github/workflows/_build-binaries.yml
64-
secrets: inherit
6564
with:
6665
version: ${{ needs.verify-version.outputs.version }}
6766

.github/workflows/scheduled.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ on:
1111
- cron: '0 0 * * 3'
1212
workflow_dispatch:
1313

14-
env:
15-
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
16-
1714
jobs:
1815
get-scarb-versions:
1916
if: github.event.repository.fork == false
@@ -199,7 +196,6 @@ jobs:
199196
build-binaries:
200197
needs: [ get-version ]
201198
uses: ./.github/workflows/_build-binaries.yml
202-
secrets: inherit
203199
with:
204200
version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
205201

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
#### Changed
2323

2424
- `sncast script init` now longer adds `cairo_test` as dependency in `Scarb.toml`
25+
- Replaced the free RPC provider to Zan
2526

2627
#### Fixed
2728

Cross.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[build.env]
2-
passthrough = ["ALCHEMY_API_KEY"]
3-
41
# TODO(#3790) Setup cross for native
52
#[build]
63
#pre-build = [

crates/forge/src/new.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use indoc::formatdoc;
77
use scarb_api::version::scarb_version;
88
use scarb_api::{ScarbCommand, ensure_scarb_available};
99
use semver::Version;
10+
use shared::consts::FREE_RPC_PROVIDER_URL;
1011
use std::env;
1112
use std::fs::{self, OpenOptions};
1213
use std::io::Write;
@@ -153,14 +154,15 @@ fn create_snfoundry_manifest(path: &PathBuf) -> Result<()> {
153154
# and https://foundry-rs.github.io/starknet-foundry/projects/configuration.html for more information
154155
155156
# [sncast.default] # Define a profile name
156-
# url = "<YOUR_RPC_PROVIDER>" # Url of the RPC provider
157+
# url = "{default_rpc_url}" # Url of the RPC provider
157158
# accounts-file = "../account-file" # Path to the file with the account data
158159
# account = "mainuser" # Account from `accounts_file` or default account file that will be used for the transactions
159160
# keystore = "~/keystore" # Path to the keystore file
160161
# wait-params = {{ timeout = 300, retry-interval = 10 }} # Wait for submitted transaction parameters
161162
# block-explorer = "StarkScan" # Block explorer service used to display links to transaction details
162163
# show-explorer-links = true # Print links pointing to pages with transaction details in the chosen block explorer
163164
"#,
165+
default_rpc_url = FREE_RPC_PROVIDER_URL,
164166
},
165167
)?;
166168

@@ -305,7 +307,7 @@ fn add_fork_config(document: &mut DocumentMut) -> Result<()> {
305307

306308
let mut fork_table = Table::new();
307309
fork_table.insert("name", Item::Value(Value::from("SEPOLIA_LATEST")));
308-
fork_table.insert("url", Item::Value(Value::from("<YOUR_RPC_PROVIDER>")));
310+
fork_table.insert("url", Item::Value(Value::from(FREE_RPC_PROVIDER_URL)));
309311

310312
let mut block_id_table = Table::new();
311313
block_id_table.insert("tag", Item::Value(Value::from("latest")));

crates/forge/tests/e2e/new.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use indoc::{formatdoc, indoc};
99
use itertools::Itertools;
1010
use regex::Regex;
1111
use scarb_api::ScarbCommand;
12+
use shared::consts::FREE_RPC_PROVIDER_URL;
1213
use shared::test_utils::output_assert::assert_stdout_contains;
1314
use snapbox::assert_matches;
1415
use snapbox::cmd::Command as SnapboxCommand;
@@ -189,7 +190,7 @@ fn get_expected_manifest_content(template: &Template, validate_snforge_std: bool
189190
r#"
190191
[[tool.snforge.fork]]
191192
name = "SEPOLIA_LATEST"
192-
url = "<YOUR_RPC_PROVIDER"
193+
url = "{FREE_RPC_PROVIDER_URL}"
193194
block_id = {{ tag = "latest" }}
194195
"#
195196
)

crates/shared/src/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub const EXPECTED_RPC_VERSION: &str = "0.10.0";
22
pub const RPC_URL_VERSION: &str = "v0_10";
33
pub const SNFORGE_TEST_FILTER: &str = "SNFORGE_TEST_FILTER";
4+
pub const FREE_RPC_PROVIDER_URL: &str = "https://api.zan.top/public/starknet-sepolia/rpc/v0_10";

crates/sncast/src/helpers/rpc.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ use clap::Args;
77
use shared::consts::RPC_URL_VERSION;
88
use shared::verify_and_warn_if_incompatible_rpc_version;
99
use starknet_rust::providers::{JsonRpcClient, jsonrpc::HttpTransport};
10-
use std::env;
11-
12-
const ALCHEMY_API_KEY: &str = env!("ALCHEMY_API_KEY");
1310

1411
#[derive(Args, Clone, Debug, Default)]
1512
#[group(required = false, multiple = false)]
@@ -66,33 +63,29 @@ impl RpcArgs {
6663
}
6764

6865
pub enum FreeProvider {
69-
Alchemy,
66+
Zan,
7067
}
7168

7269
impl FreeProvider {
7370
#[must_use]
7471
pub fn semi_random() -> Self {
75-
Self::Alchemy
72+
Self::Zan
7673
}
7774

7875
#[must_use]
7976
pub fn mainnet_rpc(&self) -> String {
8077
match self {
81-
FreeProvider::Alchemy => {
82-
format!(
83-
"https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/{RPC_URL_VERSION}/{ALCHEMY_API_KEY}"
84-
)
78+
FreeProvider::Zan => {
79+
format!("https://api.zan.top/public/starknet-mainnet/rpc/{RPC_URL_VERSION}")
8580
}
8681
}
8782
}
8883

8984
#[must_use]
9085
pub fn sepolia_rpc(&self) -> String {
9186
match self {
92-
FreeProvider::Alchemy => {
93-
format!(
94-
"https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/{RPC_URL_VERSION}/{ALCHEMY_API_KEY}"
95-
)
87+
FreeProvider::Zan => {
88+
format!("https://api.zan.top/public/starknet-sepolia/rpc/{RPC_URL_VERSION}")
9689
}
9790
}
9891
}
@@ -143,15 +136,15 @@ mod tests {
143136
#[tokio::test]
144137
#[ignore = "TODO: (#3937) New RPC URL is not available yet"]
145138
async fn test_mainnet_url_happy_case() {
146-
let provider = get_provider(&Network::free_mainnet_rpc(&FreeProvider::Alchemy)).unwrap();
139+
let provider = get_provider(&Network::free_mainnet_rpc(&FreeProvider::Zan)).unwrap();
147140
let spec_version = provider.spec_version().await.unwrap();
148141
assert!(is_expected_version(&Version::parse(&spec_version).unwrap()));
149142
}
150143

151144
#[tokio::test]
152145
#[ignore = "TODO: (#3937) New RPC URL is not available yet"]
153146
async fn test_sepolia_url_happy_case() {
154-
let provider = get_provider(&Network::free_sepolia_rpc(&FreeProvider::Alchemy)).unwrap();
147+
let provider = get_provider(&Network::free_sepolia_rpc(&FreeProvider::Zan)).unwrap();
155148
let spec_version = provider.spec_version().await.unwrap();
156149
assert!(is_expected_version(&Version::parse(&spec_version).unwrap()));
157150
}
@@ -186,6 +179,6 @@ mod tests {
186179
};
187180

188181
let url = rpc_args.get_url(&config).await.unwrap();
189-
assert_eq!(url, Network::free_mainnet_rpc(&FreeProvider::Alchemy));
182+
assert_eq!(url, Network::free_mainnet_rpc(&FreeProvider::Zan));
190183
}
191184
}

0 commit comments

Comments
 (0)