code and tests for the commit step of a transaction