frostfs-contract/nns/namestate.go
Evgenii Stratonikov b38d42baf3
All checks were successful
DCO action / DCO (pull_request) Successful in 25s
Code generation / Generate wrappers (pull_request) Successful in 52s
Tests / Tests (pull_request) Successful in 1m3s
[#165] nns: Ignore domain expirations
Domain expirations undeniably complicate reasoning about contract behaviour:
1. SOA record expire field has a bit of a different semantics
2. For our coredns backend we would like to receive everything we put, sudden domain expirations can make life harder.
3. This expiration depends on block time, which in turn may differ from the real timestamp.

Close #165.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-04-05 09:38:38 +03:00

26 lines
708 B
Go

package nns
import (
"github.com/nspcc-dev/neo-go/pkg/interop"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
)
// NameState represents domain name state.
type NameState struct {
Owner interop.Hash160
Name string
// Expiration field used to contain wall-clock time of a domain expiration.
// It is preserved for backwards compatibility, but is unused by the contract and should be ignored.
Expiration int64
Admin interop.Hash160
}
// checkAdmin panics if script container is not signed by the domain name admin.
func (n NameState) checkAdmin() {
if runtime.CheckWitness(n.Owner) {
return
}
if n.Admin == nil || !runtime.CheckWitness(n.Admin) {
panic("not witnessed by admin")
}
}