forked from TrueCloudLab/frostfs-contract
nns: migrate roots from the old version
Now root is just a TLD and needs to have SOA record. Set owner to committee and some default values for other parameters. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
d852229b74
commit
d8e42fcd16
1 changed files with 13 additions and 22 deletions
|
@ -90,33 +90,24 @@ func Update(nef []byte, manifest string) {
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data interface{}, isUpdate bool) {
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
it := storage.Find(ctx, []byte{prefixRecord}, storage.DeserializeValues)
|
committee := common.CommitteeAddress()
|
||||||
|
it := storage.Find(ctx, []byte{prefixRoot}, storage.KeysOnly|storage.RemovePrefix)
|
||||||
for iterator.Next(it) {
|
for iterator.Next(it) {
|
||||||
oldRec := iterator.Value(it).(struct {
|
name := iterator.Value(it).(string)
|
||||||
key string
|
ns := NameState{
|
||||||
rec RecordState
|
Owner: committee,
|
||||||
})
|
Name: name,
|
||||||
newRec := RecordState{
|
Expiration: runtime.GetTime() + millisecondsInYear,
|
||||||
Name: oldRec.rec.Name,
|
|
||||||
Type: oldRec.rec.Type,
|
|
||||||
Data: oldRec.rec.Data,
|
|
||||||
ID: 0,
|
|
||||||
}
|
}
|
||||||
newKey := append([]byte(oldRec.key), newRec.ID)
|
tokenKey := getTokenKey([]byte(name))
|
||||||
rec := std.Serialize(newRec)
|
putNameStateWithKey(ctx, tokenKey, ns)
|
||||||
storage.Put(ctx, newKey, rec)
|
putSoaRecord(ctx, name, "ops@nspcc.ru",
|
||||||
storage.Delete(ctx, oldRec.key)
|
3600 /* 1 hour */, 600, /* 10 min */
|
||||||
|
604800 /* 1 week */, 3600 /* 1 hour */)
|
||||||
}
|
}
|
||||||
|
|
||||||
maxExpire := 1<<31 - 1
|
|
||||||
domains := storage.Find(ctx, []byte{prefixName}, storage.ValuesOnly|storage.DeserializeValues)
|
|
||||||
for iterator.Next(domains) {
|
|
||||||
ns := iterator.Value(domains).(NameState)
|
|
||||||
putSoaRecord(ctx, ns.Name, "ops@nspcc.ru", 86400, 7200, maxExpire, 3600)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
storage.Put(ctx, []byte{prefixTotalSupply}, 0)
|
storage.Put(ctx, []byte{prefixTotalSupply}, 0)
|
||||||
storage.Put(ctx, []byte{prefixRegisterPrice}, defaultRegisterPrice)
|
storage.Put(ctx, []byte{prefixRegisterPrice}, defaultRegisterPrice)
|
||||||
|
|
Loading…
Reference in a new issue