Skip to content

Commit 283af94

Browse files
committed
Read vss.proto from the local repository
We now read `vss.proto` from the local repository instead of downloading it from a specific commit on github. We will use protocol versioning, tags, and releases to coordinate clients and servers.
1 parent f3e1f7d commit 283af94

3 files changed

Lines changed: 4 additions & 19 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ log = { version = "0.4.29", default-features = false, features = ["std"]}
3535

3636
[target.'cfg(genproto)'.build-dependencies]
3737
prost-build = { version = "0.11.3" }
38-
bitreq = { version = "0.3", default-features = false, features = ["std", "https"] }
3938

4039
[dev-dependencies]
4140
mockito = "0.28.0"

build.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#[cfg(genproto)]
22
extern crate prost_build;
33
#[cfg(genproto)]
4-
use std::io::Write;
5-
#[cfg(genproto)]
6-
use std::{env, fs, fs::File, path::Path};
4+
use std::{env, fs, path::Path};
75

86
/// To generate updated proto objects:
97
/// 1. Place `vss.proto` file in `src/proto/`
@@ -15,21 +13,7 @@ fn main() {
1513

1614
#[cfg(genproto)]
1715
fn generate_protos() {
18-
download_file(
19-
"https://raw.githubusercontent.com/lightningdevkit/vss-server/022ee5e92debb60516438af0a369966495bfe595/proto/vss.proto",
20-
"src/proto/vss.proto",
21-
).unwrap();
22-
2316
prost_build::compile_protos(&["src/proto/vss.proto"], &["src/"]).unwrap();
2417
let from_path = Path::new(&env::var("OUT_DIR").unwrap()).join("vss.rs");
2518
fs::copy(from_path, "src/types.rs").unwrap();
2619
}
27-
28-
#[cfg(genproto)]
29-
fn download_file(url: &str, save_to: &str) -> Result<(), Box<dyn std::error::Error>> {
30-
let response = bitreq::get(url).send()?;
31-
fs::create_dir_all(Path::new(save_to).parent().unwrap())?;
32-
let mut out_file = File::create(save_to)?;
33-
out_file.write_all(&response.into_bytes())?;
34-
Ok(())
35-
}

src/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,16 @@ pub struct ListKeyVersionsRequest {
212212
#[allow(clippy::derive_partial_eq_without_eq)]
213213
#[derive(Clone, PartialEq, ::prost::Message)]
214214
pub struct ListKeyVersionsResponse {
215-
/// Fetched keys and versions.
215+
/// Fetched keys and versions, ordered by creation time (newest first).
216216
/// Even though this API reuses the `KeyValue` struct, the `value` sub-field will not be set by the server.
217217
#[prost(message, repeated, tag = "1")]
218218
pub key_versions: ::prost::alloc::vec::Vec<KeyValue>,
219219
/// `next_page_token` is a pagination token, used to retrieve the next page of results.
220220
/// Use this value to query for next-page of paginated `ListKeyVersions` operation, by specifying
221221
/// this value as the `page_token` in the next request.
222222
///
223+
/// Following AIP-158 (<https://google.aip.dev/158>):
224+
///
223225
/// If `next_page_token` is empty (""), then the "last page" of results has been processed and
224226
/// there is no more data to be retrieved.
225227
///

0 commit comments

Comments
 (0)