Selaa lähdekoodia

feat(nonce): adds system instruction to upgrade legacy nonce versions (#25789)

https://github.com/solana-labs/solana/pull/25788
permanently disables durable transactions with legacy nonce versions
which are within chain blockhash domain.

This commit adds a new system instruction for a one-time idempotent
upgrade of legacy nonce accounts in order to bump them out of chain
blockhash domain.
behzad nouri 3 vuotta sitten
vanhempi
sitoutus
5903862f44
1 muutettua tiedostoa jossa 19 lisäystä ja 1 poistoa
  1. 19 1
      interface/src/instruction.rs

+ 19 - 1
interface/src/instruction.rs

@@ -142,7 +142,7 @@ pub fn instruction_to_nonce_error(
 /// maximum permitted size of data: 10 MB
 pub const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024;
 
-#[frozen_abi(digest = "2xnDcizcPKKR7b624FeuuPd1zj5bmnkmVsBWgoKPTh4w")]
+#[frozen_abi(digest = "5e22s2kFu9Do77hdcCyxyhuKHD8ThAB6Q6dNaLTCjL5M")]
 #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AbiExample, AbiEnumVisitor)]
 pub enum SystemInstruction {
     /// Create a new account
@@ -307,6 +307,13 @@ pub enum SystemInstruction {
         /// Owner to use to derive the funding account address
         from_owner: Pubkey,
     },
+
+    /// One-time idempotent upgrade of legacy nonce versions in order to bump
+    /// them out of chain blockhash domain.
+    ///
+    /// # Account references
+    ///   0. `[WRITE]` Nonce account
+    UpgradeNonceAccount,
 }
 
 pub fn create_account(
@@ -940,6 +947,17 @@ pub fn authorize_nonce_account(
     )
 }
 
+/// One-time idempotent upgrade of legacy nonce versions in order to bump
+/// them out of chain blockhash domain.
+pub fn upgrade_nonce_account(nonce_pubkey: Pubkey) -> Instruction {
+    let account_metas = vec![AccountMeta::new(nonce_pubkey, /*is_signer:*/ false)];
+    Instruction::new_with_bincode(
+        system_program::id(),
+        &SystemInstruction::UpgradeNonceAccount,
+        account_metas,
+    )
+}
+
 #[cfg(test)]
 mod tests {
     use {