smartcontract: add bgp_status, last_bgp_up_at, last_bgp_reported_at to User#3467
Merged
Conversation
3c87a2f to
ebc9652
Compare
martinsander00
approved these changes
Apr 7, 2026
…o User Adds three new fields to the User struct (1+8+8 = 17 bytes): - bgp_status: BGPStatus enum (Unknown/Up/Down), defaults to Unknown - last_bgp_up_at: slot number of the most recent BGP up event - last_bgp_reported_at: slot number of the most recent BGP status report Old accounts without these bytes deserialize with zero/Unknown defaults (backward-compatible via unwrap_or_default in TryFrom). Updates all User struct initializations across activator, client, controlplane, smartcontract programs, cli, and sdk/rs. Regenerates fixtures (user.bin now 258 bytes, up from 241).
bd128d3 to
f8ddf57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves: #3465
Summary of Changes
Userstruct:bgp_status(BGPStatusenum: Unknown/Up/Down, 1 byte),last_bgp_up_at(slot number of the most recent BGP up event, 8 bytes), andlast_bgp_reported_at(slot number of the most recent BGP status report, 8 bytes)unwrap_or_defaultinTryFrom), preserving backward compatibilitysmartcontract/sdk/go/serviceability), external Go SDK (sdk/serviceability/go), TypeScript SDK, and Python SDK — each withBGPStatustype/enum and updated deserializersAIRDROP_USER_RENT_LAMPORTS_BYTESconstant (723 → 774) to account for the largerUseraccount size (241 → 258 bytes per account)Diff Breakdown
Most of the diff is mechanical scaffolding (struct initializations across activator, client, CLI, and SDK commands); the meaningful changes are concentrated in the state definition and SDK deserializers.
Key files (click to expand)
smartcontract/programs/doublezero-serviceability/src/state/user.rs— adds the three new fields to theUserstruct, updatesTryFrom<&[u8]>withunwrap_or_default, updates backward-compat test to strip 18 bytes, adds assertions for new fieldsactivator/src/process/user.rs— 19Userstruct initializations updated with new fieldssmartcontract/cli/src/user/list.rs— 18Userstruct initializations updatedsdk/serviceability/go/state.go— addsBGPStatustype withString(), addsBgpStatus,LastBgpUpAt,LastBgpReportedAttoUserstructsdk/serviceability/typescript/serviceability/state.ts— addsBGP_STATUS_*constants,bgpStatusString(), and new fields to theUserinterface and deserializersdk/serviceability/python/serviceability/state.py— addsBGPStatus(IntEnum)and new fields to theUserdataclass andfrom_bytes()smartcontract/programs/doublezero-serviceability/src/processors/accesspass/set.rs— updatesAIRDROP_USER_RENT_LAMPORTS_BYTES(258×3=774) and size assertions in the testsdk/serviceability/testdata/fixtures/generate-fixtures/src/main.rs— fixture generator setsbgp_status: BGPStatus::Up,last_bgp_up_at: 1_700_000_000,last_bgp_reported_at: 1_700_000_100Testing Verification
make rust-testpasses (230+ tests across serviceability program, all SDK crates, activator, client, CLI)make rust-lintcleanstate/user.rsverifies that truncating the last 18 bytes of a serializedUserdeserializestunnel_flags,bgp_status,last_bgp_up_at, andlast_bgp_reported_atall as zero/Unknownuser.binfixture (258 bytes), plus backward-compat tests using a truncated binaryRFC:
rfcs/rfc19-user-bgp-status.md