raiden-network / raiden-contracts

Raiden Network Smart Contracts
MIT License
53 stars 45 forks source link

`TokenNetworkRegistry` doesn't check if `_secret_registry_address` is a `SecretRegistry` smart contract. #1229

Open hackaugusto opened 5 years ago

hackaugusto commented 5 years ago

This is not strictly necessary, but it would be nice if the TokenNetworkRegistry would check that SecretRegistry is a valid smart contract. I believe this can be done by the smart contract registering its own hashed address as a secret, and then querying the registered block.

This will definitely make the deployment of a TokenNetworkRegistry more expensive, but since that operation is really done once, IMO it is not that big of problem.

pirapira commented 5 years ago

the smart contract registering its own hashed address as a secret, and then querying the registered block.

What do you mean? So SecretRegistry's constructor will register the hash of the address of itself?

pirapira commented 5 years ago

Assigned @hackaugusto because I'm expecting him to explain his idea.

hackaugusto commented 5 years ago

What do you mean? So SecretRegistry's constructor will register the hash of the address of itself?

The TokenNetworkRegistry constructor should validate that the address provided is a valid secret registry.

pirapira commented 5 years ago

I understand that. I still don't understand:

can be done by the smart contract registering its own hashed address as a secret, and then querying the registered block.

Especially, what registers the SecretRegistry and what queries the registered block.

hackaugusto commented 5 years ago

Especially, what registers the SecretRegistry and what queries the registered block.

That was just a suggestion, any random value that is not registered yet can be used.

pirapira commented 5 years ago

@hackaugusto suggests something like smoke-testing the SecretRegistry from either TokenNetworkRegistry or from TokenNetwork's constructor.