Skip to content

Commit

Permalink
Still use Ed25519 for PublicKey (MystenLabs/narwhal#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqvq authored Sep 13, 2022
1 parent e962cac commit 69adc36
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 48 deletions.
16 changes: 8 additions & 8 deletions narwhal/config/tests/snapshots/config_tests__committee.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ expression: committee
---
{
"authorities": {
"i9DpjC/kZbDd57csSg7qWFMF3uTECO2jBD3M5BOXU8T7AebTrMO+9D5IbnUI8N7lFhmjEiKFhwUOlFGbx1jkdP212PR/XvnayHxDaJuMkytxACBnshi9TrbZiZP10tqL": {
"6j/Odu4Qs6ZF+zBAUR36tMnNYFj0GSkBTRZGb147LCo=": {
"stake": 1,
"primary_address": "/ip4/127.0.0.1/tcp/0/http",
"network_key": "+oKq7VFT0pAQvjlvEti2YUw5fHXEYT/bs21P9wTlAKs="
"network_key": "r7SQXpVQz0YqggB4JKBV2XWuk0RwxHfZ3bttKyZMNvo="
},
"jGbcLB6p5T8JhcF7TnrxmRK208QODFkgpaElCbTrNhn14H7Fbqd/CzBim6HMctdbE5RgeCpfDi+J+0xCtLil+uPSYBAiIOY9B1Tn4YRt7v05iOreTtN/E4VDfRneGhYY": {
"VayIYzPsiroVrY4eilEUVKCM/LfNcMWN2ELKoHCNGr8=": {
"stake": 1,
"primary_address": "/ip4/127.0.0.1/tcp/0/http",
"network_key": "rvP0pLjsod/DQzYb+OQ2vULeklnAS4MU644gVN1ugqs="
"network_key": "Kt9mRluFkBunwfq2VREQbBXuSYGOsFo95bA/PIrvVhc="
},
"ld89LijKV9Ra6U/hkj6PnWKgcDbW4IgHAy1sHOLjHNvxLDoMQYJhDA5yb3+rOIfRBm91BOK0aSlGEtfdAZOB5af1kfxciSrnzDAHDKw1eCMo92nMEHWj5bpJbSlnySf7": {
"ucbuFjDvPnERRKZI2wa7sihPcnTPvuU//O5QPMGkkgA=": {
"stake": 1,
"primary_address": "/ip4/127.0.0.1/tcp/0/http",
"network_key": "r7SQXpVQz0YqggB4JKBV2XWuk0RwxHfZ3bttKyZMNvo="
"network_key": "rvP0pLjsod/DQzYb+OQ2vULeklnAS4MU644gVN1ugqs="
},
"teRXk6Iq1Pod0UgOcrvBrvVvs8ZpM0bUgbZNL7YpH4n06TvGuiaId9SfpuYe+JOOF4rXiNzQv7CW6npbn3SVZMv9NzwYJcz5RL6F3gAMpNx+o9YM5+gqNtn/OGArUTCC": {
"vVDfe4JyrKvldWAMAgdqeUvACFqw15e4PUoj4ByOfCQ=": {
"stake": 1,
"primary_address": "/ip4/127.0.0.1/tcp/0/http",
"network_key": "Kt9mRluFkBunwfq2VREQbBXuSYGOsFo95bA/PIrvVhc="
"network_key": "+oKq7VFT0pAQvjlvEti2YUw5fHXEYT/bs21P9wTlAKs="
}
},
"epoch": 0
Expand Down
40 changes: 20 additions & 20 deletions narwhal/config/tests/snapshots/config_tests__worker_cache.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,105 +4,105 @@ expression: worker_cache
---
{
"workers": {
"i9DpjC/kZbDd57csSg7qWFMF3uTECO2jBD3M5BOXU8T7AebTrMO+9D5IbnUI8N7lFhmjEiKFhwUOlFGbx1jkdP212PR/XvnayHxDaJuMkytxACBnshi9TrbZiZP10tqL": {
"6j/Odu4Qs6ZF+zBAUR36tMnNYFj0GSkBTRZGb147LCo=": {
"0": {
"name": "FsiKyAGnhMcChNBf+L2B8EHX6mMup8oqJ8bK/9ZRkww=",
"name": "l+fthD+rGkLOnCEpQ1IewioCVodHzAA7iB+9J/cL3+A=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"1": {
"name": "O6EMZUvkFG2rPW2rgLPOJM4323x0XCslMgXWL5Z7ALM=",
"name": "XEf+9+MRPcAcVu9NR3v+UVevwzlpoBT4u1U34YzOxkw=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"2": {
"name": "dt4/oHrYlTWhdms3mHV8irOu9b6H3uFunhBt2LUJcp4=",
"name": "gznZnDM7s6J3/reAuNRsrDDNzZBQ2+I1+4zGe5HBsGo=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"3": {
"name": "lrisYqEadH5cgLhsT1EW5q6uVKxwCXLTJQO3klahUy8=",
"name": "hkGX9Mxcq2yO3Ut5xIXvuaVVcYt1tgPi6LmPVewN4mc=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
}
},
"jGbcLB6p5T8JhcF7TnrxmRK208QODFkgpaElCbTrNhn14H7Fbqd/CzBim6HMctdbE5RgeCpfDi+J+0xCtLil+uPSYBAiIOY9B1Tn4YRt7v05iOreTtN/E4VDfRneGhYY": {
"VayIYzPsiroVrY4eilEUVKCM/LfNcMWN2ELKoHCNGr8=": {
"0": {
"name": "ildi4hrBzbOHBELHe0w69Yx87bh3nQJw5tTx4vc2fXQ=",
"name": "km6ruihMw/GYnXOSgpykDtZbqz7YGGOpats+az3/X6Q=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"1": {
"name": "zGIzLjS7LVzWn2Dvuyo2y5FsfrRYMB6jZjbE27ASvYg=",
"name": "fBEBLo4XV9uxBFd2fOjqDAkLzwJJ4sBIDtEayytwO7A=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"2": {
"name": "I47bbumpH9yOcb5QwKP7PPKS2QJN26wCqqcJCWsKqdo=",
"name": "i4VvPsULQhSm++R+hpszac5EOLnJbh02NAMScP/4+L0=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"3": {
"name": "nUdhahjfIDkwfwZCImAliLUqaq6qe2/oxrTZ66inh7E=",
"name": "cseVuRrgvo0/Q0aJ5r9HHKQyf/El+gF4mpmrxVtCgOY=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
}
},
"ld89LijKV9Ra6U/hkj6PnWKgcDbW4IgHAy1sHOLjHNvxLDoMQYJhDA5yb3+rOIfRBm91BOK0aSlGEtfdAZOB5af1kfxciSrnzDAHDKw1eCMo92nMEHWj5bpJbSlnySf7": {
"ucbuFjDvPnERRKZI2wa7sihPcnTPvuU//O5QPMGkkgA=": {
"0": {
"name": "l+fthD+rGkLOnCEpQ1IewioCVodHzAA7iB+9J/cL3+A=",
"name": "ildi4hrBzbOHBELHe0w69Yx87bh3nQJw5tTx4vc2fXQ=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"1": {
"name": "XEf+9+MRPcAcVu9NR3v+UVevwzlpoBT4u1U34YzOxkw=",
"name": "zGIzLjS7LVzWn2Dvuyo2y5FsfrRYMB6jZjbE27ASvYg=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"2": {
"name": "gznZnDM7s6J3/reAuNRsrDDNzZBQ2+I1+4zGe5HBsGo=",
"name": "I47bbumpH9yOcb5QwKP7PPKS2QJN26wCqqcJCWsKqdo=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"3": {
"name": "hkGX9Mxcq2yO3Ut5xIXvuaVVcYt1tgPi6LmPVewN4mc=",
"name": "nUdhahjfIDkwfwZCImAliLUqaq6qe2/oxrTZ66inh7E=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
}
},
"teRXk6Iq1Pod0UgOcrvBrvVvs8ZpM0bUgbZNL7YpH4n06TvGuiaId9SfpuYe+JOOF4rXiNzQv7CW6npbn3SVZMv9NzwYJcz5RL6F3gAMpNx+o9YM5+gqNtn/OGArUTCC": {
"vVDfe4JyrKvldWAMAgdqeUvACFqw15e4PUoj4ByOfCQ=": {
"0": {
"name": "km6ruihMw/GYnXOSgpykDtZbqz7YGGOpats+az3/X6Q=",
"name": "FsiKyAGnhMcChNBf+L2B8EHX6mMup8oqJ8bK/9ZRkww=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"1": {
"name": "fBEBLo4XV9uxBFd2fOjqDAkLzwJJ4sBIDtEayytwO7A=",
"name": "O6EMZUvkFG2rPW2rgLPOJM4323x0XCslMgXWL5Z7ALM=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"2": {
"name": "i4VvPsULQhSm++R+hpszac5EOLnJbh02NAMScP/4+L0=",
"name": "dt4/oHrYlTWhdms3mHV8irOu9b6H3uFunhBt2LUJcp4=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
},
"3": {
"name": "cseVuRrgvo0/Q0aJ5r9HHKQyf/El+gF4mpmrxVtCgOY=",
"name": "lrisYqEadH5cgLhsT1EW5q6uVKxwCXLTJQO3klahUy8=",
"transactions": "/ip4/127.0.0.1/tcp/0/http",
"worker_to_worker": "/ip4/127.0.0.1/tcp/0/http",
"primary_to_worker": "/ip4/127.0.0.1/tcp/0/http"
Expand Down
14 changes: 6 additions & 8 deletions narwhal/crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
rust_2021_compatibility
)]

use fastcrypto::{bls12381, ed25519};
use fastcrypto::ed25519;

// This re-export allows using the trait-defined APIs
pub use fastcrypto::traits;
Expand All @@ -25,13 +25,11 @@ pub use fastcrypto::traits;
// Beware: if you change those aliases to point to another scheme implementation, you will have
// to change all four aliases to point to concrete types that work with each other. Failure to do
// so will result in a ton of compilation errors, and worse: it will not make sense!

pub type PublicKey = bls12381::BLS12381PublicKey;
pub type Signature = bls12381::BLS12381Signature;
pub type AggregateSignature = bls12381::BLS12381AggregateSignature;
pub type PrivateKey = bls12381::BLS12381PrivateKey;
pub type KeyPair = bls12381::BLS12381KeyPair;

pub type PublicKey = ed25519::Ed25519PublicKey;
pub type Signature = ed25519::Ed25519Signature;
pub type AggregateSignature = ed25519::Ed25519AggregateSignature;
pub type PrivateKey = ed25519::Ed25519PrivateKey;
pub type KeyPair = ed25519::Ed25519KeyPair;
// Example to use BLS12-377 instead:
// #[cfg(feature = "celo")]
// pub type PublicKey = bls12377::BLS12377PublicKey;
Expand Down
25 changes: 13 additions & 12 deletions narwhal/node/tests/staged/narwhal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ Authority:
- primary_address: BYTES
- network_key:
TYPENAME: Ed25519PublicKey
BLS12381AggregateSignature:
STRUCT:
- sig:
OPTION: BYTES
BLS12381Signature:
STRUCT:
- sig: BYTES
Batch:
NEWTYPESTRUCT:
SEQ:
Expand All @@ -26,7 +19,7 @@ Certificate:
- header:
TYPENAME: Header
- aggregated_signature:
TYPENAME: BLS12381AggregateSignature
TYPENAME: Ed25519AggregateSignature
- signed_authorities: BYTES
CertificateDigest:
NEWTYPESTRUCT:
Expand All @@ -37,15 +30,23 @@ Committee:
STRUCT:
- authorities:
MAP:
KEY: STR
KEY:
TYPENAME: Ed25519PublicKey
VALUE:
TYPENAME: Authority
- epoch: U64
Ed25519AggregateSignature:
NEWTYPESTRUCT:
SEQ: BYTES
Ed25519PublicKey:
NEWTYPESTRUCT: STR
Ed25519Signature:
STRUCT:
- raw: BYTES
Header:
STRUCT:
- author: STR
- author:
TYPENAME: Ed25519PublicKey
- round: U64
- epoch: U64
- payload:
Expand All @@ -59,7 +60,7 @@ Header:
- id:
TYPENAME: HeaderDigest
- signature:
TYPENAME: BLS12381Signature
TYPENAME: Ed25519Signature
HeaderDigest:
NEWTYPESTRUCT:
TUPLEARRAY:
Expand All @@ -72,7 +73,7 @@ PrimaryWorkerMessage:
TUPLE:
- SEQ:
TYPENAME: BatchDigest
- STR
- TYPENAME: Ed25519PublicKey
1:
Cleanup:
NEWTYPE: U64
Expand Down

0 comments on commit 69adc36

Please sign in to comment.