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: generate a file with a list of API seeds at compile time #578

Conversation

nikolay-komarevskiy
Copy link
Contributor

@nikolay-komarevskiy nikolay-komarevskiy commented Aug 5, 2024

Description

Using the build script approach (build.rs), we auto-generate an api_seed_nodes.rs file, containing a full list of existing API nodes. This generation is done at compile time. The generated api_seed_nodes.rs file is further used as a seed-list input for building an agent with discovery service.

This is how the generated api_seed_nodes.rs file looks like:

#[allow(dead_code)]
const API_SEED_NODES: &[&str] = &[
    "dll02.sg2.icp.162.technology",
    "bc1-dll02.blockchaindevlabs.com",
    "br1-dll01.aviatelabs.co",
];

How Has This Been Tested?

Tested manually by running:

#[tokio::main]
async fn main() {
    let client = Client::builder().build().expect("failed to build a client");
    let agent = Agent::builder()
        .with_discovery_transport(client)
        .await
        .build()
        .expect("failed to create an agent");

    // use agent for query, update calls.
}

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@nikolay-komarevskiy nikolay-komarevskiy force-pushed the komarevskiy/add-seed-list-build branch 2 times, most recently from 4d2428e to 300288b Compare August 5, 2024 22:39
@nikolay-komarevskiy nikolay-komarevskiy changed the title feat: generate API seed list file feat: generate a file with a list of API seeds at compile time Aug 6, 2024

// An initial seed list of API nodes used for fetching all existing API nodes.
const API_SEED_NODES: [&str; 4] = [
"ic0.app",

Choose a reason for hiding this comment

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

Suggested change
"ic0.app",
"icp-api.io",
"ic0.app",
"icp0.io",

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 could yes, but should we? Will these domain work as seeds in the future? I was actually even reluctant to put ic0.app here, as it is not an API node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants