dfinity / cdk-rs

Rust canister development kit for the Internet Computer.
Apache License 2.0
201 stars 90 forks source link

Consider adding __cdk_name #317

Closed lastmjs closed 7 months ago

lastmjs commented 2 years ago

I've opened this issue with 3 additional CDK projects:

As we've been developing CDKs (TypeScript/JavaScript with Azle and Python with Kybra), we've been thinking about how to measure adoption of various CDKs. In addition to GitHub metrics (such as analyzing dfx.json), it might be a powerful metric to know exactly how many canisters use a particular CDK. For Azle and Kybra, we're adding a simple method __cdk_name that returns a string with the name of the CDK. This will allow canister indexers like https://icscan.io/ to index canisters by CDK. This could allow viewing of various CDK metrics over time, which I think would be very interesting to many different parties on the IC.

Here's our suggested implementation of the method in cdk-rs:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "cdk-rs".to_string()
}

Here's our suggested implementation of the method in Azle:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "azle".to_string()
}

Here's our suggested implementation of the method in Kybra:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "kybra".to_string()
}

Do you have any thoughts on this pattern?

nomeata commented 2 years ago

I raised some questions about the design at https://github.com/dfinity/motoko/issues/3462

lastmjs commented 2 years ago

I think it's best to move forward with what is being suggested here: https://github.com/dfinity/motoko/issues/3462#issuecomment-1258599165

roman-kashitsyn commented 2 years ago

A custom metadata section (e.g., icp:public cdk_name) might be a better option. https://internetcomputer.org/docs/current/references/ic-interface-spec/#state-tree-canister-information

UPD: Ah, Joachim suggested the same thing.

sesi200 commented 2 years ago

We'd like to discuss this topic more in the next developer tooling working group. Please join if you can!

lwshang commented 7 months ago

Fulfilled by recent work on tech_stack. https://github.com/dfinity/sdk/pull/3670