Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 6c9bd02

Browse files
author
Steven Czabaniuk
committed
Use base64 encoding for account data
1 parent 3173ea1 commit 6c9bd02

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ edition = { workspace = true }
1111

1212
[dependencies]
1313
arrayref = { workspace = true }
14+
base64 = { workspace = true }
1415
bincode = { workspace = true }
1516
blake3 = { workspace = true }
1617
bv = { workspace = true, features = ["serde"] }

runtime/src/bank/bank_hash_details.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use {
2+
base64::{prelude::BASE64_STANDARD, Engine},
23
serde::ser::{Serialize, SerializeSeq, Serializer},
34
solana_sdk::{
45
account::{AccountSharedData, ReadableAccount},
@@ -24,15 +25,13 @@ pub(crate) struct BankHashDetails {
2425
pub(crate) struct BankHashAccounts(pub Vec<(Pubkey, Hash, AccountSharedData)>);
2526

2627
#[derive(Serialize)]
27-
struct TempAccount<'a> {
28+
struct TempAccount {
2829
pubkey: String,
2930
hash: String,
3031
lamports: u64,
3132
rent_epoch: Epoch,
3233
executable: bool,
33-
#[serde(with = "serde_bytes")]
34-
// a slice so we don't have to make a copy just to serialize this
35-
data: &'a [u8],
34+
data: String,
3635
}
3736

3837
impl Serialize for BankHashAccounts {
@@ -48,7 +47,7 @@ impl Serialize for BankHashAccounts {
4847
lamports: account.lamports(),
4948
rent_epoch: account.rent_epoch(),
5049
executable: account.executable(),
51-
data: account.data(),
50+
data: BASE64_STANDARD.encode(account.data()),
5251
};
5352
seq.serialize_element(&temp)?;
5453
}

0 commit comments

Comments
 (0)