Add dried chillies, ginger, garlic, and shallots to a blender or food processor. Coarsely blend. You want some texture here, so pulse instead of continuously blending.
Coarsely pulse the Sichuan peppercorns, cassia bark and bay leaf if using.
Decant into a bowl and mix in the sugar, salt, star anise and sesame seeds. Set aside.
Add the oil to a large saucepan. (We are going to add the aromats into the hot oil which will make it sputter and bubble up wildly. So use a saucepan where the oil only comes about halfway up the top.)
Heat the oil. Test with a piece of ginger: drop it in. If it starts to sizzle and brown right away, your oil is ready. Take off the heat.
So here’s the bit you want to be careful about: add the aromats to a large ladle and lower it gently into the oil. As soon as it hits the oil it will sputter and bubble for a few seconds, so make sure to stand back. Wearing oven mitts wouldn't be a bad idea.
Let it sit for a minute. Stir a few times to make sure there are no large clumps at the bottom.
Let it cool to room temperature, then decant into a glass jar and refrigerate. To use, mix and use both the oil and the bits together.