• Kirill Smelkov's avatar
    encoder: Adjust it so that decode(encode(v)) == v · 4fd6be93
    Kirill Smelkov authored
    That is so that decode·encode becomes identity.
    
    For the other way
    
    	encode(decode(pickle)) == pickle
    
    it is generally not possible to do, because pickle machine is almost
    general machine, and it is possible to e.g. have some prefix in program
    which is NOP or result of which is no longer used, use different opcodes
    to build list or tuple etc.
    
    Adjustments to encoder are:
    
    - teach it to encode big.Int back to opLong (not some struct)
    - teach it to encode Call back to opReduce (not some struct)
    
    Tests are adjusted to verify that `decode(encode(v)) == v` holds for
    all inputs in test vector.
    4fd6be93
encode.go 6.26 KB