Modules importing Sia do not use vendored dependencies
Our go.mod
file uses replace
directives to substitute in our vendored+altered versions of bbolt and smux. Unfortunately, it seems that if you import Sia from another module, these substitutions are not respected; the unvendored versions of bbolt and smux are used instead. This causes compilation errors, because the upstream version of bbolt does not provide the MmapError
type.
Fortunately, the bug only rears its head if you import a package like consensus
directly; if you just need to import types
, you'll be okay, because types
doesn't drag in bbolt
. So you're only affected if the Sia package you want to import depends on bbolt
.
There are three approaches to fixing this:
- We can make our forked versions of
bbolt
andsmux
proper modules. This may involve moving them to their own repos. - We can get our changes to
bbolt
andsmux
merged upstream. The changes are small enough that this may be feasible. - We can make
smux
andbbolt
internal packages, and avoid exposing their APIs. This would require wrapping things likebbolt.Tx
, which would mean change a lot of code.
My preference is to get our changes merged upstream. As I recall, we made two changes to bbolt (adding MmapError
and FlushDBPages
). MmapError
is a simple change, and we ended up removing FlushDBPages
later anyway. For smux
, I think we just fixed a deadlock. We should test the latest master branch of smux
and see if that fix is still necessary. Best case, we can switch to using the upstream versions of both packages, and we won't need to vendor anything anymore.