rchain icon indicating copy to clipboard operation
rchain copied to clipboard

Limit Authkey to "make" once only "check" once

Open zsluedem opened this issue 2 years ago • 3 comments

Overview

Currently the authkey made once in AuthKey.rho would generate a persistent consume so that people could keep reusing the authkey. This is not how we should use authkey.

https://github.com/rchain/rchain/blob/dev/casper/src/main/resources/AuthKey.rho#L52-L54

The goal of the authkey is only make once and use once and keep it not reusable

Impact

No impact.

Dependencies

No

Design

Just make persistent consume into single consume.

Resource estimation

2 days

zsluedem avatar Apr 22 '22 03:04 zsluedem

Based on the current MultiSigVault checking auth mechanism, the multiSigVault contract needs to check the auth serveral times in a loop which require the auth key could be used in serveral times.

https://github.com/rchain/rchain/blob/dev/casper/src/main/resources/MultiSigRevVault.rho#L98-L117

That makes the authkey not reusable difficult.

zsluedem avatar Apr 29 '22 08:04 zsluedem

Is this still something we want to implement? The path forward isn't clear to me since we're currently calling the "make" and "check" methods several times, as noted above.

Does it make sense to implement the AuthKey contract in a similar fashion to the registry? I.e. maintain a map of shape -> authKeys. In this case, we can at least enforce the invariant "each shape corresponds to at most one authKey".

Isaac-DeFrain avatar Aug 05 '22 22:08 Isaac-DeFrain

In case we need to call "check" several times we should instead provide "check" with the input list and call it only once. Second call to "check" should be considered an error because internal consume (with "challenge" method) should not be persistent which means it will be consumed by the first call.

https://github.com/rchain/rchain/blob/cd7d6cdd2c5e51d24002be8c2b2c35e4ff247f5d/casper/src/main/resources/AuthKey.rho#L55-L73

tgrospic avatar Aug 08 '22 08:08 tgrospic