Skip to content

Commit

Permalink
Merge branch 'master' into 2024-06-rendershape-depth-first-pre-order
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-develope authored Oct 9, 2024
2 parents 20a30a8 + 1ddbc26 commit 99a7562
Show file tree
Hide file tree
Showing 47 changed files with 1,024 additions and 1,093 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20' # The Go version to download (if necessary) and use.
go-version: '1.23' # The Go version to download (if necessary) and use.
- name: run benchmarks
run: make bench
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21" # The Go version to download (if necessary) and use.
go-version: "1.23" # The Go version to download (if necessary) and use.

# Some tests, notably TestRandomOperations, are extremely slow in CI
# with the race detector enabled, so we use -short when -race is
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Releaser
# This workflow helps with creating releases.
# This job will only be triggered when a tag (vX.X.x) is pushed
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10

permissions:
contents: read

jobs:
release:
permissions:
contents: write # for goreleaser/goreleaser-action to create a GitHub release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- name: Unshallow
run: git fetch --prune --unshallow
- name: Create release
uses: goreleaser/goreleaser-action@v3
with:
args: release --clean --release-notes ./RELEASE_NOTES.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.20.0"
go-version: "1.23"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/pr-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: PR Review Reminder

on:
schedule:
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC

permissions:
pull-requests: read

jobs:
pr-review:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: List open pull requests using GitHub Script
uses: actions/github-script@v7
id: pr-list
with:
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
let table = '';
pullRequests.forEach(pr => {
const assignees = pr.assignees.length > 0 ? `Assignees: ${pr.assignees.map(assignee => assignee.login).join(', ')}` : 'No assignees';
table += pr.draft ? '' : `
Title: ${pr.title}
Link: <${pr.html_url}>
Assigness: ${assignees}
`;
});
return table;
- name: Send Slack Reminder
if: steps.pr-list.outputs.result != ''
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: pr-github
SLACK_USERNAME: PR-Reminder
MSG_MINIMAL: true
SLACK_ICON_EMOJI: ":think:"
SLACK_COLOR: good
SLACKIFY_MARKDOWN: true
SLACK_TITLE: Daily Pull Request Review Reminder
SLACK_MESSAGE: |
${{ steps.pr-list.outputs.result }}
13 changes: 13 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
project_name: iavl

release:
github:
owner: cosmos
name: iavl

builds:
- skip: true

changelog:
disable: false
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## Unreleased

### Improvements

