add ret code check in protobuf serialisation testing
add budget shared type
implement protobuf serialization