Wikipedia cites the grand canonical partition function as
$$\mathcal{Z}=\sum_i e^{-\beta (E_i-\mu N_i)},$$
where $i$ denotes each available microstate of the system, $N_i$ the number of particles in that microstate, and $E_i$ the energy of that microstate.
From my lecture notes, I have the following definition
$$\mathcal{Z'}=\sum_{N=0}^{N_{tot}}\sum_i e^{-\beta (E_i-\mu N)}.$$
Here, we said $N$ changes from zero to some fixed number of total particles available to the system ($N_{tot}$), and each state has energy $E_i$.
To my understanding, the grand canonical ensemble allows for the number of particles in a system to change. Definition of $\mathcal{Z'}$ seems to suggest that exactly$-$we allow the system to have any number of particles from the range $0$ to $N_{tot}$, and for each $N$ we sum over all possible states those $N$ particles can be in. On the contrary, the definition of $\mathcal{Z}$ from wikipedia seems to suggest that the number of particles for each microstate $i$ is fixed$-$it seems that we simply sum over each microstate taking into account their energy and number of particles.
I am confused as to what the grand canonical ensemble really means in terms of particles being allowed to vary. Is my definition of $\mathcal{Z'}$ incorrect? Or is my understanding flawed?