Canister draining 1T every 2 days πŸ˜”

Dear Experts,

$LAND token canister is draining 1T cycles about everyday. It causing lots of trouble in the community. I request someone help us to identity the potential issue. Is there a problem in the code or infrastructure or something else.
Below is the source code for the same. If you need further clarification kindly do reply.

https://codeshare.io/wno6bJ

Canister Details
NFTgeek - Analytics tool for IC NFTs

Problem : Draining Cycles about 1T every 2 days.

Regards
Waheed

1 Like

we had a similar problem a while back try reaching out to lightning lad

1 Like

I don’t see anything obvious. Have you tried to use the Motoko playground with some profiling enabled so you can get a flamegraph for different requests?

Also, how is your canister called? Do you have a UI that runs update calls every second or something like that? This could be similar to the heartbeat costs in that case

1 Like

ICPSwap is the front-end it is a live production token called $LAND and it is available in ICPSwap DEX

There could be some cycles leakage in the canister or sub-net
Thanks Severin.

Kinda shooting in the dark but I noticed this code:

let params: IC.CreateCanisterParams = {
     settings = ?settings
};

// Add cycles and perform the create call
Cycles.add(2_000_000_000_000);
let create_response = await ic.create_canister(params);

which creates new canisters with 2T cycles. Is that maybe called often?

1 Like

Thats why i used to load only 1 T at a time. Even then it drains about 25 B cycles per transaction.

My guess is it only calls that once since it checks for result.canister and I am assuming let result = await router.get_token_contract_root_bucket({ witness=false; canister=pid; }); always returns something

That sounds like there’s some heavy processing done per transaction then. I’d suggest what Severin already mentioned, load this canister in the Motoko playground and try to get some more information where processing is happening.

2 Likes

I will try that in motoko playground

@Severin Deployed in playground

Github

Import from Github

  1. marspoolxyz/landtoken
  2. main
  3. src

Parameters

  1. BunnyIsland Land Token
  2. BunnyIsland Land Token
  3. LAND
  4. 8
  5. 100000000000000000
  6. jjugn-qkdh2-qdmjy-y4msd-juatg-qr63r-7gy72-7rfn6-ykwhg-ygt44-7ae
  7. 100

Kindly look into it. After deploying in playground as request.

You can deploy it yourself and deploy it with the Enable profiling checkbox ticked and then see which operations cost many cycles

1 Like