- [#952](https://github.com/cosmos/iavl/pull/952) Add `DeleteVersionsFrom(int64)` API.
- [#955](https://github.com/cosmos/iavl/pull/955) Get rid of `cosmos-db` deps completely.
- [#961](https://github.com/cosmos/iavl/pull/961) Add new `GetLatestVersion` API to get the latest version.
- [#965](https://github.com/cosmos/iavl/pull/965) Use expected interface for expected IAVL `Logger`.
- [#970](https://github.com/cosmos/iavl/pull/970) Close the pruning process when the nodeDB is closed.
- [#980](https://github.com/cosmos/iavl/pull/980) Use the `sdk/core/store.KVStoreWithBatch` interface instead of `iavl/db.DB` interface

## v1.2.0 May 13, 2024

### Improvements
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ all: lint test install

install:
ifeq ($(COLORS_ON),)
go install ./cmd/iaviewer
cd cmd && go mod tidy && go install ./iaviewer
else
go install $(CMDFLAGS) ./cmd/iaviewer
cd cmd && go mod tidy && go install $(CMDFLAGS) ./iaviewer
endif
.PHONY: install

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ In Ethereum, the analog is [Patricia tries](http://en.wikipedia.org/wiki/Radix_t
| [v0.20.x](https://github.com/cosmos/iavl/tree/release/v0.20.x) | [`cometbft-db`](https://github.com/cometbft/cometbft-db) | v0.47.x |
| [v1.0.3](https://github.com/cosmos/iavl/tree/release/v1.x.x) | [`cosmos-db`](https://github.com/cosmos/cosmos-db) | v0.50.0-5 |
| [v1.1.2,4](https://github.com/cosmos/iavl/tree/release/v1.x.x) | [`iavl-db`](https://github.com/cosmos/iavl) | v0.50.6 |
| [v1.2.x](https://github.com/cosmos/iavl/tree/release/v1.x.x) | [`iavl-db`](https://github.com/cosmos/iavl) | v0.50.7+ |
| [v1.2.x](https://github.com/cosmos/iavl/tree/release/v1.2.x) | [`iavl-db`](https://github.com/cosmos/iavl) | v0.50.7+ |
| [v1.3.0](https://github.com/cosmos/iavl/tree/release/v1.3.x) | [`iavl-db`](https://github.com/cosmos/iavl) | v0.52.x |
| [v2.0.0](https://github.com/cosmos/iavl/tree/master/v2) | [`iavl-db`](https://github.com/cosmos/iavl) | cosmossdk.io/store/v2 |

NOTE: In the past, a v0.21.x release was published, but never used in production. It was retracted to avoid confusion.
7 changes: 3 additions & 4 deletions basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"sort"
"testing"

"cosmossdk.io/core/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -442,14 +441,14 @@ func TestPersistence(t *testing.T) {
}

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

// Load a tree
t2 := NewMutableTree(db, 0, false, log.NewNopLogger())
t2 := NewMutableTree(db, 0, false, NewNopLogger())
t2.Load()
for key, value := range records {
t2value, err := t2.Get([]byte(key))
Expand Down Expand Up @@ -497,7 +496,7 @@ func TestProof(t *testing.T) {

func TestTreeProof(t *testing.T) {
db := dbm.NewMemDB()
tree := NewMutableTree(db, 100, false, log.NewNopLogger())
tree := NewMutableTree(db, 100, false, NewNopLogger())
hash := tree.Hash()
assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", hex.EncodeToString(hash))

Expand Down
7 changes: 3 additions & 4 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@ import (
"sync"

corestore "cosmossdk.io/core/store"
dbm "github.com/cosmos/iavl/db"
)

// BatchWithFlusher is a wrapper
// around batch that flushes batch's data to disk
// as soon as the configurable limit is reached.
type BatchWithFlusher struct {
mtx sync.Mutex
db dbm.DB // This is only used to create new batch
batch corestore.Batch // Batched writing buffer.
db corestore.KVStoreWithBatch // This is only used to create new batch
batch corestore.Batch // Batched writing buffer.

flushThreshold int // The threshold to flush the batch to disk.
}

var _ corestore.Batch = (*BatchWithFlusher)(nil)

// NewBatchWithFlusher returns new BatchWithFlusher wrapping the passed in batch
func NewBatchWithFlusher(db dbm.DB, flushThreshold int) *BatchWithFlusher {
func NewBatchWithFlusher(db corestore.KVStoreWithBatch, flushThreshold int) *BatchWithFlusher {
return &BatchWithFlusher{
db: db,
batch: db.NewBatchWithSize(flushThreshold),
Expand Down
9 changes: 4 additions & 5 deletions benchmarks/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"runtime"
"testing"

"cosmossdk.io/core/log"
corestore "cosmossdk.io/core/store"
"github.com/stretchr/testify/require"

Expand All @@ -26,8 +25,8 @@ func randBytes(length int) []byte {
return key
}

func prepareTree(b *testing.B, db dbm.DB, size, keyLen, dataLen int) (*iavl.MutableTree, [][]byte) {
t := iavl.NewMutableTree(db, size, false, log.NewNopLogger())
func prepareTree(b *testing.B, db corestore.KVStoreWithBatch, size, keyLen, dataLen int) (*iavl.MutableTree, [][]byte) {
t := iavl.NewMutableTree(db, size, false, iavl.NewNopLogger())
keys := make([][]byte, size)

for i := 0; i < size; i++ {
Expand Down Expand Up @@ -340,7 +339,7 @@ func runBenchmarks(b *testing.B, benchmarks []benchmark) {

// note that "" leads to nil backing db!
var (
d dbm.DB
d corestore.KVStoreWithBatch
err error
)
if bb.dbType != "nodb" {
Expand All @@ -365,7 +364,7 @@ func memUseMB() float64 {
return mb
}

func runSuite(b *testing.B, d dbm.DB, initSize, blockSize, keyLen, dataLen int) {
func runSuite(b *testing.B, d corestore.KVStoreWithBatch, initSize, blockSize, keyLen, dataLen int) {
// measure mem usage
runtime.GC()
init := memUseMB()
Expand Down
8 changes: 3 additions & 5 deletions benchmarks/cosmos-exim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"os"
"time"

"cosmossdk.io/core/log"

"github.com/cosmos/iavl"
idbm "github.com/cosmos/iavl/db"
)
Expand Down Expand Up @@ -92,7 +90,7 @@ func runExport(dbPath string) (int64, map[string][]*iavl.ExportNode, error) {
if err != nil {
return 0, nil, err
}
tree := iavl.NewMutableTree(idbm.NewPrefixDB(ldb, []byte("s/k:main/")), 0, false, log.NewNopLogger())
tree := iavl.NewMutableTree(idbm.NewPrefixDB(ldb, []byte("s/k:main/")), 0, false, iavl.NewNopLogger())
version, err := tree.LoadVersion(0)
if err != nil {
return 0, nil, err
Expand All @@ -104,7 +102,7 @@ func runExport(dbPath string) (int64, map[string][]*iavl.ExportNode, error) {
totalStats := Stats{}
for _, name := range stores {
db := idbm.NewPrefixDB(ldb, []byte("s/k:"+name+"/"))
tree := iavl.NewMutableTree(db, 0, false, log.NewNopLogger())
tree := iavl.NewMutableTree(db, 0, false, iavl.NewNopLogger())

stats := Stats{}
export := make([]*iavl.ExportNode, 0, 100000)
Expand Down Expand Up @@ -169,7 +167,7 @@ func runImport(version int64, exports map[string][]*iavl.ExportNode) error {
if err != nil {
return err
}
newTree := iavl.NewMutableTree(newDB, 0, false, log.NewNopLogger())
newTree := iavl.NewMutableTree(newDB, 0, false, iavl.NewNopLogger())
importer, err := newTree.Import(version)
if err != nil {
return err
Expand Down
34 changes: 6 additions & 28 deletions cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,29 @@ module github.com/cosmos/iavl/cmd
go 1.21

require (
cosmossdk.io/core v0.12.1-0.20240514205955-97c9bbb0341b
cosmossdk.io/log v1.3.2-0.20240514205955-97c9bbb0341b
github.com/cosmos/cosmos-db v1.0.2
cosmossdk.io/core v0.12.1-0.20240813134434-072a29c838a5
cosmossdk.io/log v1.3.1
github.com/cosmos/iavl v1.2.0
)

require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cosmos/gogoproto v1.4.12 // indirect
github.com/cosmos/gogoproto v1.6.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/linxGnu/grocksdb v1.8.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.12.0 // indirect
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/zerolog v1.32.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

replace github.com/cosmos/iavl => ../.
Loading

0 comments on commit 99a7562

Please sign in to comment.