Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update to sqlite version 1.19.1 #126

Merged
merged 4 commits into from
Sep 20, 2022
Merged

build: update to sqlite version 1.19.1 #126

merged 4 commits into from
Sep 20, 2022

Conversation

Roasbeef
Copy link
Member

We were on a version a few months old.

Main driver of this was I ran into this issue in another branch:
https://gitlab.com/cznic/sqlite/-/issues/77.

Updating fixes it, but then runs into some other related race. The
author of the library asked about the first on the sqlite forums and
that the race also exists in the orginal C codebase, but it isn't an
issue.

The tests fail as is, since there was a bug fix w.r.t how the NULL
constraints and NULL insertion was handleed. It looks like this was
resolved here: https://gitlab.com/cznic/sqlite/-/issues/100 and here
https://gitlab.com/cznic/sqlite/-/issues/98. Seems like the classic case
of nil vs []byte{}.

For now, I've removed the constraint on the witness stack, since today
we rely on the behavior where we can read out a NULL element for
the witness of a genesis asset.

We were on a version a few months old.

Main driver of this was I ran into this issue in another branch:
https://gitlab.com/cznic/sqlite/-/issues/77.

Updating fixes it, but then runs into some other related race. The
author of the library asked about the first on the sqlite forums and
that the race also exists in the orginal C codebase, but it isn't an
issue.

The tests fail as is, since there was a bug fix w.r.t how the NULL
constraints and NULL insertion was handleed. It looks like this was
resolved here: https://gitlab.com/cznic/sqlite/-/issues/100 and here
https://gitlab.com/cznic/sqlite/-/issues/98. Seems like the classic case
of `nil` vs `[]byte{}`.
The new DeepEqual methods added won't work properly. For example, in the
TestImportAssetProof test, we use the randomly generated asset as the
root asset in a split commitment. We serialize this as a raw asset
within the split commitment proof. However, we have certain fields we
maintain in memory in the struct that are never serialized. An example
of such a field is the raw family key. As a result, these two assets
will never return true from `DeepEqual`. For now, we go back to
asserting against the serialized versions.
The update to sqlite fixes an issue where a nil byte slice would be
stored/interpreted as a `[]byte` instead of a zero sized blob.

As a result, after a restart, we would be passing down a NULL Taro root
to the DB. With the older version this would be written, but the newer
version now properly rejects this as a NULL constraint violation.

We now also cache the script root and return that along side the key.
@Roasbeef Roasbeef merged commit f49c196 into main Sep 20, 2022
@guggero guggero deleted the sqlite-19-1 branch September 20, 2022 07:40
// not equal.
if !isEqual {
require.Equal(t, witB, witA)
require.Equal(t, witA.PrevID, witB.PrevID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry about that! And thanks for the fix 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants