Skip to content

Commit c652afb

Browse files
committed
test: remove redundant equivalence tests and unused helper
The individual definite/indefinite tests already verify all fields against expected constants, making the explicit field-by-field comparison tests logically redundant. Removes test_synth_indefiniteMatchesDefinite, test_real_indefiniteMatchesDefinite, and the now-unused _assertPtrsMatch helper.
1 parent a617197 commit c652afb

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

test/IndefiniteLengthCbor.t.sol

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -216,28 +216,6 @@ contract NitroValidatorIndefiniteLengthTest is Test {
216216
assertTrue(p.nonce.isNull(), "nonce null");
217217
}
218218

219-
/// @dev Asserts two Ptrs structs have identical field dimensions.
220-
function _assertPtrsMatch(NitroValidator.Ptrs memory a, NitroValidator.Ptrs memory b) internal pure {
221-
assertEq(a.moduleID.length(), b.moduleID.length(), "module_id mismatch");
222-
assertEq(a.timestamp, b.timestamp, "timestamp mismatch");
223-
assertEq(a.digest.length(), b.digest.length(), "digest mismatch");
224-
assertEq(a.pcrs.length, b.pcrs.length, "pcrs count mismatch");
225-
for (uint256 i = 0; i < a.pcrs.length; i++) {
226-
assertEq(a.pcrs[i].length(), b.pcrs[i].length(), "pcr length mismatch");
227-
}
228-
assertEq(a.cert.length(), b.cert.length(), "cert mismatch");
229-
assertEq(a.cabundle.length, b.cabundle.length, "cabundle count mismatch");
230-
for (uint256 i = 0; i < a.cabundle.length; i++) {
231-
assertEq(a.cabundle[i].length(), b.cabundle[i].length(), "cabundle cert mismatch");
232-
}
233-
assertEq(a.publicKey.isNull(), b.publicKey.isNull(), "public_key null mismatch");
234-
if (!a.publicKey.isNull()) {
235-
assertEq(a.publicKey.length(), b.publicKey.length(), "public_key length mismatch");
236-
}
237-
assertEq(a.userData.isNull(), b.userData.isNull(), "user_data null mismatch");
238-
assertEq(a.nonce.isNull(), b.nonce.isNull(), "nonce null mismatch");
239-
}
240-
241219
// ── TBS construction helpers ─────────────────────────────
242220

243221
/// @dev Wraps raw CBOR map bytes into a valid attestation-TBS envelope.
@@ -408,15 +386,6 @@ contract NitroValidatorIndefiniteLengthTest is Test {
408386
_assertSyntheticFields(validator.parseAttestation(tbs));
409387
}
410388

411-
/// @dev Both encodings produce identical parsed field values.
412-
function test_synth_indefiniteMatchesDefinite() public view {
413-
bytes memory entries = _entries();
414-
NitroValidator.Ptrs memory def = validator.parseAttestation(_buildTbs(abi.encodePacked(hex"a9", entries)));
415-
NitroValidator.Ptrs memory indef =
416-
validator.parseAttestation(_buildTbs(abi.encodePacked(CBOR_MAP_INDEFINITE, entries, CBOR_BREAK)));
417-
_assertPtrsMatch(def, indef);
418-
}
419-
420389
/// @dev Indefinite-length map with keys in a non-standard order.
421390
function test_synth_indefiniteLengthMap_reorderedKeys() public view {
422391
bytes memory tbs = _buildTbs(abi.encodePacked(CBOR_MAP_INDEFINITE, _reorderedEntries(), CBOR_BREAK));
@@ -441,14 +410,6 @@ contract NitroValidatorIndefiniteLengthTest is Test {
441410
_assertRealFields(validator.parseAttestation(indef));
442411
}
443412

444-
/// @dev Both encodings of the real attestation produce identical fields,
445-
/// covering non-null public_key (65B), 16 PCRs, 4-cert cabundle.
446-
function test_real_indefiniteMatchesDefinite() public view {
447-
bytes memory def = _realAttestationTbs();
448-
bytes memory indef = _toIndefiniteLength(def);
449-
_assertPtrsMatch(validator.parseAttestation(def), validator.parseAttestation(indef));
450-
}
451-
452413
// ══════════════════════════════════════════════════════════
453414
// EDGE CASES
454415
// ══════════════════════════════════════════════════════════

0 commit comments

Comments
 (0)