I apologize for taking so long to follow-up on this thread. We solved the problem a while back and I neglected to close the issue (even after @domwoe was kind enough to remind me). I understand this is not good etiquette on a forum like this.
In short, the cycles leak was due to my failure to initialize the Certified Assets Provenance (CAP) service before deploying our NFT canister. During operation, whenever a token was sold or transferred the CAP service would attempt to report that event using the cronCapEvents
method:
public shared(msg) func cronCapEvents() : async () {
canistergeekMonitor.collectMetrics();
logEvent(level_3, "cronCapEvents()");
var _cont : Bool = true;
while(_cont){
var last = List.pop(_capEvents);
switch(last.0){
case(?event) {
_capEvents := last.1;
try {
ignore await CapService.insert(event);
} catch (e) {
_capEvents := List.push(event, _capEvents);
logEvent(level_2, "CapService Error : cronCapEvents()");
};
};
case(_) {
_cont := false;
};
};
};
};
public shared(msg) func initCap() : async () {
canistergeekMonitor.collectMetrics();
logEvent(level_1, "initCap()");
if (Option.isNull(capRootBucketId)){
try {
capRootBucketId := await CapService.handshake(Principal.toText(Principal.fromActor(this)), 1_000_000_000_000);
} catch e {};
};
};
After executing initCap
we no longer experienced any elevated burn rates and have been running smoothly for about a month now. On average we burn ~0.27T cycles/day.
Thank you to everyone who helped with this. It was a great learning experience.