Skip to content

feat!: next generation of Rust CDK #521

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

Merged
merged 56 commits into from
Apr 22, 2025
Merged

feat!: next generation of Rust CDK #521

merged 56 commits into from
Apr 22, 2025

Conversation

lwshang
Copy link
Contributor

@lwshang lwshang commented Oct 4, 2024

SDK-1853

Checklist:

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

lwshang and others added 6 commits June 17, 2024 21:16
* Add RejectionCode variant SysUnknown

* refactor: Call struct

* encode_args once

* update ic0 with new system API

* with_best_effort_response()

* doc comments

* safe wrapper for msg_deadline()

* refactor

* add e2e

* state machine script using git tag

* basic test pass

* configs after setting args

* call_and_forget

* minor improvements

* use recent beta dfx which has new system API

* clippy

* load.bash

* update candid-extractor

* fmt

* group methods in traits

* default to 10s timeout:wq

* prelude mod

* fmt
* ic0: handle 32/64-bits system API

* adjust safe bindings

* update safety notes

* Update call.rs

Co-authored-by: Adam Spofford <93943719+adamspofford-dfinity@users.noreply.github.com>

---------

Co-authored-by: Adam Spofford <93943719+adamspofford-dfinity@users.noreply.github.com>
* Add ic-cdk-management-canister crate

* move management canister code

* flat hierarchy and exclude candid-extractor

* exclude root Cargo.lock

* rm docs

* update workflows

* fmt

* fix doc

* cleanup examples.yml

* rm candid-extractor

* fix examples.yml

* fix cont.

* refactor e2e-tests

1:1 mapping of canisters to tests

