[feature]Zhihao: extract revert operations to functions
Zhihao: Format code