private void blobsWithCommitmentsFieldSize(
      final Function<Transaction, List<? extends Object>> containerExtractor,
      final long containerSize,
      final long itemSize) {
    TransactionTestFixture preparedTx =
        prepareTransaction(
            TransactionType.BLOB, 10, Wei.of(500), Wei.of(50), 10, 1, BlobType.KZG_PROOF, null);
    Transaction txBlob = preparedTx.createTransaction(KEYS1);
    BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
    TransactionEncoder.encodeRLP(txBlob, rlpOut, EncodingContext.POOLED_TRANSACTION);

    txBlob =
        TransactionDecoder.decodeRLP(
                new BytesValueRLPInput(rlpOut.encoded(), false), EncodingContext.POOLED_TRANSACTION)
            .detachedCopy();
    System.out.println(txBlob.getSender());
    System.out.println(txBlob.getHash());
    System.out.println(txBlob.getSize());

    final List<? extends Object> list = containerExtractor.apply(txBlob);

    final long cSize = sizeOfField(list, ".elements[");

    System.out.println("Container size: " + cSize);

    assertThat(cSize).isEqualTo(containerSize);

    final Object item = list.get(0);
    final long iSize = sizeOfField(item);

    System.out.println("Item size: " + iSize);

    assertThat(iSize).isEqualTo(itemSize);
  }
Field which value is dynamic and can only be calculated at runtime
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactionEstimatedMemorySizeTest.java