#[repr(C)]pub struct BlockExecutionContext {
pub block_height: BlockHeight,
pub block_timepoint: TimePoint,
}Expand description
The contract-visible facts about the block an executor is running.
Passed to both executor open-block calls so that a block looks identical to the executor whether it is being proposed or validated, and so that everything a contract can observe about “the current block” comes from one place rather than being inferred from the parent tip.
This is deliberately not ProposalContext (its protocol and proposer
are scheduler concerns, and protocol is not recoverable from a
ProposalHeader when validating) and not ProposalHeader (whose txs,
storage, events and config hashes are outputs of executing the block, so
they do not exist when it is opened).
Does not travel on network: the scheduler builds it per block, from the
coordinator’s ProposalContext when proposing and from the proposal’s
ProposalHeader when validating. A validator must take these values from
the proposal it is validating rather than regenerating them, or its
execution diverges from the proposer’s and consensus splits.
Fields§
§block_height: BlockHeightHeight of the block being executed – the parent tip’s height plus one. Supplied rather than derived so that height and timepoint have a single source; the executor is expected to check it against the tip it reads.
block_timepoint: TimePointThe block’s timepoint, fixed before execution begins. Unlike the height there is no way to recover this from the parent tip: the parent’s timepoint is the previous block’s.
Trait Implementations§
Source§impl Clone for BlockExecutionContext
impl Clone for BlockExecutionContext
Source§impl ConstMaxSize for BlockExecutionContext
impl ConstMaxSize for BlockExecutionContext
Source§impl ConstMaxSize for BlockExecutionContext
impl ConstMaxSize for BlockExecutionContext
Source§impl Debug for BlockExecutionContext
impl Debug for BlockExecutionContext
Source§impl<'de> Deserialize<'de> for BlockExecutionContext
impl<'de> Deserialize<'de> for BlockExecutionContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl EncodesAs<BlockExecutionContext> for BlockExecutionContext
impl Eq for BlockExecutionContext
Source§impl Hash for BlockExecutionContext
impl Hash for BlockExecutionContext
Source§impl JsonSchema for BlockExecutionContext
impl JsonSchema for BlockExecutionContext
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for BlockExecutionContext
impl Ord for BlockExecutionContext
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BlockExecutionContext
impl PartialEq for BlockExecutionContext
Source§impl PartialOrd for BlockExecutionContext
impl PartialOrd for BlockExecutionContext
Source§impl<'_r> ReadXDR<'_r> for BlockExecutionContext
impl<'_r> ReadXDR<'_r> for BlockExecutionContext
Source§fn read_xdr<R: Reader<'_r>>(r: &mut R) -> ReadResult<Self>
fn read_xdr<R: Reader<'_r>>(r: &mut R) -> ReadResult<Self>
Source§fn read_xdr_in_place<'__xdrs_s, R: Reader<'_r>>(
r: &mut R,
__xdrs_slot: Slot<'__xdrs_s, Self>,
) -> ReadResult<Init<'__xdrs_s, Self>>
fn read_xdr_in_place<'__xdrs_s, R: Reader<'_r>>( r: &mut R, __xdrs_slot: Slot<'__xdrs_s, Self>, ) -> ReadResult<Init<'__xdrs_s, Self>>
slot, without first building it
on the stack. Read more