[feature]Zhihao: extract revert operations to functions