Skip to content

Commit 6fd1f89

Browse files
committed
refactor: remove commented-out code from ledger legacy account module
Removes unused commented code blocks from ledger/src/account/legacy.rs to improve code readability and maintainability. This includes removal of commented field definitions, alternative method implementations, and debug logging statements. Fixes #1216
1 parent a5f6caa commit 6fd1f89

File tree

1 file changed

+0
-152
lines changed

1 file changed

+0
-152
lines changed

ledger/src/account/legacy.rs

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ impl Hashable for SnappAccount {
102102
roi = roi.append_field(*field);
103103
}
104104

105-
// elog!("ROInput={:?}", roi);
106105

107106
roi
108107
}
@@ -126,10 +125,6 @@ pub struct AccountLegacy {
126125
pub timing: Timing, // Timing.t
127126
pub permissions: PermissionsLegacy<AuthRequired>, // Permissions.t
128127
pub snap: Option<SnappAccount>,
129-
// Below fields are for `develop` branch
130-
// pub token_symbol: TokenSymbol, // Token_symbol.t
131-
// pub zkapp: Option<ZkAppAccount>, // Zkapp_account.t
132-
// pub zkapp_uri: String, // string
133128
}
134129

135130
pub fn get_legacy_hash_of<T: Hashable>(init_value: T::D, item: &T) -> Fp {
@@ -144,21 +139,6 @@ impl Hashable for AccountLegacy {
144139
fn to_roinput(&self) -> ROInput {
145140
let mut roi = ROInput::new();
146141

147-
// Self::token_symbol
148-
149-
// https://github.com/MinaProtocol/mina/blob/2fac5d806a06af215dbab02f7b154b4f032538b7/src/lib/mina_base/account.ml#L97
150-
// assert!(self.token_symbol.len() <= 6);
151-
152-
// if !self.token_symbol.is_empty() {
153-
// let mut s = <[u8; 6]>::default();
154-
// let len = self.token_symbol.len();
155-
156-
// s[..len].copy_from_slice(&self.token_symbol.as_bytes());
157-
// roi.append_bytes(self.token_symbol.as_bytes());
158-
// } else {
159-
// roi.append_bytes(&[0; 6]);
160-
// }
161-
162142
// Self::snapp
163143
let snapp_accout = match self.snap.as_ref() {
164144
Some(snapp) => Cow::Borrowed(snapp),
@@ -168,7 +148,6 @@ impl Hashable for AccountLegacy {
168148

169149
roi = roi.append_field(snapp_digest);
170150

171-
// elog!("ROINPUT={:?}", roi);
172151

173152
// Self::permissions
174153
for auth in [
@@ -260,142 +239,16 @@ impl Hashable for AccountLegacy {
260239
roi
261240
}
262241

263-
// fn to_roinput(&self) -> ROInput {
264-
// let mut roi = ROInput::new();
265-
266-
// // Self::public_key
267-
// roi.append_field(self.public_key.x);
268-
// roi.append_bool(self.public_key.is_odd);
269-
270-
// // Self::token_id
271-
// roi.append_u64(self.token_id.0);
272-
273-
// // Self::token_permissions
274-
// match self.token_permissions {
275-
// TokenPermissions::TokenOwned { disable_new_accounts } => {
276-
// roi.append_bool(true);
277-
// roi.append_bool(disable_new_accounts);
278-
// },
279-
// TokenPermissions::NotOwned { account_disabled } => {
280-
// roi.append_bool(false);
281-
// roi.append_bool(account_disabled);
282-
// },
283-
// }
284-
285-
// // Self::balance
286-
// roi.append_u64(self.balance);
287-
288-
// // Self::token_symbol
289-
290-
// // https://github.com/MinaProtocol/mina/blob/2fac5d806a06af215dbab02f7b154b4f032538b7/src/lib/mina_base/account.ml#L97
291-
// // assert!(self.token_symbol.len() <= 6);
292-
293-
// // if !self.token_symbol.is_empty() {
294-
// // let mut s = <[u8; 6]>::default();
295-
// // let len = self.token_symbol.len();
296-
297-
// // s[..len].copy_from_slice(&self.token_symbol.as_bytes());
298-
// // roi.append_bytes(self.token_symbol.as_bytes());
299-
// // } else {
300-
// // roi.append_bytes(&[0; 6]);
301-
// // }
302-
303-
// // Self::nonce
304-
// roi.append_u32(self.nonce);
305-
306-
// // Self::receipt_chain_hash
307-
// roi.append_field(self.receipt_chain_hash.0);
308-
309-
// // Self::delegate
310-
// match self.delegate.as_ref() {
311-
// Some(delegate) => {
312-
// roi.append_field(delegate.x);
313-
// roi.append_bool(delegate.is_odd);
314-
// },
315-
// None => {
316-
// // Public_key.Compressed.empty
317-
// roi.append_field(Fp::zero());
318-
// roi.append_bool(false);
319-
// },
320-
// }
321-
322-
// // Self::voting_for
323-
// roi.append_field(self.voting_for.0);
324-
325-
// // Self::timing
326-
// match self.timing {
327-
// Timing::Untimed => {
328-
// roi.append_bool(false);
329-
// roi.append_u64(0); // initial_minimum_balance
330-
// roi.append_u32(0); // cliff_time
331-
// roi.append_u64(0); // cliff_amount
332-
// roi.append_u32(1); // vesting_period
333-
// roi.append_u64(0); // vesting_increment
334-
// },
335-
// Timing::Timed { initial_minimum_balance, cliff_time, cliff_amount, vesting_period, vesting_increment } => {
336-
// roi.append_bool(true);
337-
// roi.append_u64(initial_minimum_balance);
338-
// roi.append_u32(cliff_time);
339-
// roi.append_u64(cliff_amount);
340-
// roi.append_u32(vesting_period);
341-
// roi.append_u64(vesting_increment);
342-
// },
343-
// }
344-
345-
// // Self::permissions
346-
// for auth in [
347-
// self.permissions.set_verification_key,
348-
// self.permissions.set_permissions,
349-
// self.permissions.set_delegate,
350-
// self.permissions.receive,
351-
// self.permissions.send,
352-
// self.permissions.edit_state,
353-
// ] {
354-
// for bit in auth.encode().to_bits() {
355-
// roi.append_bool(bit);
356-
// }
357-
// }
358-
// roi.append_bool(self.permissions.stake);
359-
360-
// // Self::snapp
361-
// let snapp_accout = match self.snap.as_ref() {
362-
// Some(snapp) => Cow::Borrowed(snapp),
363-
// None => Cow::Owned(SnappAccount::default()),
364-
// };
365-
// let mut hasher = create_legacy::<SnappAccount>(());
366-
// hasher.update(snapp_accout.as_ref());
367-
// let snapp_digest = hasher.digest();
368-
369-
// roi.append_field(snapp_digest);
370-
371-
// elog!("ROINPUT={:?}", roi);
372-
373-
// roi
374-
// }
375-
376242
fn domain_string(_: ()) -> Option<String> {
377243
Some("CodaAccount*********".to_string())
378244
}
379245
}
380246

381-
// mina_hasher::poseidon::
382-
383247
impl AccountLegacy {
384248
pub fn create() -> Self {
385-
// use o1_utils::field_helpers::FieldHelpers;
386-
387-
// let token_id = bs58::decode("wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf").into_vec().unwrap();
388-
// let token_id = Fp::from_bytes(&token_id).unwrap();
389-
390-
// elog!("token_id={:?}", token_id.to_string());
391-
392-
// let t = bs58::encode(token_id).into_string();
393-
// let t = bs58::encode(token_id.to_bytes()).into_string();
394-
// elog!("token_id={:?}", t);
395249

396250
let pubkey = CompressedPubKey::from_address(
397251
"B62qnzbXmRNo9q32n4SNu2mpB8e7FYYLH8NmaX6oFCBYjjQ8SbD7uzV",
398-
// "B62qiTKpEPjGTSHZrtM8uXiKgn8So916pLmNJKDhKeyBQL9TDb3nvBG", // Public_key.Compressed.empty
399252
)
400253
.unwrap();
401254

@@ -405,19 +258,14 @@ impl AccountLegacy {
405258
token_permissions: TokenPermissions::NotOwned {
406259
account_disabled: false,
407260
},
408-
// token_symbol: "".to_string(),
409-
// token_symbol: String::new(),
410261
balance: Balance::from_u64(10101),
411262
nonce: Nonce::from_u32(62772),
412263
receipt_chain_hash: ReceiptChainHash::default(),
413264
delegate: Some(pubkey),
414-
// delegate: None,
415265
voting_for: VotingFor::default(),
416266
timing: Timing::Untimed,
417267
permissions: PermissionsLegacy::user_default(),
418268
snap: None,
419-
// zkapp: None,
420-
// zkapp_uri: String::new(),
421269
}
422270
}
423271

0 commit comments

Comments
 (0)