diff --git a/rust/candid/src/de.rs b/rust/candid/src/de.rs index 2feff60a..87c3e787 100644 --- a/rust/candid/src/de.rs +++ b/rust/candid/src/de.rs @@ -183,9 +183,8 @@ impl DecoderConfig { /// C : -> -> nat /// C(null : opt ) = 2 /// C(?v : opt ) = 2 + C(v : ) - /// C(?v : opt ) = 2 + C(v : ) * 50 + 10 // when v cannot be converted to /// C(v^N : vec ) = 2 + 3 * N + sum_i C(v[i] : ) - /// C(kv* : record {*}) = 2 + sum_skipped_i C(kv : *[skipped_i]) * 50 + sum_expected_i C(kv : *[expected_i]) + /// C(kv* : record {*}) = 2 + sum_i C(kv : *[i]) /// C(kv : variant {*}) = 2 + C(kv : *[i]) /// /// C : (, ) -> -> nat @@ -197,7 +196,8 @@ impl DecoderConfig { /// C((id(v*),name) : func ) = 4 + |v*| + |name| + |type table| /// C(id(v*) : principal) = 1 + |v*| /// - /// C(v : ) = C(v : ) * 50 // when v is skipped + /// When a value `v : t` on the wire is skipped, due to being extra arguments, extra fields and mismatched option types, + /// we apply a 50x penalty on `C(v : t)` in the decoding cost. /// ``` pub fn set_decoding_quota(&mut self, n: usize) -> &mut Self { self.decoding_quota = Some(n);