Repository navigation
Conversation
Sketch of how
info on realms was superfluous.
Contributor
Author
|
All the stuff describing realms belong somewhere else, the basic description of logos is enough |
Contributor
Author
|
Seems this is contained in the one with the make file |
zivkovicmilos
pushed a commit
that referenced
this pull request
May 30, 2025
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v3...v4) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
matijamarjanovic
added a commit
to matijamarjanovic/gno
that referenced
this pull request
Sep 10, 2025
STEFAN'S CHECKLIST - [x] Add LLTV attr to create market event - [x] In case Supply, Borrow, Withdraw or Repay functions are called with arg `assets = 0` and `shares > 0` convert the shares amount to assets amount and always emit assets in the events (this means shares attr can be removed from the event emitted) --------- Co-authored-by: stefann-01 <[email protected]>
clockworkgr
added a commit
that referenced
this pull request
Apr 17, 2026
…discipline Non-behavioural cleanup across the B+32 tree package. No on-disk format, hash, or semantics change. All existing tests (including -race) pass. Finding #19 — Dead code and dead config - Remove unused sumSizes helper from split.go. - Remove FlushThreshold and AsyncPruning fields and their helpers from Options; neither was wired into any code path. DefaultOptions() now returns the zero value. - Drop redundant `B & (B-1) != 0` power-of-two assertion in const.go init; it is subsumed by the `B == 1<<MiniMerkleDepth` check. - Update bptree_test.go to match the leaner Options struct. Finding #20 — Uniform separator-copy discipline and naming fixes - splitInner takes an explicit copyKey() of the separator it promotes so that the new parent owns its key bytes (tightens the key-ownership invariant documented on (*InnerNode).Clone and (*LeafNode).Clone). - Fix nodedb.DeleteRoot doc comment (previously copy-pasted from an earlier DeleteVersion variant). - iterator.seekLast simplified: searchLeaf's returned position already identifies the correct boundary; no need for a hand-rolled scan. Finding #22 — Magic numbers and brittle constants - Extract the single-byte varint form of HashSize (32 → 0x20) into a named constant valueHashLenVarint in hash.go. The package init asserts HashSize < 0x80 still holds, so the varint form remains one byte and the ICS23-compatible leaf hash input is byte-identical. - Tighten maxReadBytesLen from 1 MiB to 64 KiB. readBytes is only reached for keys (inner separators and leaf keys); values are referenced via fixed-size NodeKey refs, not varint-length-prefixed bytes. 64 KiB bounds a single malicious length prefix to a sane allocation while still being an order of magnitude above any realistic key size. Finding #24 — Safe replacement of mutex-reinit; Clone aliasing - Rewrite (*InnerNode).Clone as an explicit struct literal instead of `c := *n; c.childMu = sync.Mutex{}`. The value-copy-then-reinit pattern copies the mutex value even though the field is immediately overwritten; vet correctly flags this as unsafe. The new form never copies sync.Mutex at all, and every clone gets a zero-init mutex so concurrent lazy-loads on siblings never alias. - In innerInsert, replace `*inner = *leftInner` (which would have value-copied the sync.Mutex from a freshly-built leftInner) with an explicit per-field assignment that preserves inner.childMu and inner.ndb (leftInner is constructed without ndb). - Expand (*InnerNode).Clone and (*LeafNode).Clone doc comments to document the aliasing contract: clones share keys/children slice headers with their source, and the bytes behind each `keys[i]` are never mutated in place — insert/remove/redistribute paths only overwrite whole slice headers or nil them, so every clone's view of keys remains consistent. Finding #27 — Cosmetic cleanups - innerInsert's allChildRefs initialisation no longer writes position childIdx twice. The old code did `copy(allChildRefs[:childIdx+1], inner.children[:childIdx+1])` and then assigned `allChildRefs[childIdx] = nil`, clobbering the just-copied value. The replacement copies `[:childIdx]` and assigns childIdx explicitly. - Collapse `parent.childSizes[idx] = parent.childSizes[idx] + parent.childSizes[idx+1]` to `+=` in remove.merge.
8 tasks done
clockworkgr
added a commit
that referenced
this pull request
Apr 22, 2026
A line-by-line critical pass over the PR (six parallel reviewers,
results cross-verified) surfaced five actual bugs in the work
landed on this branch. All five are closed here without changing
tree semantics or the PR's headline correctness/perf story.
BUG-1 (HIGH) — Store.GetImmutable leaked version readers
Files: tm2/pkg/store/bptree/{store.go,tree.go,store_test.go,
coverage_test.go}
The store wrapper's Store.GetImmutable returned a *Store with no
Close path. Each call permanently incremented versionReaders[v]
with no decrement. Since the store wrapper is the production
interface (tm2/pkg/store/rootmulti and the IAVL-compat layer),
this defeated the very contract Findings #1/#15/#30/#40 added to
PruneVersionsTo — pruning would block on stranded reader counts
as soon as any consumer used GetImmutable.
Fix: added CloseSnapshot() error to the Tree interface (no-op on
the mutable adapter; calls bp.ImmutableTree.Close on the
immutable adapter) and Store.Close() that propagates. Updated
the four GetImmutable test sites that previously leaked.
BUG-2 (MEDIUM) — SaveVersion idempotent path leaked session state
File: tm2/pkg/bptree/mutable_tree.go
When SaveVersion(N) found N already persisted with the matching
hash, the early return skipped clearing sessionValues,
versionOrphans, and resetting nextValueNonce. A subsequent
Rollback would DeleteValueDirect VKs that t.lastSaved still
references; the next SaveVersion would carry stale orphans and
non-zero nonces forward into the wrong namespace.
Fix: clear all three before the idempotent return so the
post-condition matches a normal successful save.
BUG-3 (MEDIUM) — LoadVersion partial failure poisoned nextValueNonce
File: tm2/pkg/bptree/mutable_tree.go
In LoadVersion, if maxValueNonceForVersion succeeded but loadNode
then failed, t.nextValueNonce was set for the *failed-load*'s
working-version namespace. The tree's t.version was unchanged
(still the prior version). The next Set against the OLD t.version
would allocate VKs in the wrong namespace, re-introducing the
value-overwrite hazard maxValueNonceForVersion was added in this
PR to prevent.
Fix: snapshot the prior nonce; restore on loadNode failure.
BUG-4 (LOW) — Panic in nodeKeyBytesToArr bypassed batch discard
File: tm2/pkg/bptree/prune.go
nodeKeyBytesToArr panicked on short slices (a corruption
diagnostic per Finding #47). The panic propagated out of
markReachable / sweepOld past the explicit discardBatch calls in
PruneVersionsTo's loop, leaving ndb.batch with partial deletes
that the next Commit would flush — corrupting the prune
bookkeeping further (firstVersion not advanced, but partial node
deletes flushed on the next save).
Fix: returned a typed ErrShortNodeKeyRef; updated both call sites
in markReachable and sweepOld to propagate the error so
PruneVersionsTo's discardBatch path runs cleanly.
BUG-5 (LOW) — merge skipped copyKey for absorbed right-keys
File: tm2/pkg/bptree/remove.go
The leaf and inner cases in merge appended right's keys into left
without copyKey(), breaking Finding #20's "all separator
boundaries use copyKey" uniform discipline. Safe today under the
immutable-key-bytes invariant, but inconsistent — a future
in-place key mutation elsewhere in the codebase would silently
corrupt prior snapshots that share these slice headers via the
merged-left.
Fix: added copyKey() at both sites with comments referencing
Finding #20.
Verification:
go test -count=1 ./tm2/pkg/bptree/... ./tm2/pkg/store/bptree/...
PASS (full suite)
go test -race -count=1 -run='TestPrune|TestSaveVersion|
TestLoadVersion|TestStore|TestImmutable|TestGetImmutable|
TestIdempotent' ./tm2/pkg/bptree/ ./tm2/pkg/store/bptree/
PASS
Six remaining concerns from the same review (not blocking) are
documented in the PR description as C-1 through C-6.
clockworkgr
added a commit
that referenced
this pull request
Apr 22, 2026
…-advanced Brings the two follow-up commits from the second-pass branch into the advanced branch (which had diverged with the latest-view cache, inline-value v2 leaf format, and prefix-compressed v3 leaf format). Incoming commits: d8b3d2b chore: Update benchmarks to pebbledb a807ec5 fix(bptree): final review pass — close 5 self-review bugs The benchmarks swap (goleveldb → pebbledb to match gno.land's production default) and the 5 self-review bug fixes are now reflected on this branch: BUG-1 — Store.GetImmutable leaked version readers BUG-2 — SaveVersion idempotent path leaked session state BUG-3 — LoadVersion partial failure poisoned nextValueNonce BUG-4 — Panic in nodeKeyBytesToArr bypassed batch discard BUG-5 — merge skipped copyKey for absorbed right-keys See PR-5750.md history (or the a807ec5 commit body) for the per-bug rationale. Conflict resolution ------------------- Single conflict, in tm2/pkg/bptree/remove.go's merge() LeafNode case. Both branches mutated this region: - second-pass added copyKey() per BUG-5 (Finding #20 uniform discipline) and called RebuildMiniMerkle(). - advanced rewrote the case to handle the v2/v3 leaf format — inlineValues, slotHashes, inlineMask, miniTreeDirty — and moved to deferred mini-merkle rebuild via miniTreeDirty. Resolved by keeping advanced's structure (dst-indexed batch write, inline-value handling, miniTreeDirty) AND adding copyKey(r.keys[i]) per BUG-5, matching the InnerNode case in the same function (which auto-merged successfully because advanced didn't touch it). The InnerNode case already had both miniTreeDirty (from advanced) and copyKey (from second-pass) after auto-merge. Verification ------------ go build ./tm2/pkg/bptree/... ./tm2/pkg/store/bptree/... OK go test -count=1 -timeout=10m ./tm2/pkg/bptree/... ./tm2/pkg/store/bptree/... PASS (full suite) All five bug-fix points verified present in their merged form: - BUG-1: Store.Close + CloseSnapshot in store.go / tree.go - BUG-2: idempotent SaveVersion cleanup at mutable_tree.go:449 - BUG-3: priorNonce snapshot/restore at mutable_tree.go:648,675 - BUG-4: ErrShortNodeKeyRef + error-returning helper in prune.go - BUG-5: copyKey in merge LeafNode and InnerNode cases in remove.go Note on stale references: the merged comments still cite "PR-5750" and "BENCHMARKS-5570.md" (both names from the second-pass branch's artifacts). Branch is now PR #5571 — the citations are kept verbatim to preserve commit-message provenance, but follow-up work should retitle the artifacts to match the new PR number.
jaekwon
added a commit
that referenced
this pull request
Apr 25, 2026
…byte field branches (BINARY_FIXES #20) Reflect's writeFieldIfNotEmpty (binary_encode.go:592) rolls back when the value is a single 0x00 byte and !isWriteEmpty. The String, []byte slice, and [N]byte array branches of writeFieldValueMarshal previously emitted PrependString / PrependByteSlice + field key unconditionally, ignoring the writeEmpty argument. Reachability today: outer field-level zeroCheck filters empty strings and empty []byte before they reach writeFieldValueMarshal. But [N]byte arrays have empty zeroCheck (Array kind not in the zeroCheck switch), so the filter is bypassed; for `[0]byte` (or any field where the array prepend emits exactly [0x00]) the bug is reachable. AminoMarshaler- non-struct routing through writeFieldValueMarshal is the original #20 motivation. Add a `writeByteLengthFieldWithRollback` helper: if writeEmpty: unconditional emit else: { before := offset; valueStmt; valueLen := before - offset; if valueLen > 1 || (valueLen == 1 && buf[offset] != 0x00) { key } else { offset = before } } Switch the three branches of writeFieldValueMarshal to use the helper. Sibling of #16 (default-branch rollback), #26 (writeLengthPrefixedField), and #13 (writeInterfaceFieldMarshal) — completes uniform single-0x00 rollback contract across all length-prefixed emission sites. List emission sites (writePackedSliceReprMarshal, writeSliceReprMarshal, writeUnpackedListMarshal) intentionally NOT covered: reflect's per-element encoding in lists does not go through writeFieldIfNotEmpty (list element emission repeats the field key as-is, no rollback contract). Adds TestWriteFieldValueMarshal_StringByteSliceByteArrayRollback asserting the rollback predicate appears at PrimitivesStruct (Str, Bytes) and ArraysStruct (ByteAr) emission sites. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jaekwon
added a commit
that referenced
this pull request
Apr 25, 2026
…g layer Two earlier commits (3ddb46b #13 + #26) added single-0x00 rollback gates at writeInterfaceFieldMarshal and writeLengthPrefixedField. Both operate on `anyLen`/`dataLen` at the INNER-BODY layer (bytes BEFORE the length prefix is added), but reflect's writeFieldIfNotEmpty rollback (binary_encode.go:592) operates at the OUTER-VALUE layer (post-prefix). Trace for Typ3ByteLength struct field with hypothetical 1-byte body [0x00]: Reflect: encodeReflectBinaryStruct → writeMaybeBare(content=[0x00], bare=false) → EncodeByteSlice → writes <0x01><0x00> = 2 bytes value. writeFieldIfNotEmpty:592 check: lAfterValue - lBeforeValue = 2, not 1 → NO ROLLBACK. Emits <key> 0x01 0x00 = 3 bytes wrapped. Generator post-#13/#26: dataLen = 1, buf[offset] = 0x00 → ROLLS BACK. Emits 0 bytes. DIVERGENCE. The pre-fix code (`if dataLen > 0`) matched reflect: it rolled back only when the inner body was empty (dataLen == 0), which corresponds to reflect's writeMaybeBare empty-contents branch writing a lone [0x00] length-byte that THEN triggers reflect's :592 rollback. Two independent subagent traces confirmed: reflect emits 3 bytes for this case; generator post-#13/#26 emits 0 bytes; pre-fix matched. The case is unreachable today (no MarshalBinary2 produces a 1-byte [0x00] body — writeReprMarshal rolls that back at the top level; MarshalAnyBinary2 always emits TypeURL ≥ 6 bytes), but the post-fix direction is wrong. Revert: - writeLengthPrefixedField: gate back to `if dataLen > 0`. - writeInterfaceFieldMarshal: drop the rollback wrapper. - Update tests to assert the correct (reverted) state with explanatory layer notes. Note: #20's writeByteLengthFieldWithRollback (String/[]byte/[N]byte) operates at the OUTER-VALUE layer because PrependString/ByteSlice write the whole `<uvarint-len><content>` block — `valueLen` there matches reflect's lAfterValue-lBeforeValue. Correct, kept as-is. Same for writeReprMarshal default branch (#16-style) and writeFieldValueMarshal default branch (#16): primitive emission, no length prefix, valueLen == primitive bytes — same layer as reflect's :592 for non-ByteLength typ3. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
aeddi
pushed a commit
that referenced
this pull request
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sketch of how realms could work, and a little info on Logos