PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/moul/agents/commit/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
moul / agents / commit
Files
4 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/moul/agents/commit/v0
gno
0.9

Files (4)

  • README.mdmarkdown
  • gnomod.tomltoml
  • commit.gnogno
  • commit_test.gnogno
commit_test.gnogno
1package commit23import (4	"testing"56	"gno.land/p/nt/uassert/v0"7)89func TestHashDeterministicAndPrefixed(t *testing.T) {10	uassert.Equal(t, Hash("a", "bc"), Hash("a", "bc"))11	// length-prefixing prevents boundary collisions12	uassert.NotEqual(t, Hash("ab", "c"), Hash("a", "bc"))13	uassert.Equal(t, 64, len(Hash("x"))) // sha256 hex is 64 chars14}1516func TestVerdictCommitReveal(t *testing.T) {17	c := Verdict(true, "salt-123")18	// reproducible from the revealed values19	uassert.Equal(t, c, Verdict(true, "salt-123"))20	// flipping the vote or the salt changes the commitment21	uassert.NotEqual(t, c, Verdict(false, "salt-123"))22	uassert.NotEqual(t, c, Verdict(true, "salt-999"))23}2425func TestShort(t *testing.T) {26	uassert.Equal(t, "abc", Short("abc"))27	uassert.True(t, len(Short(Hash("x"))) < 20)28}29

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.