Quote from a_person:
The government of Hamas was obligated under the terms of ceasefire to prevent all rocket attacks, not just arrest the perpetrators (which they mostly did not do). And they agreed to stop building tunnels and smuggling weapons which they also failed to honor.
In reality there were some violations on both sides but by and large the ceasefire held, when it expired Hamas refused to renew it and escalated rocket attacks, Livni and Egypt tried their best to renew the truce but Hamas kept refusing and kept firing more and more rockets.
Hamas did not have to prevent anything especially after Israel violated the ceasefire 195 times.
The tunnels were mainly to smuggle food and medicine to the population under seiged. The tunnels were dug after Israel imposed the illegal siege.