Skip to content

Commit a21ae89

Browse files
committed
address review comments
1 parent eda0f2c commit a21ae89

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

core/src/signer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ impl SolanaSigner {
620620
signer_index + 1,
621621
solana_sdk::signature::Signature::default(),
622622
);
623-
} else {
624-
transaction.signatures[signer_index] = signature;
625-
}
623+
};
624+
625+
transaction.signatures[signer_index] = signature;
626626

627627
Ok(transaction)
628628
}

solana-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "engine-solana-core"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
solana-sdk = { workspace = true }

solana-core/src/transaction.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use base64::{engine::general_purpose::STANDARD as Base64Engine, Engine};
1+
use base64::{Engine, engine::general_purpose::STANDARD as Base64Engine};
22
use serde::{Deserialize, Serialize};
3-
use serde_with::{serde_as, DisplayFromStr};
3+
use serde_with::{DisplayFromStr, serde_as};
44
use solana_compute_budget_interface::ComputeBudgetInstruction;
55
use solana_sdk::{
66
instruction::Instruction,
7-
message::{v0, AccountMeta, VersionedMessage},
7+
message::{AccountMeta, VersionedMessage, v0},
88
pubkey::Pubkey,
99
transaction::VersionedTransaction,
1010
};
@@ -92,11 +92,16 @@ impl SolanaInstructionData {
9292
pub fn get_data_bytes(&self) -> Result<Vec<u8>, SolanaTransactionError> {
9393
match self.encoding {
9494
// try to decode both prefixed and non-prefixed hex
95-
InstructionDataEncoding::Hex => Ok(hex::decode(&self.data)
96-
.or_else(|_| hex::decode(&self.data[2..]))
97-
.map_err(|e| SolanaTransactionError::InvalidData {
95+
InstructionDataEncoding::Hex => {
96+
let s = self
97+
.data
98+
.strip_prefix("0x")
99+
.or_else(|| self.data.strip_prefix("0X"))
100+
.unwrap_or(self.data.as_str());
101+
hex::decode(s).map_err(|e| SolanaTransactionError::InvalidData {
98102
error: e.to_string(),
99-
})?),
103+
})
104+
}
100105
InstructionDataEncoding::Base64 => {
101106
Ok(Base64Engine.decode(&self.data).map_err(|e| {
102107
SolanaTransactionError::InvalidData {

0 commit comments

Comments
 (0)