feat(avm-server,air-interpreter,aquavm-air)!: secret key and particle ID arguments (#593)

* feat(avm-server)!: keypair and particle ID arguments

Add `&fluence_keypair::KeyPair` argument to `AVM::call` and
`AVMRunner::call`.  This value is further forwarded in a deconstructed
form to WASM Air interpreter, but is not used there yet. Also,
`AVMRunner::call` gets `particle_id: String` argument.

feat(air-interpreter)!: `invoke` methods have three new arguments:
`key_format: u8`, `secret_key_bytes: Vec<u8>` and `paritcle_id: String`.

feat(aquavm-air): `air::execute_air` has two three arguments:
`key_format: u8`, `secret_key_bytes: Vec<u8>` and `paritcle_id: String`.

feat(aquavm-air-cli)!: add `--random-key`/`--ed25519-key file` options to AIR CLI.

* feat(avm-server)!: Add `RunnerError::KeypairError`

* chore(bench): Add signature performance benchmarks

These benchmarks contain valid signature, so they should work with
verification out of the box.

---------

Co-authored-by: Artsiom Shamsutdzinau <shamsartem@gmail.com>
Co-authored-by: folex <0xdxdy@gmail.com>
This commit is contained in:
Ivan Boldyrev
2023-06-23 03:12:37 +07:00
committed by GitHub
parent 93c6899429
commit 8ce8af3823
73 changed files with 897 additions and 254 deletions

View File

@ -15,9 +15,11 @@
*/
use crate::test_runner::AirRunner;
use avm_server::avm_runner::*;
use avm_server::avm_runner::*;
use fluence_keypair::KeyPair;
use once_cell::sync::OnceCell;
use std::path::PathBuf;
// 10 Mb
@ -70,6 +72,8 @@ impl AirRunner for WasmAirRunner {
ttl: u32,
override_current_peer_id: Option<String>,
call_results: avm_server::CallResults,
keypair: &KeyPair,
particle_id: String,
) -> Result<RawAVMOutcome, Box<dyn std::error::Error>> {
let current_peer_id =
override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone());
@ -83,6 +87,8 @@ impl AirRunner for WasmAirRunner {
ttl,
current_peer_id,
call_results,
keypair,
particle_id,
)?)
}
}