diff --git a/docs/sidebars.js b/docs/sidebars.js index f53d3cb07be..b384661ba8c 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -213,22 +213,23 @@ module.exports = { label: "Accepted", items: [ "proposals/accepted-design-proposals", + "proposals/bankless-leader", + "proposals/block-confirmation", + "proposals/cluster-test-framework", + "proposals/embedding-move", + "proposals/interchain-transaction-verification", "proposals/ledger-replication-to-implement", "proposals/optimistic-confirmation-and-slashing", - "proposals/vote-signing-to-implement", - "proposals/cluster-test-framework", - "proposals/validator-proposal", + "proposals/optimistic_confirmation", + "proposals/rip-curl", + "proposals/rust-clients", "proposals/simple-payment-and-state-verification", - "proposals/interchain-transaction-verification", - "proposals/snapshot-verification", - "proposals/bankless-leader", "proposals/slashing", + "proposals/snapshot-verification", "proposals/tick-verification", - "proposals/block-confirmation", - "proposals/rust-clients", - "proposals/optimistic_confirmation", - "proposals/embedding-move", - "proposals/rip-curl", + "proposals/transactions-v2", + "proposals/validator-proposal", + "proposals/vote-signing-to-implement", ], }, ], diff --git a/docs/src/proposals/transactions-v2.md b/docs/src/proposals/transactions-v2.md index 6e4dfa930a5..4af32b3aa77 100644 --- a/docs/src/proposals/transactions-v2.md +++ b/docs/src/proposals/transactions-v2.md @@ -143,10 +143,9 @@ pub struct MessageV2 { // unchanged pub recent_blockhash: Hash, - // unchanged. Account indices are still `u8` encoded so the max number of accounts - // in account_keys + address_maps is limited to 256. + /// Optimize instructions by separating dependent accounts from inputs #[serde(with = "short_vec")] - pub instructions: Vec, + pub instructions: Vec, } #[derive(Serialize, Deserialize)] @@ -158,8 +157,43 @@ pub struct AddressMap { #[serde(with = "short_vec")] pub entries: Vec, } + +#[derive(Serialize, Deserialize)] +pub struct CompiledInstructionV2 { + /// unchanged + pub program_id_index: u8, + + /// unchanged + #[serde(with = "short_vec")] + pub accounts: Vec, + + /// Only programs in this list may be invoked by the outer instruction + #[serde(with = "short_vec")] + pub inner_programs: Vec, + + /// Dependent accounts do not need to be mapped to the memory of the outer + /// instruction's execution context. They are available for passing to inner + /// instructions + #[serde(with = "short_vec")] + pub inner_program_accounts: Vec, + + /// unchanged + #[serde(with = "short_vec")] + pub data: Vec, +} ``` +#### Dependent accounts + +The new transaction format supports lists of programs and accounts that a +transaction instruction may use when invoking inner instructions. These programs +and accounts are separate from transaction instruction account inputs so that +they do not need to incur the cost of serializing into the outer instruction's +memory which does need to read or write the account. + +For extra user protection, only the programs listed in `inner_programs` may be +invoked by the outer transaction instruction. + #### Size changes - 1 byte for `prefix` field @@ -167,6 +201,7 @@ pub struct AddressMap { - 1 byte for `address_maps` length - Each map requires 2 bytes for `entries` length and `num_readonly` - Each map entry is 1 byte (u8) +- Each instruction requires 2 bytes for the lengths of `inner_programs` and `inner_program_accounts` #### Cost changes