Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database/pebbledb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ func keyRange(start, prefix []byte) *pebble.IterOptions {
// Assumes the Database uses bytes.Compare for key comparison and not a custom
// comparer.
func prefixToUpperBound(prefix []byte) []byte {
for i := len(prefix) - 1; i >= 0; i-- {
if prefix[i] != 0xFF {
for i, v := range slices.Backward(prefix) {
if v != 0xFF {
upperBound := make([]byte, i+1)
copy(upperBound, prefix)
upperBound[i]++
Expand Down
4 changes: 2 additions & 2 deletions database/rpcdb/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package rpcdb
import (
"context"
"encoding/json"
"slices"
"sync"

"google.golang.org/protobuf/types/known/emptypb"
Expand Down Expand Up @@ -151,8 +152,7 @@ type batch struct {
func (b *batch) Write() error {
request := &rpcdbpb.WriteBatchRequest{}
keySet := set.NewSet[string](len(b.Ops))
for i := len(b.Ops) - 1; i >= 0; i-- {
op := b.Ops[i]
for _, op := range slices.Backward(b.Ops) {
key := string(op.Key)
if keySet.Contains(key) {
continue
Expand Down
4 changes: 2 additions & 2 deletions x/merkledb/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"math"
"slices"

"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -678,8 +679,7 @@ func addPathInfo(
shouldInsertRightChildren = insertChildrenGreaterThan.HasValue()
)

for i := len(proofPath) - 1; i >= 0; i-- {
proofNode := proofPath[i]
for _, proofNode := range slices.Backward(proofPath) {
key := proofNode.Key

if key.hasPartialByte() && !proofNode.ValueOrHash.IsNothing() {
Expand Down