feat(covenant): add covenant rules constants
This commit is contained in:
parent
797267d27c
commit
e2f112b0cd
2 changed files with 56 additions and 0 deletions
|
|
@ -15,6 +15,32 @@ func TestNameSizeLimits(t *testing.T) {
|
|||
if MaxResourceSize != 512 {
|
||||
t.Fatalf("MaxResourceSize = %d, want 512", MaxResourceSize)
|
||||
}
|
||||
|
||||
if MaxCovenantSize != 585 {
|
||||
t.Fatalf("MaxCovenantSize = %d, want 585", MaxCovenantSize)
|
||||
}
|
||||
|
||||
if CovenantMaxSize != MaxCovenantSize {
|
||||
t.Fatalf("CovenantMaxSize = %d, want %d", CovenantMaxSize, MaxCovenantSize)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNameFlags(t *testing.T) {
|
||||
if VerifyCovenantsNone != 0 {
|
||||
t.Fatalf("VerifyCovenantsNone = %d, want 0", VerifyCovenantsNone)
|
||||
}
|
||||
|
||||
if VerifyCovenantsHardened != 1<<0 {
|
||||
t.Fatalf("VerifyCovenantsHardened = %d, want %d", VerifyCovenantsHardened, 1<<0)
|
||||
}
|
||||
|
||||
if VerifyCovenantsLockup != 1<<1 {
|
||||
t.Fatalf("VerifyCovenantsLockup = %d, want %d", VerifyCovenantsLockup, 1<<1)
|
||||
}
|
||||
|
||||
if MandatoryVerifyCovenantFlags != VerifyCovenantsNone {
|
||||
t.Fatalf("MandatoryVerifyCovenantFlags = %d, want %d", MandatoryVerifyCovenantFlags, VerifyCovenantsNone)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVerifyString(t *testing.T) {
|
||||
|
|
|
|||
30
pkg/covenant/rules.go
Normal file
30
pkg/covenant/rules.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
package covenant
|
||||
|
||||
// NameFlags mirrors the covenant verification flags used by the JS reference
|
||||
// rules module.
|
||||
type NameFlags uint8
|
||||
|
||||
const (
|
||||
// VerifyCovenantsNone disables covenant verification flags.
|
||||
VerifyCovenantsNone NameFlags = 0
|
||||
|
||||
// VerifyCovenantsHardened is enabled when the covenant hardening soft fork
|
||||
// activates.
|
||||
VerifyCovenantsHardened NameFlags = 1 << 0
|
||||
|
||||
// VerifyCovenantsLockup is enabled when the ICANN lockup soft fork
|
||||
// activates.
|
||||
VerifyCovenantsLockup NameFlags = 1 << 1
|
||||
|
||||
// MandatoryVerifyCovenantFlags is the default covenant verification mask.
|
||||
MandatoryVerifyCovenantFlags NameFlags = VerifyCovenantsNone
|
||||
|
||||
// MaxCovenantSize is the maximum serialized covenant size mirrored from the
|
||||
// JS rules reference.
|
||||
MaxCovenantSize = 1 + 32 + 1 + 4 + 2 + MaxResourceSize + 1 + 32
|
||||
|
||||
// CovenantMaxSize is an alias for MaxCovenantSize.
|
||||
CovenantMaxSize = MaxCovenantSize
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue