-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experiment: value quota based idl decoder limiting (#4657)
Simplifies #4624 to a simple linear limit on the number of decoded values as a function of decoded payload size, instead of using two linear functions on perfcounter (simulated or real) and allocation counter. The function is: value_quota(blob) : Nat64 = blob.size() * (numerator/denominator) + bias where blob is the candid blob to be decoded, and `numerator` (default 1), `denominator` (default 1) and `bias` (default 1024) are `Nat32s`. Much simpler than #4624 and doesn't depend on vagaries of instruction metering and byte allocation which varies with gc and compiler options, but is it good enough? The constants can be (globally) modified/inspected using prims (Prim.getCandidLimits/Prim.setCandidLimits) which will need to get exposed in base eventually. The quota is decremented on every call to deserialise or skip a value in vanilla candid mode (destabilization is not metered). The quota is eagerly checked before deserializing or skipping arrays. One possible refinement would be to combine the value quota with a memory quota (though the latter would still vary with gc flavour and perhaps word-size unless we count logical words) - [x] Disable for destabilization (iff Registers.get_rel_buf_opt is zero) - [x] Port new candid spacebomb test suite to drun-tests, to test against real perf counter provided by drun. - [x] Bump candid dependency to most recent - [x] Pass new spacebomb tests, both in candid test suite on wasmtime using value counter.
- Loading branch information
Showing
26 changed files
with
581 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.