-
Notifications
You must be signed in to change notification settings - Fork 90
chore: remove vec length bytes from new instructions #1802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7958244
5d01d61
f25a9c0
cb031c7
3b3df54
6a86d71
0ddbbbe
dca0651
99f4d68
0b5508e
6c33702
3c51f17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -286,15 +286,16 @@ fn deserialize_instruction<'a>( | |
| )); | ||
| } | ||
| let instruction_discriminator = instruction[0..8].try_into().unwrap(); | ||
| let instruction = instruction.split_at(12).1; | ||
| let instruction = instruction.split_at(8).1; | ||
| match instruction_discriminator { | ||
| // Cannot be exucted with cpi context -> executing tx | ||
| DISCRIMINATOR_INVOKE => { | ||
| if accounts.len() < 9 { | ||
| return Err(ParseIndexerEventError::DeserializeSystemInstructionError); | ||
| } | ||
| let accounts = accounts.split_at(9).1; | ||
| let data = InstructionDataInvoke::deserialize(&mut &instruction[..])?; | ||
| // Skips vec size bytes | ||
| let data = InstructionDataInvoke::deserialize(&mut &instruction[4..])?; | ||
ananas-block marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Ok(ExecutingSystemInstruction { | ||
| output_compressed_accounts: data.output_compressed_accounts, | ||
| input_compressed_accounts: data.input_compressed_accounts_with_merkle_context, | ||
|
|
@@ -311,7 +312,7 @@ fn deserialize_instruction<'a>( | |
| } | ||
| let accounts = accounts.split_at(11).1; | ||
| let data = crate::instruction_data::invoke_cpi::InstructionDataInvokeCpi::deserialize( | ||
| &mut &instruction[..], | ||
| &mut &instruction[4..], | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. critical for indexing. |
||
| )?; | ||
| Ok(ExecutingSystemInstruction { | ||
| output_compressed_accounts: data.output_compressed_accounts, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -428,9 +428,6 @@ pub fn cpi_execute_compressed_transaction_transfer< | |
| compress_or_decompress_lamports: 0, | ||
| is_compress: false, | ||
| }; | ||
| let mut inputs = Vec::new(); | ||
| InstructionDataInvokeCpiWithReadOnly::serialize(&inputs_struct, &mut inputs) | ||
| .map_err(ProgramError::from)?; | ||
|
|
||
| #[cfg(not(feature = "cpi-without-program-ids"))] | ||
| { | ||
|
|
@@ -459,16 +456,19 @@ pub fn cpi_execute_compressed_transaction_transfer< | |
| bench_sbf_end!("t_cpi_prep"); | ||
|
|
||
| bench_sbf_start!("t_invoke_cpi"); | ||
| light_system_program::cpi::invoke_cpi_with_read_only(cpi_ctx, inputs)?; | ||
| light_system_program::cpi::invoke_cpi_with_read_only(cpi_ctx, inputs_struct)?; | ||
| bench_sbf_end!("t_invoke_cpi"); | ||
| } | ||
| #[cfg(feature = "cpi-without-program-ids")] | ||
| { | ||
| let mut data = Vec::with_capacity(8 + 4 + inputs.len()); | ||
| let mut inputs = Vec::new(); | ||
| InstructionDataInvokeCpiWithReadOnly::serialize(&inputs_struct, &mut inputs) | ||
| .map_err(ProgramError::from)?; | ||
|
|
||
ananas-block marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| let mut data = Vec::with_capacity(8 + inputs.len()); | ||
| data.extend_from_slice( | ||
| &light_compressed_account::discriminators::DISCRIMINATOR_INVOKE_CPI_WITH_READ_ONLY, | ||
| ); | ||
| data.extend_from_slice(&(inputs.len() as u32).to_le_bytes()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. critical |
||
| data.extend(inputs); | ||
|
|
||
| // 4 static accounts | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,7 +134,6 @@ pub fn invoke_cpi_with_read_only<'a, 'b, 'c: 'info, 'info>( | |
| accounts: &[AccountInfo], | ||
| instruction_data: &[u8], | ||
| ) -> Result<()> { | ||
| let instruction_data = &instruction_data[4..]; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. critical |
||
| msg!("invoke_cpi_with_read_only"); | ||
| let (inputs, _) = InstructionDataInvokeCpiWithReadOnly::zero_copy_at(instruction_data) | ||
| .map_err(ProgramError::from)?; | ||
|
|
@@ -152,7 +151,6 @@ pub fn invoke_cpi_with_account_info<'a, 'b, 'c: 'info, 'info>( | |
| instruction_data: &[u8], | ||
| ) -> Result<()> { | ||
| msg!("invoke_cpi_with_account_info"); | ||
| let instruction_data = &instruction_data[4..]; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. critical |
||
|
|
||
| let (inputs, _) = InstructionDataInvokeCpiWithAccountInfo::zero_copy_at(instruction_data) | ||
| .map_err(ProgramError::from)?; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.