M4 nuts and set screws for the gears. I try to avoid M3 bolts unless absolutely necessary, because the nuts spin in the slots unless your tolerances are spot on.
I also recommend a blob of loctite on the motor gear set screw, mine tends to work loose as it gets thrashed around with retractions.
Oh and also print at least the motor gear with 100% infill if you can, its under a lot of torque and you need to be able to do the set screw up tight without distorting the gear. The other gears aren't as bad, but I now print all my gears with 100% fill just to be safe, it actually doesn't use much more plastic since the big gears are mostly hollowed out anyway.