Dfx 0.8.4 is promoted

Release notes: Highlights of what’s new in 0.8.4 :: Internet Computer

Highlights:

  • added rust canister type
  • added support for canister heartbeat (rust canisters only, replica only, not in emulator)
  • updated dependencies in the starter project and added some polish
  • added dfx deploy --mode=reinstall <canister>
13 Likes

Woot! I really appreciate this small feature! It was kind of a pain to start up a new test project, and at least for me it was just at that threshold of not doing it often enough to warrant spending time automating it, but kicking myself every time I started a new demo project :slight_smile:

4 Likes

This is amazing. Gonna try as soon as I can!

Thanks!

1 Like

Crossing my fingers for Motoko heartbeat support soon… :pray:

2 Likes

@ericswanson

Well, the heartbeat doesn’t work. Am I doing something wrong again?

#[init]
fn init() {
    log("INIT");
}

#[heartbeat]
fn tick() {
    log("HEARTBEAT!");
}

Replica’s output:

$ dfx start --clean
Starting webserver for /_/
binding to: 127.0.0.1:34953
Nov 20 18:42:50.773 INFO ic-starter. Configuration: ValidatedConfig { replica_path: Some("/home/alexander/.cache/dfinity/versions/0.8.4/replica"), replica_version: "0.8.0", log_level: Warning, cargo_bin: "cargo", cargo_opts: "", state_dir: "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state", http_listen_addr: 127.0.0.1:0, http_port_file: Some("/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/replica-configuration/replica-1.port"), metrics_addr: None, provisional_whitelist: Some(All), artifact_pool_dir: "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state/node-100/ic_consensus_pool", crypto_root: "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state/node-100/crypto", state_manager_root: "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state/node-100/state", registry_local_store_path: "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state/ic_registry_local_store", unit_delay: None, initial_notary_delay: Some(600ms), detect_consensus_starvation: None, consensus_pool_backend: Some("rocksdb"), state_dir_holder: None }, Application: starter
Nov 20 18:42:50.773 INFO Initialize replica configuration "/home/alexander/IdeaProjects/ic-cron/example/e2e-test/.dfx/state/replicated_state/ic.json5", Application: starter
Nov 20 18:42:56.047 WARN s:aridc-guyup-qekry-6hi6x-wvgcv-6oafq-7makp-vvrnu-ldqol-dzqpd-gae/n:6ycaa-hg6hq-cstkq-6kpne-jx3wb-ral6t-wba5w-uzot6-3keqg-mzqrs-zqe/ic_p2p/download_management PeerManagerImpl::new(): relay_config = None
version: 0.7.0
 Nov 20 21:42:56.079 INFO Log Level: INFO
 Nov 20 21:42:56.079 INFO Starting server. Listening on http://127.0.0.1:8000/

[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] 2021-11-20 18:43:16.492139289: [caller: rwlgt-iiaaa-aaaaa-aaaaa-cai]: INIT

I followed the example here when testing it: GitHub - akhi3030/heartbeat-example: A simple example of how to use the heartbeat functionality in rust canister smart contracts on the Internet Computer

I think this would work:

#[export_name = "canister_heartbeat"]
fn tick() {
    log("HEARTBEAT!");
}
1 Like

BTW do you know how reliable this canister heartbeat is?

Would it be reliable enough to use to periodically (say, every day) mint new tokens in an autonomous token canister? For example, to implement an automatic inflation mechanism for a token. This is a use case that is possible in IC but not possible in Ethereum.

1 Like