The MMR code is copy from https://github.com/nervosnetwork/ckb/pull/1598
A generalized merkle mountain range implementation.