Skip to content

Commit 444352f

Browse files
committed
review: PR 5946 posted (COMMENT, bot mode)
1 parent b71ec5a commit 444352f

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

reviews/pr/5xxx/5946-prediction-market-demo-realm/1-037a90410/comment_claude-opus-4-8.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Review: PR [#5946](https://github.com/gnolang/gno/pull/5946)
2+
Posted: https://github.com/gnolang/gno/pull/5946#pullrequestreview-4733431140
23
Event: COMMENT
34

45
## Body
@@ -14,7 +15,7 @@ Realms under `examples/` are [pre-deployed to gno.land testnets](https://github.
1415

1516
Full review: https://github.com/samouraiworld/gno-agent-workspace/blob/main/reviews/pr/5xxx/5946-prediction-market-demo-realm/1-037a90410/review_claude-opus-4-8_davd-gzl.md [](review_claude-opus-4-8_davd-gzl.md)
1617

17-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:74 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L74)
18+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:74 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L74) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613044977)
1819
Critical: [`avl.Tree.Get`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/p/nt/avl/v0/tree.gno#L58) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/p/nt/avl/v0/tree.gno#L58) returns a single value, so this assignment and the four others at lines [107](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L107) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L107), [121](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L121) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L121), [14](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L14) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L14) and [31](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L31) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L31) fail to typecheck. The four tests the description lists have never run, and [`ci / examples`](https://github.com/gnolang/gno/blob/037a90410/.github/workflows/ci-dir-examples.yml#L7-L10) · [↗](../../../../../.worktrees/gno-review-5946/.github/workflows/ci-dir-examples.yml#L7) will fail once it is released to run.
1920

2021
<details><summary>repro</summary>
@@ -36,7 +37,7 @@ FAIL: 0 build errors, 1 test errors
3637
```
3738
</details>
3839

39-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:143 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L143)
40+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:143 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L143) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613044980)
4041
Critical: `b.amount * totalPool` wraps `int64` before the division, so the payout goes negative and the [banker send](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L152) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L152) aborts. The limit is on the product, not on either amount, so 5,000,000,000 ugnot on each of two outcomes already crosses it and every bettor in that market is locked out for good. [`math/overflow`](https://github.com/gnolang/gno/blob/037a90410/gnovm/stdlibs/math/overflow/overflow_generated.gno#L583-L589) · [↗](../../../../../.worktrees/gno-review-5946/gnovm/stdlibs/math/overflow/overflow_generated.gno#L583) turns the wrap into a panic, as [`p/demo/tokens/grc20`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/p/demo/tokens/grc20/token.gno#L193-L194) · [↗](../../../../../.worktrees/gno-review-5946/examples/gno.land/p/demo/tokens/grc20/token.gno#L193) does.
4142

4243
<details><summary>repro</summary>
@@ -94,7 +95,7 @@ panic: invalid result: + -1068046444ugnot = -1068046444ugnot: non-positive coin
9495
```
9596
</details>
9697

97-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:130-133 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L130)
98+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:130-133 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L130) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613044989)
9899
Critical: when the declared outcome drew no bets, every claim panics here and the escrow stays in the realm for good. [`ResolveMarket`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L104-L106) · [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L104) accepts any outcome in 0..2 without checking that anyone backed it, so a draw between two bettors split across Home and Away hits this on the first try. A market the admin never resolves ends the same way.
99100

100101
<details><summary>repro</summary>
@@ -144,10 +145,10 @@ FAIL
144145
```
145146
</details>
146147

147-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:99-103 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L99)
148+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:99-103 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L99) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613044993)
148149
Nothing stops the admin from betting, then resolving their own outcome and taking the pot: [`PlaceBet`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L65-L72) · [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L65) admits the admin like any account, and there is no betting cutoff, oracle or dispute window. The package carries no doc comment saying a bettor is trusting the admin completely.
149150

150-
## examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno:53-62 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L53)
151+
## examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno:53-62 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket_test.gno#L53) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613044995)
151152
Missing test: nothing places a bet or completes a claim, so both the overflow and the empty-winning-pool lock reach the chain unchallenged. The admin gate is also vacuous under `gno test`, where `unsafe.OriginCaller()` and `cur.Previous().Address()` are both the empty address.
152153

153154
<details><summary>test cases</summary>
@@ -210,14 +211,14 @@ func TestClaimPayoutSmallStakeUnchanged(cur realm, t *testing.T) {
210211
```
211212
</details>
212213

213-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:155 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L155)
214+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:155 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L155) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613045002)
214215
Nit: `Render` ignores its `path` argument, so a single market page, a bettor's open positions and a claimable balance are all unreachable from the web view.
215216

216-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:61 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L61)
217+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:61 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L61) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613045006)
217218
Nit: the tree key is the decimal id and [`Iterate`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/p/nt/avl/v0/tree.gno#L89) · [](../../../../../.worktrees/gno-review-5946/examples/gno.land/p/nt/avl/v0/tree.gno#L89) walks keys as strings, so `Render` lists market 10 before market 2.
218219

219-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:44-47 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L44)
220+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:44-47 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L44) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613045012)
220221
Suggestion: `admin` is fixed at deploy with no transfer path, so a lost key leaves every open market unresolvable and its escrow stranded. [`p/nt/ownable/v0`](https://github.com/gnolang/gno/blob/037a90410/examples/gno.land/p/nt/ownable/v0/ownable.gno#L1) · [](../../../../../.worktrees/gno-review-5946/examples/gno.land/p/nt/ownable/v0/ownable.gno#L1) is the usual shape in `examples/`.
221222

222-
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:70-72 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L70)
223+
## examples/gno.land/r/demo/predictionmarket/predictionmarket.gno:70-72 [](../../../../../.worktrees/gno-review-5946/examples/gno.land/r/demo/predictionmarket/predictionmarket.gno#L70) [posted](https://github.com/gnolang/gno/pull/5946#discussion_r3613045017)
223224
Suggestion: the accepted outcomes are hardcoded here, so a market cannot declare itself binary and a bettor can stake on Draw in a contest that cannot draw.

0 commit comments

Comments
 (0)