pub struct EssentialBuilderClient { /* private fields */ }Expand description
Client that binds to an Essential builder address.
Implementations§
source§impl EssentialBuilderClient
impl EssentialBuilderClient
sourcepub async fn deploy_contract(
&self,
contract: &Contract,
) -> Result<ContentAddress>
pub async fn deploy_contract( &self, contract: &Contract, ) -> Result<ContentAddress>
Deploy contract.
Creates a solution to the contract registry predicate and submits it.
sourcepub async fn submit_solution(
&self,
solution: &Solution,
) -> Result<ContentAddress>
pub async fn submit_solution( &self, solution: &Solution, ) -> Result<ContentAddress>
Submit solution.
This allows submitting a solution to be included in an upcoming block. Once a solution is submitted it is added to the pool. The block builder runs on a regular loop interval and will include the solution in a block in FIFO order if it satisfies the constraints.
The block builder is likely to become more sophisticated in the future.
Note that currently if you submit a solution that conflicts with another solution then whichever solution is submitted first will be included in the block and the other solution will fail. Failed solutions are not retried and will eventually be pruned.
A solution can conflict with another solution when one solution is built on top of pre-state that the other solution changes. For example if a counter can only increment by 1 and is currently set to 5 then you submit a solution setting it to 6 but another solution is submitted before yours that sets the counter to 6 then your solution will fail to satisfy the constraints. In fact in this example your solution will never satisfy again unless you update the state mutation to the current count + 1. But to do this you have to resubmit your solution.
Submitting the same solution twice (even by different user) is idempotent.
Returns the content address of the submitted solution.
sourcepub async fn latest_solution_failures(
&self,
solution_ca: &ContentAddress,
limit: u32,
) -> Result<Vec<SolutionFailure<'static>>>
pub async fn latest_solution_failures( &self, solution_ca: &ContentAddress, limit: u32, ) -> Result<Vec<SolutionFailure<'static>>>
For solution in the given content address, get the latest solution failures.
The number of failures returned is limited by the limit parameter.
The failures are ordered by block number and solution index in descending order.
This allows querying the latest failures of a solution. A solution is either successfully included in a block or it fails with a reason.
One thing to keep in mind is solutions are not necessarily unique. It is possible for the same solution to be submitted multiple times. For example if the counter example also allowed decrementing by 1 then a solution could increment the count from 4 to 5 and another solution could decrement the count from 5 to 4. Then a solution that increments the count from 4 to 5 could be submitted again. These two solutions would have the exact same content address. This results in the same solution hash returning multiple outcomes.
This might make it difficult to know if it was the solution that you submitted that was successful or failed. But actually it doesn’t really matter because there is no real ownership over a solution. Remember if two of the same solution are submitted at the same time then it is as if only one was submitted.
If you are interested in “has my solution worked” then it probably makes more sense to query the state of the contract that you were trying to change.
Trait Implementations§
source§impl Clone for EssentialBuilderClient
impl Clone for EssentialBuilderClient
source§fn clone(&self) -> EssentialBuilderClient
fn clone(&self) -> EssentialBuilderClient
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EssentialBuilderClient
impl !RefUnwindSafe for EssentialBuilderClient
impl Send for EssentialBuilderClient
impl Sync for EssentialBuilderClient
impl Unpin for EssentialBuilderClient
impl !UnwindSafe for EssentialBuilderClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)