SuperAPI AI 工具集

cloud-engine-canisters

部署与运维

查看项目

更新于 10-16 05:05

技能介绍

用途:本技能给出在云引擎(CloudEngine 子网,如 OpenCloud)上编写 canister 代码的规则。云引擎是用户拥有的 Internet Computer 容量切片,由网页控制台管理,运行在专用 CloudEngine 子网类型上,采用免费 cycles 成本表:执行、存储、消息传递和 HTTPS outcalls 均按零计费,引擎 canister 的 cycles 余额按设计为 0。适用于把在普通 Application 子网可运行的代码迁移到引擎时的排错。

主要能力与四条规则:1) 绝不给任何调用附加 cycles,删除 (with cycles = …) 及附加 cycles 的包装器;不要用 cycles = 0“修复”,应从源码中完全不提 cycles。Rust 中不要调用 .with_cycles(…)。若出现 IC0504(out of cycles),说明某处附加了非零金额。2) 跨子网调用必须 bounded-wait:Motoko 用 await (with timeout = 30) service.method(args);,Rust 用 Call::bounded_wait(canister_id, "method")…。协议会以 "Unbounded-wait calls and calls with cycles are not allowed to CloudEngine subnets" 拒绝无界等待或带 cycles 的请求;同子网调用可豁免。3) HTTPS outcalls 使用标准包装器、零成本:如 await Call.httpRequest(request);不要硬编码费用;不要通过控制台代理发 HTTPS outcall(代理无 transform 方法,会报 SYS_TRANSIENT: No consensus could be reached)。max_response_bytes 仍生效需注意。4) 带 cycles 的跨子网目标(XRC、阈值签名、vetKD)经控制台代理 canister:引擎 canister 向代理发无 cycles 的 bounded-wait 调用,由代理附上 cycles 并转发原始回复;代理接口含 proxy(ProxyArgs) -> (ProxyResult) 与 get_allowed_ranges 查询。

限制:云引擎不提供阈值签名,阈值 ECDSA/Schnorr、vetKD 须经代理访问主网;代理不用于 HTTPS outcalls。代理 canister id 由配置获得,不可硬编码猜测;ProxyError 需处理(InsufficientCycles、CallFailed、UnauthorizedUser),CallFailed 表示结果未知而非必然失败。定价版本 2 在引擎无需调优,with_expected_* 视为无操作。其余部署与出资细节暂未提供。