<think>
Okay, I need to implement the unpack_frame function. Let's start by understanding the problem.

The input is a list of byte values, each between 0 and 255. The frame starts with a header varint that tells how many readings follow. Then there are that many varints as readings, and finally a trailer byte which is the sum of all previous bytes modulo 256. The function needs to decode this and return the list of readings. If any validation fails, it should raise a ValueError.

First, I need to parse the varint. A varint is a sequence of bytes where each byte (except the last) has the high bit set. The value is the sum of each byte's 7 bits, shifted appropriately. Also, each varint can't be longer than 5 bytes. Also, the final byte of a varint can't be zero. Wait, the problem says "a varint whose final byte is a wasted zero" is invalid. So, if the last byte is zero, that's an error.

So, the steps are:

1. Check if the input is a list. If not, raise error.
2. Parse the header varint. The header is the first varint. The number of readings is the value of this varint. If the header is invalid (like too long, or last byte is zero), error.
3. Then read that many varints as readings. Each of these must be valid varints. Also, check that each varint is not longer than 5 bytes, and their last byte is not zero.
4. Then, the trailer is the next byte. Check that it's equal to the sum of all previous bytes modulo 256. Also, check that there are no bytes left after the trailer.

So, the steps for the function:

- Validate the input is a list. If not, raise error.
- Parse the header varint. Check if it's valid. The header is the first varint in the data.
- Then, read the number of readings (header value) and check that the data has enough bytes left for those varints.
- For each reading, parse a varint and check validity.
- After all readings are parsed, check the trailer byte. Compute the sum of all bytes before the trailer (header + all readings), mod 256. The trailer must equal that sum.
- Also, check that there are no bytes left after the trailer.

Now, how to parse a varint. The function to parse a varint would take a list of bytes and return the integer value and the number of bytes consumed. Also, check that the varint is valid.

Let me think about the varint parsing function. For example, the varint is a sequence of bytes where each byte (except the last) has the high bit set. The value is the sum of each byte's 7 bits, shifted by 7*(i) for the i-th byte. Also, the varint can't be longer than 5 bytes, and the last byte can't be zero.

So, the function to parse a varint would process the bytes, check that each byte (except the last) has the high bit set, and that the last byte is not zero. Also, the length can't exceed 5.

So, for the header varint, the first step is to parse it. Then, the number of readings is the value of that varint. Then, for each of those readings, parse a varint. Then, the trailer is the next byte.

But also, after parsing the header and the readings, there must be exactly one trailer byte, and no more bytes left.

So, the steps in