Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

## Unreleased

### Breaking

### Changes

- SDK (Go)
- Add CreateUser / DeleteUser to the serviceability executor with cross-language wire-format fixtures and four new PDA helpers (GetUserPDA, GetAccessPassPDA, GetTunnelIdsPDA, GetDzPrefixBlockPDA)

## [v0.25.0](https://github.com/malbeclabs/doublezero/compare/client/v0.24.0...client/v0.25.0) - 2026-05-29

### Breaking
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions sdk/serviceability/testdata/fixtures/generate-fixtures/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use borsh::BorshSerialize;

use doublezero_serviceability::id_allocator::IdAllocator;
use doublezero_serviceability::ip_allocator::IpAllocator;
use doublezero_serviceability::processors::user::{
create::UserCreateArgs, delete::UserDeleteArgs,
};
use doublezero_serviceability::programversion::ProgramVersion;
use doublezero_serviceability::state::{
accesspass::{AccessPass, AccessPassStatus, AccessPassType},
Expand Down Expand Up @@ -95,11 +98,65 @@ fn main() {
generate_tenant(&fixtures_dir);
generate_resource_extension_id(&fixtures_dir);
generate_resource_extension_ip(&fixtures_dir);
generate_user_create_args(&fixtures_dir);
generate_user_delete_args(&fixtures_dir);

println!("
all fixtures generated in {}", fixtures_dir.display());
}

/// Borsh-encoded `UserCreateArgs` (the body of instruction variant 36, without the
/// 1-byte discriminant). Field order: user_type, cyoa_type, client_ip, tunnel_endpoint,
/// dz_prefix_count. Non-default IP octets make endianness mistakes detectable.
fn generate_user_create_args(dir: &Path) {
let val = UserCreateArgs {
user_type: UserType::IBRL,
cyoa_type: UserCYOA::GREOverDIA,
client_ip: Ipv4Addr::new(10, 11, 12, 13),
tunnel_endpoint: Ipv4Addr::new(192, 168, 1, 2),
dz_prefix_count: 2,
};

let data = borsh::to_vec(&val).unwrap();

let meta = FixtureMeta {
name: "UserCreateArgs".into(),
// Not an account; account_type=0 since this is an instruction-args fixture.
account_type: 0,
fields: vec![
FieldValue { name: "UserType".into(), value: "0".into(), typ: "u8".into() },
FieldValue { name: "CyoaType".into(), value: "1".into(), typ: "u8".into() },
FieldValue { name: "ClientIp".into(), value: "10.11.12.13".into(), typ: "ipv4".into() },
FieldValue { name: "TunnelEndpoint".into(), value: "192.168.1.2".into(), typ: "ipv4".into() },
FieldValue { name: "DzPrefixCount".into(), value: "2".into(), typ: "u8".into() },
],
};

write_fixture(dir, "user_create_args", &data, &meta);
}

/// Borsh-encoded `UserDeleteArgs` (the body of instruction variant 42, without the
/// 1-byte discriminant). Field order: dz_prefix_count, multicast_publisher_count.
fn generate_user_delete_args(dir: &Path) {
let val = UserDeleteArgs {
dz_prefix_count: 3,
multicast_publisher_count: 1,
};

let data = borsh::to_vec(&val).unwrap();

let meta = FixtureMeta {
name: "UserDeleteArgs".into(),
account_type: 0,
fields: vec![
FieldValue { name: "DzPrefixCount".into(), value: "3".into(), typ: "u8".into() },
FieldValue { name: "MulticastPublisherCount".into(), value: "1".into(), typ: "u8".into() },
],
};

write_fixture(dir, "user_delete_args", &data, &meta);
}

fn generate_global_state(dir: &Path) {
let foundation_pk = pubkey_from_byte(0x01);
let activator_pk = pubkey_from_byte(0x02);
Expand Down
Binary file not shown.
31 changes: 31 additions & 0 deletions sdk/serviceability/testdata/fixtures/user_create_args.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "UserCreateArgs",
"account_type": 0,
"fields": [
{
"name": "UserType",
"value": "0",
"typ": "u8"
},
{
"name": "CyoaType",
"value": "1",
"typ": "u8"
},
{
"name": "ClientIp",
"value": "10.11.12.13",
"typ": "ipv4"
},
{
"name": "TunnelEndpoint",
"value": "192.168.1.2",
"typ": "ipv4"
},
{
"name": "DzPrefixCount",
"value": "2",
"typ": "u8"
}
]
}
1 change: 1 addition & 0 deletions sdk/serviceability/testdata/fixtures/user_delete_args.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

16 changes: 16 additions & 0 deletions sdk/serviceability/testdata/fixtures/user_delete_args.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "UserDeleteArgs",
"account_type": 0,
"fields": [
{
"name": "DzPrefixCount",
"value": "3",
"typ": "u8"
},
{
"name": "MulticastPublisherCount",
"value": "1",
"typ": "u8"
}
]
}
Loading
Loading