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

Upgrade ed25519_dalek 1.0.1 -> 2.0.0 #1475

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ async-trait = { workspace = true }
clap = { workspace = true, features = ["derive"] }
criterion = { version = "0.5", features = ["html_reports", "async", "async_tokio"] }
ctrlc = "3.2.3"
ed25519-dalek = "1.0" # TODO: upgrade to 2.0 when it's released, and remove rand below
ed25519-dalek_old_rand = { package = "rand", version = "0.7.3" }
ed25519-dalek = { version = "2.0", features = ["rand_core"] }
ethnum = "1.3"
fuel-core = { path = "../crates/fuel-core", default-features = false, features = ["rocksdb-production"] }
fuel-core-services = { path = "./../crates/services" }
Expand Down
24 changes: 14 additions & 10 deletions benches/benches/block_target_gas_set/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ pub fn run_crypto(group: &mut BenchmarkGroup<WallTime>) {
);

let message = fuel_core_types::fuel_crypto::Message::new(b"foo");
let ed19_keypair =
ed25519_dalek::Keypair::generate(&mut ed25519_dalek_old_rand::rngs::OsRng {});
let ed19_signature = ed19_keypair.sign(&*message);
let ed19_secret = ed25519_dalek::SigningKey::generate(&mut rand::rngs::OsRng {});
let ed19_signature = ed19_secret.sign(&*message);

run(
"crypto/ed19 opcode",
Expand All @@ -110,12 +109,17 @@ pub fn run_crypto(group: &mut BenchmarkGroup<WallTime>) {
op::addi(
0x21,
0x20,
ed19_keypair.public.as_ref().len().try_into().unwrap(),
ed19_secret
.verifying_key()
.as_ref()
.len()
.try_into()
.unwrap(),
),
op::addi(
0x22,
0x21,
ed19_signature.as_ref().len().try_into().unwrap(),
ed19_signature.to_bytes().len().try_into().unwrap(),
),
op::addi(0x22, 0x21, message.as_ref().len().try_into().unwrap()),
op::movi(0x10, ed25519_dalek::PUBLIC_KEY_LENGTH.try_into().unwrap()),
Expand All @@ -125,13 +129,13 @@ pub fn run_crypto(group: &mut BenchmarkGroup<WallTime>) {
op::jmpb(RegId::ZERO, 0),
]
.to_vec(),
ed19_keypair
.public
.as_ref()
ed19_secret
.verifying_key()
.to_bytes()
.iter()
.chain(ed19_signature.as_ref())
.chain(message.as_ref())
.copied()
.chain(ed19_signature.to_bytes())
.chain(message.as_ref().iter().copied())
.collect(),
);

Expand Down
18 changes: 11 additions & 7 deletions benches/benches/vm_set/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ pub fn run(c: &mut Criterion) {
}
bench_s256.finish();

let ed19_keypair =
ed25519_dalek::Keypair::generate(&mut ed25519_dalek_old_rand::rngs::OsRng {});
let ed19_signature = ed19_keypair.sign(&*message);
let ed19_secret = ed25519_dalek::SigningKey::generate(&mut rand::rngs::OsRng {});
let ed19_signature = ed19_secret.sign(&*message);

run_group_ref(
&mut c.benchmark_group("ed19"),
Expand All @@ -114,17 +113,22 @@ pub fn run(c: &mut Criterion) {
op::addi(
0x21,
0x20,
ed19_keypair.public.as_ref().len().try_into().unwrap(),
ed19_secret
.verifying_key()
.as_bytes()
.len()
.try_into()
.unwrap(),
),
op::addi(
0x22,
0x21,
ed19_signature.as_ref().len().try_into().unwrap(),
ed19_signature.to_bytes().len().try_into().unwrap(),
),
])
.with_data(
ed19_keypair
.public
ed19_secret
.verifying_key()
.to_bytes()
.iter()
.chain(ed19_signature.to_bytes().iter())
Expand Down
Loading