Concelo / concelo

Real-time secure synchronization
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

Fix warnings #2

Open joshuawarner32 opened 8 years ago

joshuawarner32 commented 8 years ago

First, I changed the Build Notes until they worked without errors on my mac. I'm mostly just banging on my keyboard until it works, so the updated instructions may not be what you want - but at least the tests run fine for me.

With the original instructions, I was seeing the following error:

cabal: At least the following dependencies are missing:
QuickCheck >=2.8.2, tf-random >=0.5

Then, I went and fixed two classes of warnings that were causing the build to fail for me (because of -Werror). I'm using ghc 7.10.3, if that tells you anything.

dicej commented 8 years ago

Very brave of you to dive in to this. Note that I have several days worth of changes that I haven't pushed yet because the tests are failing pretty badly (mainly because they touch a lot more code). I should probably push what I have anyway, since the last version that passed all the tests only did so because those tests tiptoed around all the broken parts.

Anyway, feel free to play with stuff, but it probably won't make a lot of sense until I give you a design overview and explain which parts of the implementation are sane and which parts need to be overhauled. In particular, the code in SyncTree.hs tries to do way too much at once and is such a mess that it needs to be rewritten almost from scratch using a better separation of concerns. Its current state is the result of trying to patch over problems incrementally to get the tests to pass without making significant changes, but that just made everything worse.

There's really some great ideas hidden in all that mess; we just have to clean up and make them shine.

BTW, Travis doesn't have a GHC newer than 7.8, which is ancient. I spent a lot of time getting the code to build on both 7.8 and 7.10. The only sane way to do that is install both versions and iterate until they're both happy. That's why I defined my own Prelude, which is one popular way to hide the differences between GHC versions.

I'm also using 7.10.3, so I'm not sure why you got warnings that I didn't.

dicej commented 8 years ago

BTW, no point in spending a lot of time on this if we decide to switch to e.g. TypeScript anyway.

joshuawarner32 commented 8 years ago

I just added a config file for circle-ci, which supports ghc 7.10.2. Just something to consider.

Do you have your changes pushed to a branch? I'm happy to take on merging this in there.

Regardless of whether this code is being scrapped, this exercise was useful for me, to just poke around and see what works.

dicej commented 8 years ago

I just pushed my stuff to the diffs branch.

dicej commented 8 years ago

Let me reiterate: SyncTree.hs is currently a disaster that will hurt your brain.

Its intended purpose is to start with a set of "atoms" (i.e. things that can be serialized into unique bytestrings and later added or removed from the set but never modified), group those atoms into "chunks" which, when serialized, are no larger than Protocol.leafSize (and fragmenting any atoms that exceed that size), padding as necessary so every chunks is exactly Protocol.leafSize, optionally encrypting them, and then building a Merkle Tree from the result. Atoms can later be added to or removed from that set, and SyncTree will translate that diff to a (hopefully) minimal diff to the Merkle Tree. It can also handle the opposite case: you give it a set of Merkle Tree changes and it gives you back the sets of atoms added or removed, as well as the updated Merkle Tree itself.

The problem right now is it knows way more than it needs to about what those atoms are and how they're represented, which, combined with my still-weak Haskell skills has created a convoluted mess.