Sweat shallots and ginger in the oil in a large saucepan. Stir in flour and cook until it looks like wet sand. Whisk in stock and water. Add miso paste, soy sauce, fish sauce, sugar, sesame oil and chili flakes. Bring to a simmer and cook 20 minutes. Add corn and tofu and cook 10 minutes longer. Add snow peas or frozen peas and cook until vibrant green. Season, to taste, with salt.