You could use a classic "series capacitor" supply which uses the reactance of a capacitor as the main portion of the voltage dropping element.
i ~~= V/Xc = 230 x (2 x Pi x Freq x C) or
C ~~= i / (230 x 2 x Pi x Freq)
C per mA = 0.001 /(72256) @ 50 HZ.
Better - C = about 15 nF per mA with 230 VAC 50 Hz supply
So for 40 mA C = 40 x 15 = 600 nF = 0.6 uF
So eg a 1 uF 230 VAC X or Y rated capacitor plus the usual circuitry should work.
Above I use 230 VAC and say C ~~= as current supplied is not directly related to the RMS Voltage. The above should be close enough to start.
Note that the capacitors MUST be X or Y rated at the voltage used.
If the capacitor fails fully or partially short you will probably destroy the input circuit including the 2 x somewhat expensive HCPL-7520 amplifiers but the isolation will be maintained. Note that a capacitor based supply of this sort notionally has a "hot" side where phase/live is input and a notionally low voltage side where neutral/return is connected. However, ALWAYS assume that ALL points in such a supply are ALWAYS at full mains potential. Murphy ensures that sometimes they will be.
Another approach which is potentially slightly more accurate, lower cost and just as good long term but not quite s flexible experimentally, is to operate the microcontroller without mains isolation (so no expensive isolation amplifiers and no added errors) and the couple the digital outputs via eg opto isolators.
I am currently working on similar designs and am using the digital opto isolator approach. This has the advantages of lower cost isolation and no information losses across the isolation barrier due to signals being digital. The isolated power supply can be much lower current so the X or Y rated cap is smaller.
Worth considering is to use a PCBA from a mins to USB charger or other commercial PSU. If these are safe enough to connect to your cellphone they may be safe enough to use in your power meter live side supply* - and if they fail you still have the isolation amplifiers protecting you. You can also use such a supply to power a whole floating meter with processor and if you have optoisolated digital output you are s=till safe.
(* Pulling apart some cheap ones may make you wonder about this)
How confident are you that your rectified mains voltage will be exactly 310V?
How confident are you that 100 LEDs in series will have a voltage drop of exactly 310V?
Have you read the datasheet? What is the Forward Voltage tolerance specification?
What if your mains is actually 315V and/or your string of LEDs adds up to 308V?
LEDs need current limiting - they are not voltage-driven devices.
Best Answer
RMS voltages (and RMS currents) are just an abstraction humans use to boil down a bunch of numbers so we don't have to deal with an infinite number of instantaneous voltages from moment-to-moment. Similar to averages. It is an idea but not a "real" physical voltage. For example, the average birth rate might be 1.2 babies per person. How can you physically give birth to 1.2 living babies in reality? You can't.
Similarly, the capacitor is not a human. It doesn't work with abstractions. All it knows is what it physically experiences in physical reality which is the instantaneous voltage from moment to moment, and the highest instantaneous voltage the capacitor ever sees is the peak voltage so it must be able to withstand it.
A similar example is if you spend just as much money as you earn to survive. You have just as much money going into your bank account as you do coming out of your bank account. So on average, you are surviving with zero dollars in your bank account. But does that mean you can survive with no money? No, it doesn't. Because it is not the average that matters in this case. It is the moment-to-moment amount of money you have that matters. The average is just an abstracted number produced from many numbers so you can't use it as a replacement for the actual numbers in instances when the actual number at the moment matters.