Skip to content

Commit

Permalink
Release 0.10.0 (#100)
Browse files Browse the repository at this point in the history
* dep: Change tendermint dep to be ^v0.22.0 (#91)

* Mutable/Immutable refactor and GetImmutable snapshots (#92)

* Release 0.10.0: Update Changelog and bump version (#99)

See changelog: https://github.com/tendermint/iavl/blob/develop/CHANGELOG.md#0100
  • Loading branch information
liamsi authored Aug 15, 2018
1 parent 35f66e5 commit e5726c0
Show file tree
Hide file tree
Showing 28 changed files with 1,101 additions and 709 deletions.
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# Changelog

## 0.10.0

BREAKING CHANGES

- refactored API for clean separation of [mutable][1] and [immutable][2] tree (#92, #88);
with possibility to:
- load read-only snapshots at previous versions on demand
- load mutable trees at the most recently saved tree

[1]: https://github.com/tendermint/iavl/blob/9e62436856efa94c1223043be36ebda01ae0b6fc/mutable_tree.go#L14-L21
[2]: https://github.com/tendermint/iavl/blob/9e62436856efa94c1223043be36ebda01ae0b6fc/immutable_tree.go#L10-L17

BUG FIXES

- remove memory leaks (#92)

IMPROVEMENTS

- Change tendermint dep to ^v0.22.0 (#91)

## 0.9.2 (July 3, 2018)

IMPROVEMTS
IMPROVEMENTS

- some minor changes: mainly lints, updated parts of documentation, unexported some helpers (#80)
- some minor changes: mainly lints, updated parts of documentation, unexported some helpers (#80)

## 0.9.1 (July 1, 2018)

Expand Down
72 changes: 62 additions & 10 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name = "github.com/tendermint/go-amino"

[[constraint]]
version = "=0.22.0-rc2"
version = "^0.22.0"
name = "github.com/tendermint/tendermint"

[prune]
Expand Down
35 changes: 17 additions & 18 deletions basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestBasic(t *testing.T) {
tree := NewTree(nil, 0)
tree := NewMutableTree(db.NewMemDB(), 0)
up := tree.Set([]byte("1"), []byte("one"))
if up {
t.Error("Did not expect an update (should have been create)")
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestBasic(t *testing.T) {

func TestUnit(t *testing.T) {

expectHash := func(tree *Tree, hashCount int64) {
expectHash := func(tree *ImmutableTree, hashCount int64) {
// ensure number of new hash calculations is as expected.
hash, count := tree.hashWithCount()
if count != hashCount {
Expand All @@ -121,7 +121,7 @@ func TestUnit(t *testing.T) {
}
}

expectSet := func(tree *Tree, i int, repr string, hashCount int64) {
expectSet := func(tree *MutableTree, i int, repr string, hashCount int64) {
origNode := tree.root
updated := tree.Set(i2b(i), []byte{})
// ensure node was added & structure is as expected.
Expand All @@ -130,11 +130,11 @@ func TestUnit(t *testing.T) {
i, P(origNode), repr, P(tree.root), updated)
}
// ensure hash calculation requirements
expectHash(tree, hashCount)
expectHash(tree.ImmutableTree, hashCount)
tree.root = origNode
}

expectRemove := func(tree *Tree, i int, repr string, hashCount int64) {
expectRemove := func(tree *MutableTree, i int, repr string, hashCount int64) {
origNode := tree.root
value, removed := tree.Remove(i2b(i))
// ensure node was added & structure is as expected.
Expand All @@ -143,7 +143,7 @@ func TestUnit(t *testing.T) {
i, P(origNode), repr, P(tree.root), value, removed)
}
// ensure hash calculation requirements
expectHash(tree, hashCount)
expectHash(tree.ImmutableTree, hashCount)
tree.root = origNode
}

Expand Down Expand Up @@ -190,7 +190,7 @@ func TestRemove(t *testing.T) {

d := db.NewDB("test", "memdb", "")
defer d.Close()
t1 := NewVersionedTree(d, size)
t1 := NewMutableTree(d, size)

// insert a bunch of random nodes
keys := make([][]byte, size)
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestIntegration(t *testing.T) {
}

records := make([]*record, 400)
tree := NewTree(nil, 0)
tree := NewMutableTree(db.NewMemDB(), 0)

randomRecord := func() *record {
return &record{randstr(20), randstr(20)}
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestIterateRange(t *testing.T) {
}
sort.Strings(keys)

tree := NewTree(nil, 0)
tree := NewMutableTree(db.NewMemDB(), 0)

// insert all the data
for _, r := range records {
Expand Down Expand Up @@ -372,14 +372,14 @@ func TestPersistence(t *testing.T) {
}

// Construct some tree and save it
t1 := NewVersionedTree(db, 0)
t1 := NewMutableTree(db, 0)
for key, value := range records {
t1.Set([]byte(key), []byte(value))
}
t1.SaveVersion()

// Load a tree
t2 := NewVersionedTree(db, 0)
t2 := NewMutableTree(db, 0)
t2.Load()
for key, value := range records {
_, t2value := t2.Get64([]byte(key))
Expand All @@ -390,12 +390,11 @@ func TestPersistence(t *testing.T) {
}

func TestProof(t *testing.T) {
t.Skipf("This test has a race condition causing it to occasionally panic.")

// Construct some random tree
db := db.NewMemDB()
tree := NewVersionedTree(db, 100)
for i := 0; i < 1000; i++ {
tree := NewMutableTree(db, 100)
for i := 0; i < 10; i++ {
key, value := randstr(20), randstr(20)
tree.Set([]byte(key), []byte(value))
}
Expand All @@ -404,7 +403,7 @@ func TestProof(t *testing.T) {
tree.SaveVersion()

// Add more items so it's not all persisted
for i := 0; i < 100; i++ {
for i := 0; i < 10; i++ {
key, value := randstr(20), randstr(20)
tree.Set([]byte(key), []byte(value))
}
Expand All @@ -415,15 +414,15 @@ func TestProof(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, value, value2)
if assert.NotNil(t, proof) {
verifyProof(t, proof, tree.Hash())
verifyProof(t, proof, tree.WorkingHash())
}
return false
})
}

func TestTreeProof(t *testing.T) {
db := db.NewMemDB()
tree := NewTree(db, 100)
tree := NewMutableTree(db, 100)

// should get false for proof with nil root
_, _, err := tree.GetWithProof([]byte("foo"))
Expand All @@ -442,7 +441,7 @@ func TestTreeProof(t *testing.T) {
assert.NoError(t, err)

// valid proof for real keys
root := tree.Hash()
root := tree.WorkingHash()
for _, key := range keys {
value, proof, err := tree.GetWithProof(key)
if assert.NoError(t, err) {
Expand Down
Loading

0 comments on commit e5726c0

Please sign in to comment.