Why Nostr? What is Njump?
2023-09-11 20:24:08
in reply to

Doug Hoyte on Nostr: This is awesome, thank you! I'm trying to create a harness for this so we can run it ...

This is awesome, thank you!

I'm trying to create a harness for this so we can run it against the test-suite used by the C++ and JS implementations. For example, here's the C++ harness:

https://github.com/hoytech/negentropy/blob/master/test/cpp/harness.cpp

This is as far as I got:

https://gist.github.com/hoytech/96e65fc488fc39c2e782830f38727391

This is pretty much the first Rust code I've ever written, sorry about the bad quality. The problem I'm running into is that the reconcile() and reconcile_with_ids() methods seem to return String. If I understand rightly, Rust strings must be utf-8 encoded right?

In the current implementations, the reconcile messages must be in an 8-bit clean medium (or hex encoded). Same with the IDs (since they are typically hash function outputs). In C++ I use std::string because this allows any u8 values (and doesn't care anywhere about utf-8). In JS I allow Uint8Array values *or* hex-encoded strings.

Can we make the rust interface standardise on something 8-bit clean? Vec<u8> or some such? Or it's very possible I'm misinterpreting the code here. Any pointers are very much appreciated.
Author Public Key
npub1yxprsscnjw2e6myxz73mmzvnqw5kvzd5ffjya9ecjypc5l0gvgksh8qud4