-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
piecrust: allow specifying
HostQuery
price
Host queries are modified to be able to specify their price. The calling of a such a query proceeds in two stages - deserializing and pricing, and then execution. In between the two stages, `piecrust` is able to make the choice of whether to continue with execution or not, based on the gas remaining for the execution. To achieve this, the `HostQuery` trait is modified by adding two functions - `deserialize_and_price` and `execute` - and by removing the `Fn(&mut [u8], u32) -> u32` bound. This structure allows the implementer to price queries fairly, as well as prevent double deserialization by leveraging `Box<dyn Any>` to pass data between the two functions. `HostQuery` remains implemented for all `Fn(&mut [u8], u32) -> u32` that are also `Send` and `Sync`, so this is not a breaking change. See-also: #359
- Loading branch information
Eduardo Leegwater Simões
committed
May 16, 2024
1 parent
ff23c6d
commit 60e7460
Showing
5 changed files
with
129 additions
and
17 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