An allow_phase_change function will allow transitioning from the non-revertible to the revertible phase
during its execution.
This is an advanced feature that is typically only required for account contract entrypoints that handle
transaction fee payment.
Note Retrieval
When notes are read e.g. via crate::note::note_getter::get_notes, a
ConfirmedNote value is returned which includes note metadata, notably whether the
note was created in a previous transaction (a settled note) or in the current one (a pending note), either in the
current or previous phase. Because allow_phase_change functions can change phases, this metadata can be left
stale, e.g. it is possible to read a pending current phase note and then change phases, resulting in the note being
PENDING_PREVIOUS_PHASE instead.
An
allow_phase_changefunction will allow transitioning from the non-revertible to the revertible phase during its execution.This is an advanced feature that is typically only required for account contract entrypoints that handle transaction fee payment.
Note Retrieval
When notes are read e.g. via
crate::note::note_getter::get_notes, aConfirmedNotevalue is returned which includes note metadata, notably whether the note was created in a previous transaction (a settled note) or in the current one (a pending note), either in the current or previous phase. Becauseallow_phase_changefunctions can change phases, this metadata can be left stale, e.g. it is possible to read a pending current phase note and then change phases, resulting in the note beingPENDING_PREVIOUS_PHASEinstead.Such a note would be rejected by the kernels if it was tried to be nullified, as the metadata is incorrect. It is therefore important to not allow
ConfirmedNote,HintedNoteorNoteMetadatavalues to cross the phase barrier caused bycrate::context::PrivateContext::end_setup.