-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add a public key field to the Participant struct #77
Add a public key field to the Participant struct #77
Conversation
I'm curious what's compelling us to put ferveo public keys onchain specifically? As of |
We also need to make this information ( It feels somewhat redundant, but it should have the same availability guarantees as I'm interested to see whether an alternative design is possible. |
The ability to verify without having to learn about the network is advantageous. Learning is a very involved process. A web-based Bob would be able to verify without needing to learn. @KPrasch it would also save us (on the Python-side) from needing Ursula objects for this code: https://github.com/nucypher/nucypher/blob/development/nucypher/characters/lawful.py#L696 |
Notes from a discussion on Discord voice:
|
Another consideration here is if we want to derive new keys for each participant+ritual. Otherwise, if nodes only have one long-term ferveo keypair, there's no sense it writing it to the Participant struct. |
030b339
to
74f6e5e
Compare
In that case, mapping could be better (updated). |
b0e7999
to
9bf8022
Compare
9bf8022
to
48d5794
Compare
I just need 2 approvals so I'm going to ahead and merge if that sounds ok |
f4ab924
to
d38ed40
Compare
d38ed40
to
01dea58
Compare
@@ -30,6 +30,8 @@ contract Coordinator is AccessControlDefaultAdminRules { | |||
event TimeoutChanged(uint32 oldTimeout, uint32 newTimeout); | |||
event MaxDkgSizeChanged(uint16 oldSize, uint16 newSize); | |||
|
|||
event ParticipantPublicKeySet(address indexed participant, BLS12381.G1Point publicKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a G2 point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
@@ -61,10 +63,17 @@ contract Coordinator is AccessControlDefaultAdminRules { | |||
Participant[] participant; | |||
} | |||
|
|||
struct ParticipantKey { | |||
uint32 ritualId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this more like fromRitualId
or ... something similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
ParticipantKey memory newRecord = ParticipantKey(lastRitualId, _publicKey); | ||
keysHistory[provider].push(newRecord); | ||
|
||
emit ParticipantPublicKeySet(provider, _publicKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it beneficial to include the ("startiing from") ritual id in the event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could simplify filtering
✔️
emit ParticipantPublicKeySet(provider, _publicKey); | ||
} | ||
|
||
function getProviderPublicKey(address _address, uint _ritualId) public view returns (BLS12381.G1Point memory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this function is not called by the other functions in the contract i.e. only called from an external entitiy, I believe using external
instead saves a copy step of arguments.
Also, let's call the parameter _provider
.
function getProviderPublicKey(address _address, uint _ritualId) public view returns (BLS12381.G1Point memory) { | |
function getProviderPublicKey(address _provider, uint _ritualId) external view returns (BLS12381.G1Point memory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
tests/test_coordinator.py
Outdated
@@ -130,10 +143,22 @@ def test_initiate_ritual(coordinator, nodes, initiator, erc20, flat_rate_fee_mod | |||
assert coordinator.getRitualState(0) == RitualState.AWAITING_TRANSCRIPTS | |||
|
|||
|
|||
def test_test_provider_public_key(coordinator, nodes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?:
def test_test_provider_public_key(coordinator, nodes): | |
def test_provider_public_key(coordinator, nodes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👨🏻🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @piotr-roslaniec. An additional idea from a discussion with @KPrasch: what a about adding the ritual public key as part of the post transcript TX?
- Piggy-backing from the post transcript TX simplifies things, maybe we can make it an optional parameter in case the the node needs to set the key. Less TXs means simpler client code, less problems.
- Prepares API for when/if Ferveo keys are generated per-ritual.
- Code definitely would look uglier, but I think this is bearable considering Coordinator is for the private beta release.
If this sounds good, we can do this in a separate PR, no need to do it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎸
Documented possible extension in: #95 |
I don't follow. |
FerveoPublicKey
bytesCoordinator
contract taco-web#234FerveoPublicKey
inCoordinator
contract nucypher#3167