Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

z2_duplicate_hash_filetest.gno

1.19 Kb · 36 lines
 1// PKGPATH: gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/main
 2package main
 3
 4import (
 5	"chain"
 6	"testing"
 7
 8	"gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/gauntlet"
 9	_ "gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/solvers/rev1"
10)
11
12func main(cur realm) {
13	poster := address("g1q646ctzhvn60v392yy4ldq5zyr8q5hnxee3zqe")
14	alice := address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")
15	mallory := address("g1dmt3sa5ucvecxuhf3j6ne5r0e3z4x7h6c03xc0")
16	boardAddr := chain.PackageAddress("gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/gauntlet")
17	_, _ = alice, mallory
18
19	coins := chain.Coins{{Denom: "ugnot", Amount: 1_000_000}}
20	testing.IssueCoins(boardAddr, coins)
21	testing.SetOriginSend(coins)
22	testing.SetRealm(testing.NewUserRealm(poster))
23	id := gauntlet.Post(cross(cur), "Reverse", "", "abc => cba", 6, 0, 30)
24
25	testing.SetOriginSend(chain.Coins{})
26	testing.SetRealm(testing.NewUserRealm(alice))
27	hash := gauntlet.HashFor("gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/solvers/rev1", "alice-salt")
28	gauntlet.Commit(cross(cur), id, hash)
29	_ = hash
30
31	testing.SetRealm(testing.NewUserRealm(mallory))
32	gauntlet.Commit(cross(cur), id, hash)
33}
34
35// Error:
36// gauntlet: this hash was already committed