If you use the 40kWh cells with a 24kWh BMS, you will only get 24kWh of energy out/in. You need the entire 40kWh pack, the Resolve-EV controller is actually compatible with all different battery sizes natively. Don't bruteforce it!
The wiring is different for the 2013 and 2018. The current sensor has 4 pins instead of 3 pins. The BMS leads might have changed somethin, we don't have the 40kWh pinout available. Use an entire 40kWh pack (cells+wiring+LBC+currentsensor)
I'd love to not bruteforce it but modules are easier to find than entire battery packs now. You've popularized battery swapping for the leaf and I think one shop in Portland Oregon is buying all the stock in the US. 😅
I got the pinout for 2018 vs 2013 and verified that internally, the BMS wiring is identical except for the current sensor. However the wiring to the junction box is different. So the "easy" route I took was to piecemeal together a 40kwh pack with a combination of 2013 and 2018 parts.
2013 harness, with 2018 current sensor wiring, 2018 four wire current sensor, 2013 junction box, 40kwh modules. The BMS wires to modules are otherwise identical and the 2013 battery harness will work find with both 2018 BMS and 2013 junction box. 2018 harness will not work with a 2013 junction box as those pins are different. Add in your muxsan can bridge and this in theory should work in a leaf!
In short, if my understanding is correct it is possible to piece meal build a 40kwh leaf battery pack and swap it into a leaf. I don't have a leaf to test but you might one day. If you have difficulty finding full battery packs like me and are able to acquire modules, then this solution "might" work.
Edit: apologies, just realized I replied to a super old reply