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: start a Rust library for querying CNS #76

Merged
merged 11 commits into from
Feb 10, 2025
Merged

Conversation

przydatek
Copy link
Contributor

@przydatek przydatek commented Feb 3, 2025

Add a Rust cns_client-library, for using CNS from Rust, and add the corresponding tests.
Also, update the existing CNS canisters to require a dot after the TLD (to comply with the spec).

@przydatek przydatek marked this pull request as ready for review February 3, 2025 13:41
@przydatek przydatek requested review from sa-github-api and a team as code owners February 3, 2025 13:41
@przydatek przydatek requested a review from nathanosdev February 3, 2025 13:42
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
test_client: Principal,
}

fn cns_setup() -> CnsSetup {
Copy link
Member

Choose a reason for hiding this comment

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

Very minor nit, but why not make this an init function on the CnsSetup struct? Also, maybe it could be called CnsFixture, which I think slightly describes the intention better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

lib/cns-client/rs/src/lib.rs Show resolved Hide resolved
przydatek and others added 3 commits February 4, 2025 16:56
Loosen the requirements on dependencies' versions.

Co-authored-by: Nathan Mc Grath <[email protected]>
Copy link
Contributor Author

@przydatek przydatek left a comment

Choose a reason for hiding this comment

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

Thanks, PTAL.

include = ["src", "Cargo.toml"]
homepage = "https://github.com/dfinity/cns#readme"
repository = "https://github.com/dfinity/cns"
keywords = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, not really, copy-paste thing... removed now.

canisters/test-client/src/main.rs Show resolved Hide resolved
lib/cns-client/rs/Cargo.toml Show resolved Hide resolved
lib/cns-client/rs/Cargo.toml Show resolved Hide resolved
lib/cns-client/rs/Cargo.toml Show resolved Hide resolved
test_client: Principal,
}

fn cns_setup() -> CnsSetup {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pic.add_cycles(test_client, INIT_CYCLES);
println!(" cns_root CID: {}", cns_root);
println!(" tld_operator CID: {}", tld_operator);
println!(" test_client CID: {}", test_client);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, intentional -- they don't cost much, and are useful when looking at logs of potentially failing tests.

@przydatek przydatek requested a review from nathanosdev February 4, 2025 18:05
@przydatek przydatek merged commit bdc975b into main Feb 10, 2025
9 checks passed
@przydatek przydatek deleted the bartosz/cns_client_rust branch February 10, 2025 15:42
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.

2 participants