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

z_auth_readonly_filetest.gno

2.02 Kb · 47 lines
 1// PKGPATH: gno.land/r/authreadonly
 2//
 3// Auth() exposes the realm's governance authority for rendering and
 4// inspection only. It returns a read-only string, never the live
 5// *authz.Authorizer.
 6//
 7// SCOPE. This asserts two things, one of which is now security-relevant:
 8//
 9//  1. Auth()'s RETURN TYPE — that the mutable handle is gone from the
10//     type system. This is what makes an
11//     Auth().Transfer(...) PoC stop compiling.
12//  2. The PROPOSER, since ContractAuthority.String() now renders it.
13//     Previously the string was byte-identical whether the authority was
14//     the gated default or a wide-open AutoAccept proposer, so reverting
15//     the fix left this file green. It no longer does.
16//
17// Reachability is still pinned elsewhere, not here:
18//   - p/moul/authz TestDefaultProposerIsContractOnly,
19//     TestExternalTransferRejected, TestExternalDoByPreviousRejected,
20//     TestContractPathIsolation,
21//     TestForeignFrameCannotDriveContractAuthority and
22//     TestContractAuthorityUnauthorizedCaller — the contract-identity
23//     gate. Reverting it fails those 6 plus TestAuthorityString,
24//     TestExplicitProposerReplacesIdentityGate,
25//     TestSpoofedProposerCannotImpersonateContractIdentity and
26//     filetests/z_contract_authority_shape_filetest.gno, since the
27//     rendered proposer is now part of what is pinned.
28//   - ./z_foreign_realm_capability_filetest.gno — the consumer-level
29//     one: a foreign realm cannot reach the privileged capability.
30//   - ./z_govdao_only_principal_filetest.gno — that the repointed
31//     authority names GovDAO and that the principal cannot be MINTED:
32//     it drives the forged-executor route and MustCreateProposal, and
33//     asserts both are refused.
34package authreadonly
35
36import (
37	"gno.land/r/gnops/valopers"
38)
39
40func main(cur realm) {
41	// An external realm observes a description; there is no mutator to
42	// reach from here.
43	println("authority:", valopers.Auth())
44}
45
46// Output:
47// authority: contract_authority[contract=gno.land/r/gov/dao,proposer=contract-identity]