Skip to content

Commit b981d72

Browse files
fix: preserve legacy user decoding
1 parent 56d8f83 commit b981d72

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

  • smartcontract
    • programs/doublezero-serviceability/src/state
    • sdk

smartcontract/programs/doublezero-serviceability/src/state/user.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,15 @@ pub struct User {
294294
)
295295
)]
296296
pub feed_pks: Vec<Pubkey>, // 4 + 32 * len
297-
pub accesspass_pk: Pubkey, // 32
297+
#[cfg_attr(
298+
feature = "serde",
299+
serde(
300+
default,
301+
serialize_with = "doublezero_program_common::serializer::serialize_pubkey_as_string",
302+
deserialize_with = "doublezero_program_common::serializer::deserialize_pubkey_from_string"
303+
)
304+
)]
305+
pub accesspass_pk: Pubkey, // 32
298306
}
299307

300308
impl Default for User {

smartcontract/sdk/go/serviceability/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ type User struct {
988988
BgpRttNs uint64
989989
// FeedPks are the EdgeSeat Feeds whose per-feed seats this user consumed at connect (multicast
990990
// only); empty for non-EdgeSeat/unicast users. A user may hold seats on multiple feeds.
991-
FeedPks [][32]byte
991+
FeedPks [][32]byte
992992
AccessPassPubKey [32]byte
993993
PubKey [32]byte
994994
}

smartcontract/sdk/rs/src/commands/accesspass/get.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn resolve_user_accesspass(
6161
Ok(AccountData::AccessPass(accesspass)) => Ok((user.accesspass_pk, accesspass)),
6262
Ok(_) => eyre::bail!(
6363
"Recorded access pass {} for user {user_pk} has the wrong account type",
64-
user.accesspass_pk
64+
user.accesspass_pk,
6565
),
6666
Err(err) => Err(err).wrap_err_with(|| {
6767
format!(
@@ -310,6 +310,8 @@ mod tests {
310310
assert_eq!(resolved, (accesspass_pk, expected_accesspass));
311311
}
312312

313+
// Legacy users record no pass. When both possible passes exist, deletion must ask the caller
314+
// to select one.
313315
#[test]
314316
fn test_resolve_user_accesspass_lists_legacy_conflict() {
315317
let mut client = create_test_client();
@@ -343,6 +345,7 @@ mod tests {
343345
assert!(message.contains("--access-pass <ADDRESS>"));
344346
}
345347

348+
// The caller resolves a legacy conflict by selecting either matching pass explicitly.
346349
#[test]
347350
fn test_resolve_user_accesspass_selects_legacy_candidate() {
348351
let mut client = create_test_client();

0 commit comments

Comments
 (0)