Cook the potatoes in boiling salted water for about 30 minutes until tender. Drain and peel.
Press the potatoes through a potato ricer. Leave to cool.
Add the egg and knead with enough flour to make a smooth, not sticky dough. Season with salt and nutmeg.
Shape the dough into rolls of about xxcm.
Cut the rolls into 2-3cm pieces and roll into balls.
On a floured surface, press each ball with the prongs of a fork. Leave the gnocchi to rest for about 20 minutes.
Peel the onion and cut into half rings. Peel and dice the garlic. Heat the olive oil in a frying pan, saute the onion and garlic until softened. Add the bay leaves and crushed chilies.
Chop the pancetta, add to the pan and cook until browned. Pour in the white wine and bring to the boil.
Add the tomatoes and season with salt, pepper and sugar. Cover and simmer gently for 10-15 minutes.
Meanwhile, cook the gnocchi (in batches) in a pan of boiling salted water until they float to the surface. Remove with a slotted spoon and leave to drain.
Place the drained gnocchi in the pan with the tomato sauce.
Stir briefly and scatter over half of the pecorino. Place in deep plates and serve the remaining cheese on the side.