Skip to content

Netmap contract update routine #11

Open
alexvanin opened this issue Mar 1, 2023 · 0 comments
Open

Netmap contract update routine #11

alexvanin opened this issue Mar 1, 2023 · 0 comments
Labels
discussion Talking about something in order to reach a decision or to exchange ideas

Comments

@alexvanin
Copy link

All FrostFS contracts aside netmap have simple update routine which is defined in if isUpdate branch of _deploy function.
Netmap contract have mandatory system config update and it requires specific arguments format for update function.

var args = data.(struct {
notaryDisabled bool
addrBalance interop.Hash160
addrContainer interop.Hash160
keys []interop.PublicKey
config [][]byte
version int
})
ln := len(args.config)
if ln%2 != 0 {
panic("bad configuration")
}
for i := 0; i < ln/2; i++ {
key := args.config[i*2]
val := args.config[i*2+1]
setConfig(ctx, key, val)
}

It looks to me as outdated code and it would be nice to have more flexibility in update arguments format for netmap contract. So my propose is to move if isUpdate branch before argument parsing and setConfig call.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion Talking about something in order to reach a decision or to exchange ideas
Projects
None yet
Development

No branches or pull requests

1 participant