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.

gauntlet source realm

Package gauntlet is a bounty board where the chain grades the answers.

Overview

Package gauntlet is a bounty board where the chain grades the answers.

Post a coding challenge with a GNOT reward. Solvers commit a hash, deploy a realm with a Solve function, and reveal it. This realm runs the tests itself and pays the earliest commit that passes. No reviewer, no disputes.

Functions 15

func Boost

crossing Action
1func Boost(cur realm, id uint64)
source

Boost adds the ugnot sent with the call to an open challenge's reward.

func Commit

crossing Action
1func Commit(cur realm, id uint64, hash string)
source

Commit reserves your place in line with sha256(solutionPath + ":" + salt). Send the challenge's bond with the call. Use HashFor to compute the hash.

func HashFor

Action
1func HashFor(pkgPath, salt string) string
source

HashFor computes the commit hash for a solution realm path and a salt. Keep the salt secret until you reveal.

func ListJSON

Action
1func ListJSON(offset, limit int) string
source

ListJSON returns up to limit challenges, newest first, skipping offset.

func Post

crossing Action
1func Post(cur realm, title, spec, cases string, hours int, bond int64, windowMinutes int) uint64
source

Post creates a challenge with fixed test cases. Send the reward in ugnot with the call. cases has one test per line: `input => expected output`.

func PostJudged

crossing Action
1func PostJudged(cur realm, title, spec, judgePath, cases string, hours int, bond int64, windowMinutes int) uint64
source

PostJudged creates a challenge graded by a registered judge (see RegisterJudge), plus optional fixed cases. Send the reward with the call.

func RegisterJudge

crossing Action
1func RegisterJudge(cur realm, name, about string, inputs func(seed uint64) []string, check func(in, out string) bool)
source

RegisterJudge is called by a judge realm, usually from its init. The judge is stored under the caller's package path and can never change, so every bounty that uses it is graded by exactly the code anyone can read.

func Render

1func Render(path string) string
source

Render serves the board in gnoweb.

Example
1""             open bounties and recent winners
2"c/<id>"       one challenge: spec, tests, queue, result
3"u/<address>"  a solver's or poster's profile
4"leaderboard"  top earners
5"judges"       registered judges
6"solve"        how to submit a solution

func Reveal

crossing Action
1func Reveal(cur realm, id uint64, salt string, solve func(string) string)
source

Reveal is called by your solution realm, never by a wallet directly:

Example
1func Submit(cur realm, id uint64, salt string) {
2	gauntlet.Reveal(cross(cur), id, salt, Solve)
3}

The realm path of the caller is read from the runtime, so nobody can reveal on behalf of a commit they do not own. The tests run here, on-chain.

func Settle

crossing Action
1func Settle(cur realm, id uint64)
source

Settle expires late commits and pays out when the result is final. Anyone can call it.

Types 3

type JudgeInfo

struct
1type JudgeInfo struct {
2	Path  string
3	Name  string
4	About string
5	Judge *gauntlet.Judge
6	Uses  int
7}
source

JudgeInfo is a registered judge: reusable, immutable test logic.

type PaidRecord

struct
1type PaidRecord struct {
2	ChallengeID uint64
3	To          address
4	Amount      int64
5	At          time.Time
6}
source

PaidRecord is one winner payout, for the activity feed.

type Profile

struct
1type Profile struct {
2	Addr     address
3	Attempts int
4	Solved   int
5	Earned   int64
6	Posted   int
7	Funded   int64
8}
source

Profile tracks what an address has done on the board.

Dependencies

Source Files 15