Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NNS-contract Resolve return types #2900

Closed
masterSplinter01 opened this issue Feb 5, 2023 · 3 comments
Closed

NNS-contract Resolve return types #2900

masterSplinter01 opened this issue Feb 5, 2023 · 3 comments
Labels
question Further information is requested rpc RPC server and client

Comments

@masterSplinter01
Copy link

masterSplinter01 commented Feb 5, 2023

Method of nns-contract Resolve returns []string
https://github.com/nspcc-dev/neofs-contract/blob/master/nns/nns_contract.go#L444

// Resolve resolves given name (not more then three redirects are allowed).
func Resolve(name string, typ RecordType) []string {
	ctx := storage.GetReadOnlyContext()
	return resolve(ctx, nil, name, typ, 2)
}

Neo-go wrapper Resolve requires one string
https://github.com/nspcc-dev/neo-go/blob/master/pkg/rpcclient/nns/contract.go#L59

// Resolve resolves the given record type for the given domain (with no more
// than three redirects).
func (c *ContractReader) Resolve(name string, typ RecordType) (string, error) {
	return unwrap.UTF8String(c.invoker.Call(c.hash, "resolve", name, int64(typ)))
}

Comment to `unwrap.UTF8String(...)

// UTF8String expects correct execution (HALT state) with a single stack item
// returned. A string is extracted from this item and checked for UTF-8
// correctness, valid strings are then returned.

Is it sure it is valid?

@masterSplinter01 masterSplinter01 changed the title Non-consistent Resolve return types NNS-contract Resolve return types Feb 5, 2023
@roman-khimov roman-khimov added question Further information is requested rpc RPC server and client labels Feb 5, 2023
@roman-khimov
Copy link
Member

It's made to be compatible with the mainnet NNS: https://github.com/neo-project/non-native-contracts/blob/8d72b92e5e5705d763232bcc24784ced0fb8fc87/src/NameService/NameService.cs#L400

I don't think we can have NeoFS version of NNS right in the NeoGo, it'll have wrappers in neofs-contracts.

@AnnaShaleva
Copy link
Member

Actually, #2693, #2687 and nspcc-dev/neofs-contract#266 are about to change this and unify the NNS implementation through the neofs-contract and neo-go.

@roman-khimov
Copy link
Member

They solve a bit different problem. NeoGo must be compatible with the mainnet NNS.

@roman-khimov roman-khimov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested rpc RPC server and client
Projects
None yet
Development

No branches or pull requests

3 participants