z2_foreign_salt_filetest.gno
1.32 Kb · 38 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 // The hash is bound to the calling realm, so Mallory cannot claim
32 // Alice's place in the queue.
33 testing.SetRealm(testing.NewUserRealm(mallory))
34 rev1.Submit(cross(cur), id, "not-alices-salt")
35}
36
37// Error:
38// gauntlet: no pending commit matches this package path and salt