Instruction: propose_block
This instruction allows the operator to propose a new block to the bridge.
Input parameters
facts: BlockFacts
: Information about the new block to be proposed.
Accounts
operator
: The operator account who pays for the new initialized accounts.Signer: Yes.
Init: No.
PDA: No.
Mutable: Yes.
Constraints: Must have the same public key as
contract_storage.operator
and have sufficient lamports to cover the account-creation cost.
block
: The account to hold the new proposed block data.Signer: No.
Init: Yes.
PDA: Yes (derived from
BLOCK_STORAGE_SEED
andcontract_storage.last_block_id + 1
with bump).Mutable: Yes.
Constraints: Must be a new account initialized with space
8 + 233
(discriminator +Block
size)
last_deposit
: The previous deposit data.Signer: No.
Init: No.
PDA: Yes (derived from
DEPOSIT_SEED
andfacts.next_state_facts.last_deposit_index
with bump).Mutable: No.
Optional: Yes.
Constraints: Must be of type
Deposit
.
da_fact_state
: The DA commitment account data.Signer: No.
Init: No.
PDA: Yes (derived from
DA_FACT_STORAGE_SEED
andfacts.da_commitment
with bump).Mutable: No.
Constraints: Must be
FactStateStorage
whereda_fact_state.state
isFactState::Finalized
.
contract_storage
: The global contract storage.Signer: No.
Init: No.
PDA: Yes (derived from
CONTRACT_STORAGE_SEED
with bump).Mutable: Yes.
Constraints: Must be a
ContractStorage
account.
Additional checks and behavior
Checks that
facts.next_state_facts.deposit_root
is valid by ensuring it is either all zeros whenfacts.next_state_facts.last_deposit_index
is0
andlast_deposit
isNone
or matches the hash oflast_deposit
when a deposit exists.Creates and stores a
Block
with the facts from the input parameter.Increments
contract_storage.last_block_id
.Logs a
ProposeBlock
event.
CPI
N/A.