* remove examples
…same name as the function itself (#525)

* add a test case to reveal the bug

* fix: update/query macro could not handle function arguments with the same name as the function itself

* changelog
* duplicate call.rs in crate root

* keep only the new call API in root call.rs

* CallResult<R> = Result<R, CallError>;

* RejectCode & CallPerformErrorCode

* remove CleanupExecuted

* try add CandidEncodeFailed error type

* handle CandidEncodeFailed error properly

* copy api/call.rs from main branch and fix for new ic0

* test all Call struct variants and rename ArgDecoderConfig to DecoderConfig

* specify CallPerformErrorCode variants
* e2e revails: Call without args fails

* fix and e2e call thoroughly

* move call internal items

* unify wording about cycles

* CallWithArg which allow non-tuple arg

* docs

* with_decoder_config instead of call_with_decoder_config

* rename: call -> call_tuple, call_and_forget -> call_oneway

* call() allows non-tuple return types
@lwshang lwshang mentioned this pull request Dec 19, 2024
3 tasks
lwshang and others added 12 commits December 19, 2024 12:54
* wip

* pocket-ic must be in dev dependencies

* conditional compilation for wasm target_family

* cleanup

* CI wasm64

* fix ci.yml

* fix cont.

* no fail-fast

* rm e2e-tests/src/lib.rs
* deprecated annotations with note

* update ic-ledger-types

* RejectCode and CallPerformErrorCode have NoError variant

* ic-cdk-timers migrate to Call::new

* fix deprecation usage in async e2e

* fix doctests
…ode_with (#544)

* cleanup dfn_macro internal

* no arg decoding if function sig has no args

* name check

* decode_with: set custom arg decoder
* feat: safe binding for msg_deadline

* Option<NonZeroU64> for msg_deadline
* remove DecoderConfig from Call API

* deprecate note DecoderConfig

* PhantomData can be used for manual_reply

* deprecation note for ManualReply

* remove api_call.rs e2e test

* move is_recovering_from_trap to futures and re-export in lib.rs

* fix clippy

* deprecation note for the api/call module

* upgrade candid to 0.10.12
* Remove CandidEncodeFailed variant

* Unify RejectCode

* RejectCode doesn't include 0

* CallPerform also has a hard-coded reject message

* SystemError v.s. CallError

* avoid candid en/decoding in timers

* SystemError includes error_code

* Clarify 0 timeout for change_timeout()

* fix clippy

* simplify retry_later logic

* rename SystemError to CallRejected and make fields private

* fix typo

Co-authored-by: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com>

---------

Co-authored-by: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com>
* add back Unrecognized(u32) variant in RejectCode

* Clarify candid encoding fail and DRY

* update reject_message when sync failure

* mention msg_reject_msg for reject_message

* fix explicit target is redundant
* refactor: extract RejectCode into ic-response-codes

* refactor: extract the ic-management-canister-types crate
* with_arg takes ref

* SendableCall methods take &self

* empty bytes

* fix doctests

* upgrade candid to 0.10.13

* Simplify Call implementation

Get rid of the ConfigurableCall trait and the CallWithArg, CallWithArgs, and CallWithRawArgs structs.
Instead, we now have a single Call struct that can be configured and executed using chainable methods.

* fix lint

* remove prelude mod
lwshang and others added 24 commits February 28, 2025 10:03
* chore: change MSRV back to 1.75.0

* chore: use stable Rust for development

* chore: cargo clippy --fix (stable)

* ci: msrv job

* fix ci.yml
* add types for canister logs

* add test

* changelog

* add canister_id_record

* uncomment

* fix candid equality test

* make types aliases of CanisterIdRecord

* chore: bump to v0.2.1

---------

Co-authored-by: Linwei Shang <linwei.shang@dfinity.org>
* feat: encode_with for update/query macros

* e2e tests

* changelog

* decoder takes Vec<u8>

* explain the custom decoder/encoder in macro docs
* upgrade pocket-ic and simplify code

* cache pocket-ic server binary

* cleanup gitignore

* rm scripts

* update ci.yml

* try fix ci

* fix cont.

* fix
* fix: only call `call_cycles_add128` if cycles amount > 0

* Reinstate

* Use `u128` rather than `Option<u128>`

---------

Co-authored-by: Linwei Shang <linwei.shang@dfinity.org>
* implement bitcoin_canister mod

* handle cycles payment

* prepare for e2e tests

* change arg to reference

* e2e test bitcoin methods

* DRY

* no _query methods

* add candid equality test

* pic_base and introduce subnets when required

* fix doc

* apply review suggestions
…codes (#571)

* switch to ic_error_types::RejectCode

* deprecate ic-response-codes
…der the hood (#570)

* update ic0 to include cost_* API

* add api bindings

* e2e test api bindings

* management_canister methods handles cycles under the hood

* changelog

* typo

* add Errors section in docs

* fill changelog

* distinguish api.rs bindings and management_canister.rs methods

* feat: Add higher level cost APIs  (#574)

* added high level endpoints to mgmt cost api

* add cost for performing call

* typo

* apply review suggestions

* improve cross reference in docs

* impl Into<u32> for curve and algo

* changelog

* lint suggests From trait

---------

Co-authored-by: michael-weigelt <122277901+michael-weigelt@users.noreply.github.com>
* update ic0 to include subnet_self*

* binding in api.rs

* e2e
* increase default timeout to 30s

* change management strategy of bounded

* bitcoin_canister bounded/unbouned

* default timeout to 300s

* sign_with_* unbounded

* bitcoin_get_* bounded

* doc alter

* expose methods for bitcoin canister_id & cycles

* doc bitcoin about alter

* fix doctests

* fix typos
* update ic.did

* add wasm_memory_threshold

* add memory_metrics

* bump to 0.3.0 and changelog
* add ic0.canister_liquid_cycle_balance128

* add binding in api.rs

* update root Cargo.toml dependency

* e2e test with updated pocket-ic

* fix e2e by make pocket-ic-server executable

* abort early with InsufficientLiquidCycleBalance

* e2e test

* flat the error types

* record more info in error

* fix doc links
* properly deprecate api/ submodules

* bump to alpha.2 and changelog

* update V18 guide

* ledger-types alpha.2
* custom encoder/decoder should be blob in Candid

* update V18 guide

* prost_build canister.proto

* references

* setup-protoc in CI
* download pocket-ic in shell script and check tag in test

* update ci.yml

* update pocket-ic tag

* freezing threshold is enforced to be at least 604800 seconds

* fix protoc installation
@lwshang lwshang marked this pull request as ready for review April 22, 2025 13:17
@lwshang lwshang requested a review from a team as a code owner April 22, 2025 13:17
@lwshang lwshang enabled auto-merge (squash) April 22, 2025 13:53
@lwshang lwshang merged commit a0a2dc0 into main Apr 22, 2025
16 checks passed
@lwshang lwshang deleted the next branch April 22, 2025 14:58
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.

6 participants