From 7263d9680a8bf82d14c5b6f060c57315d8b75318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Mon, 5 Aug 2024 12:37:39 +0200 Subject: [PATCH] Adjusts transaction-status parser. --- transaction-status/src/parse_bpf_loader.rs | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/transaction-status/src/parse_bpf_loader.rs b/transaction-status/src/parse_bpf_loader.rs index f4d531a48247fd..61782298a0f8ca 100644 --- a/transaction-status/src/parse_bpf_loader.rs +++ b/transaction-status/src/parse_bpf_loader.rs @@ -175,12 +175,12 @@ pub fn parse_bpf_upgradeable_loader( "additionalBytes": additional_bytes, "programDataAccount": account_keys[instruction.accounts[0] as usize].to_string(), "programAccount": account_keys[instruction.accounts[1] as usize].to_string(), - "systemProgram": if instruction.accounts.len() > 3 { + "systemProgram": if instruction.accounts.len() > 2 { Some(account_keys[instruction.accounts[2] as usize].to_string()) } else { None }, - "payerAccount": if instruction.accounts.len() > 4 { + "payerAccount": if instruction.accounts.len() > 3 { Some(account_keys[instruction.accounts[3] as usize].to_string()) } else { None @@ -188,6 +188,28 @@ pub fn parse_bpf_upgradeable_loader( }), }) } + UpgradeableLoaderInstruction::ExtendProgramChecked { additional_bytes } => { + check_num_bpf_upgradeable_loader_accounts(&instruction.accounts, 3)?; + Ok(ParsedInstructionEnum { + instruction_type: "extendProgramChecked".to_string(), + info: json!({ + "additionalBytes": additional_bytes, + "programDataAccount": account_keys[instruction.accounts[0] as usize].to_string(), + "programAccount": account_keys[instruction.accounts[1] as usize].to_string(), + "authority": account_keys[instruction.accounts[2] as usize].to_string(), + "systemProgram": if instruction.accounts.len() > 3 { + Some(account_keys[instruction.accounts[3] as usize].to_string()) + } else { + None + }, + "payerAccount": if instruction.accounts.len() > 4 { + Some(account_keys[instruction.accounts[4] as usize].to_string()) + } else { + None + }, + }), + }) + } } }