Modules importing Sia do not use vendored dependencies
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
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
There are three approaches to fixing this:
- We can make our forked versions of
smuxproper modules. This may involve moving them to their own repos.
- We can get our changes to
smuxmerged upstream. The changes are small enough that this may be feasible.
- We can make
bboltinternal packages, and avoid exposing their APIs. This would require wrapping things like
bbolt.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 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.