Skip to content

Commit ff746b6

Browse files
committed
test: verify all PendingDeposit fields in processDepositRequest test
Verify pubkey, withdrawal_credentials, and signature fields are copied correctly. Use request.amount instead of hardcoded value for resilience. Addresses review feedback from gemini-code-assist. 🤖 Generated with AI assistance
1 parent e814805 commit ff746b6

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/state_transition/block/process_deposit_request.zig

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,24 @@ test "processDepositRequest - pending deposit fields match request" {
110110
var pending = try state.pendingDeposits();
111111
var deposit = try pending.get(0);
112112

113-
// Verify all fields were copied correctly
114-
// Verify amount and slot were correctly copied from the request
113+
// Verify all fields were copied correctly from the request
114+
var actual_pubkey: [48]u8 = undefined;
115+
var pubkey_view = try deposit.get("pubkey");
116+
_ = try pubkey_view.getAllInto(actual_pubkey[0..]);
117+
try testing.expectEqualSlices(u8, &request.pubkey, &actual_pubkey);
118+
119+
var actual_creds: [32]u8 = undefined;
120+
var creds_view = try deposit.get("withdrawal_credentials");
121+
_ = try creds_view.getAllInto(actual_creds[0..]);
122+
try testing.expectEqualSlices(u8, &request.withdrawal_credentials, &actual_creds);
123+
124+
var actual_sig: [96]u8 = undefined;
125+
var sig_view = try deposit.get("signature");
126+
_ = try sig_view.getAllInto(actual_sig[0..]);
127+
try testing.expectEqualSlices(u8, &request.signature, &actual_sig);
115128

116129
const amount_view = try deposit.get("amount");
117-
try testing.expectEqual(@as(u64, 32_000_000_000), amount_view);
130+
try testing.expectEqual(request.amount, amount_view);
118131

119132
const slot_view = try deposit.get("slot");
120133
const state_slot = try state.slot();

0 commit comments

Comments
 (0)