Skip to content

Commit 5557e18

Browse files
authored
feat(avalanche-types): bump up rpcchainvm protocol version to 32 (#157)
* feat(avalanche-types): bump up rpcchainvm protocol version to 33 ref. https://github.com/ava-labs/avalanchego/blob/v1.11.0/version/constants.go Signed-off-by: Gyuho Lee <[email protected]> * 32 Signed-off-by: Gyuho Lee <[email protected]> * remove version Signed-off-by: Gyuho Lee <[email protected]> * make it compile Signed-off-by: Gyuho Lee <[email protected]> * fix lint Signed-off-by: Gyuho Lee <[email protected]> * more updates Signed-off-by: Gyuho Lee <[email protected]> * remove unused Signed-off-by: Gyuho Lee <[email protected]> * remove unused Signed-off-by: Gyuho Lee <[email protected]> * bump up to 33 Signed-off-by: Gyuho Lee <[email protected]> * comment out subnet feature Signed-off-by: Gyuho Lee <[email protected]> --------- Signed-off-by: Gyuho Lee <[email protected]>
1 parent 77dfb10 commit 5557e18

File tree

22 files changed

+4194
-3787
lines changed

22 files changed

+4194
-3787
lines changed

core/network/examples/peer_outbound_ping.rs

+2-23
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use std::{
2-
array,
32
env::args,
43
io,
54
net::{IpAddr, SocketAddr},
65
str::FromStr,
7-
time::{Duration, SystemTime},
6+
time::Duration,
87
};
98

10-
use avalanche_types::{ids::Id, message};
9+
use avalanche_types::message;
1110
use network::peer::outbound;
1211

1312
/// cargo run --example peer_outbound_ping -- [PEER IP] [STAKING PORT]
@@ -38,26 +37,6 @@ fn main() -> io::Result<()> {
3837
let mut stream = connector.connect(addr, Duration::from_secs(10))?;
3938
log::info!("peer certificate:\n\n{}", stream.peer_certificate_pem);
4039

41-
log::info!("sending version...");
42-
let now = SystemTime::now();
43-
let now_unix = now
44-
.duration_since(SystemTime::UNIX_EPOCH)
45-
.expect("unexpected None duration_since")
46-
.as_secs();
47-
let tracked_subnets: [Id; 5] =
48-
array::from_fn(|_| Id::from_slice(&random_manager::secure_bytes(32).unwrap()));
49-
50-
let msg = message::version::Message::default()
51-
.network_id(1000000)
52-
.my_time(now_unix)
53-
.ip_addr(addr.ip())
54-
.ip_port(0)
55-
.my_version("avalanche/1.2.3".to_string())
56-
.sig(random_manager::secure_bytes(64).unwrap())
57-
.tracked_subnets(tracked_subnets);
58-
let msg = msg.serialize().expect("failed serialize");
59-
stream.write(&msg)?;
60-
6140
log::info!("sending ping...");
6241
let ping_msg = message::ping::Message::default();
6342
let ping_msg_bytes = ping_msg.serialize()?;

crates/avalanche-types/scripts/protobuf_codegen.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
# protocol version is the version of the gRPC proto definitions
77
# as defined by the avalanchego rpcchainvm.
8-
# ref. https://github.com/ava-labs/avalanchego/blob/v1.9.11/version/constants.go#L15-L17
9-
PROTOCOL_VERSION='29'
8+
# ref. https://github.com/ava-labs/avalanchego/blob/v1.11.0/version/constants.go
9+
PROTOCOL_VERSION='33'
1010

1111
if ! [[ "$0" =~ scripts/protobuf_codegen.sh ]]; then
1212
echo "must be run from repository root"
@@ -29,9 +29,9 @@ fi
2929
# protoc plugin "protoc-gen-prost-crate" is required
3030
#
3131
# e.g.,
32-
# cargo install protoc-gen-prost-crate --version 0.3.1
32+
# cargo install protoc-gen-prost-crate --version 0.4.0
3333
# ref. https://crates.io/crates/protoc-gen-prost-crate
34-
PROTOC_GEN_PROST_CRATE_VERSION=0.3.1
34+
PROTOC_GEN_PROST_CRATE_VERSION=0.4.0
3535
if [[ $(protoc-gen-prost-crate --version | cut -f2 -d' ') != "${PROTOC_GEN_PROST_CRATE_VERSION}" ]]; then
3636
echo "could not find protoc-gen-prost-crate version ${PROTOC_GEN_PROST_CRATE_VERSION} is it installed + in PATH?"
3737
exit 255
@@ -44,7 +44,11 @@ rm -rf ./protos/avalanche
4444

4545
# pull source from buf registry
4646
echo "Pulling proto source for protocol version: ${PROTOCOL_VERSION}..."
47-
buf export buf.build/ava-labs/avalanche:v"${PROTOCOL_VERSION}" -o ./protos/avalanche
47+
48+
# TODO: needs registry updates on https://buf.build/ava-labs/avalanche/tree/main
49+
# buf export buf.build/ava-labs/avalanche:v"${PROTOCOL_VERSION}" -o ./protos/avalanche
50+
51+
buf export buf.build/ava-labs/avalanche:main -o ./protos/avalanche
4852

4953
echo "Re-generating proto stubs..."
5054
buf generate

crates/avalanche-types/src/message/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod pull_query;
2121
pub mod push_query;
2222
pub mod put;
2323
pub mod state_summary_frontier;
24-
pub mod version;
2524

2625
pub fn ip_addr_to_bytes(ip_addr: std::net::IpAddr) -> Vec<u8> {
2726
match ip_addr {

crates/avalanche-types/src/message/version.rs

-209
This file was deleted.

crates/avalanche-types/src/proto/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ pub mod pb;
77
#[doc(hidden)]
88
pub use pb::*;
99

10-
/// ref. <https://github.com/ava-labs/avalanchego/blob/v1.10.1/version/constants.go#L15-L17>
11-
pub const PROTOCOL_VERSION: u32 = 28;
10+
/// ref. <https://github.com/ava-labs/avalanchego/blob/v1.11.0/version/constants.go>
11+
pub const PROTOCOL_VERSION: u32 = 33;

0 commit comments

Comments
 (0)