Rename SSZ traits (Encodable -> Encode)

This commit is contained in:
Paul Hauner
2019-05-13 15:12:19 +10:00
parent 94ab2479fe
commit a0148b5aae
39 changed files with 130 additions and 131 deletions

View File

@@ -1,6 +1,6 @@
use super::BLOCKS_DB_COLUMN as DB_COLUMN;
use super::{ClientDB, DBError};
use ssz::Decodable;
use ssz::Decode;
use std::sync::Arc;
use types::{BeaconBlock, Hash256, Slot};

View File

@@ -1,6 +1,6 @@
use super::STATES_DB_COLUMN as DB_COLUMN;
use super::{ClientDB, DBError};
use ssz::Decodable;
use ssz::Decode;
use std::sync::Arc;
use types::{BeaconState, EthSpec, Hash256};

View File

@@ -4,7 +4,7 @@ use self::bytes::{BufMut, BytesMut};
use super::VALIDATOR_DB_COLUMN as DB_COLUMN;
use super::{ClientDB, DBError};
use bls::PublicKey;
use ssz::{Decodable, Encodable};
use ssz::{Decode, Encode};
use std::sync::Arc;
#[derive(Debug, PartialEq)]

View File

@@ -13,7 +13,7 @@ use libp2p::{
NetworkBehaviour, PeerId,
};
use slog::{debug, o, trace, warn};
use ssz::{ssz_encode, Decodable, DecodeError, Encodable};
use ssz::{ssz_encode, Decode, DecodeError, Encode};
use types::{Attestation, BeaconBlock};
use types::{Topic, TopicHash};
@@ -197,13 +197,13 @@ pub enum PubsubMessage {
}
//TODO: Correctly encode/decode enums. Prefixing with integer for now.
impl Encodable for PubsubMessage {
impl Encode for PubsubMessage {
fn is_ssz_fixed_len() -> bool {
false
}
fn ssz_append(&self, buf: &mut Vec<u8>) {
let offset = <u32 as Encodable>::ssz_fixed_len() + <Vec<u8> as Encodable>::ssz_fixed_len();
let offset = <u32 as Encode>::ssz_fixed_len() + <Vec<u8> as Encode>::ssz_fixed_len();
let mut encoder = ssz::SszEncoder::container(buf, offset);
@@ -226,7 +226,7 @@ impl Encodable for PubsubMessage {
}
}
impl Decodable for PubsubMessage {
impl Decode for PubsubMessage {
fn is_ssz_fixed_len() -> bool {
false
}

View File

@@ -1,6 +1,6 @@
use super::methods::*;
use libp2p::core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use ssz::{impl_decode_via_from, impl_encode_via_from, ssz_encode, Decodable, Encodable};
use ssz::{impl_decode_via_from, impl_encode_via_from, ssz_encode, Decode, Encode};
use std::hash::{Hash, Hasher};
use std::io;
use std::iter;
@@ -203,7 +203,7 @@ where
}
}
impl Encodable for RPCEvent {
impl Encode for RPCEvent {
fn is_ssz_fixed_len() -> bool {
false
}
@@ -213,9 +213,9 @@ impl Encodable for RPCEvent {
// This code has not been tested, it is a placeholder until we can update to the new libp2p
// spec.
fn ssz_append(&self, buf: &mut Vec<u8>) {
let offset = <bool as Encodable>::ssz_fixed_len()
+ <u16 as Encodable>::ssz_fixed_len()
+ <Vec<u8> as Encodable>::ssz_fixed_len();
let offset = <bool as Encode>::ssz_fixed_len()
+ <u16 as Encode>::ssz_fixed_len()
+ <Vec<u8> as Encode>::ssz_fixed_len();
let mut encoder = ssz::SszEncoder::container(buf, offset);

View File

@@ -7,7 +7,7 @@ use protos::services::{
};
use protos::services_grpc::AttestationService;
use slog::{error, info, trace, warn};
use ssz::{ssz_encode, Decodable};
use ssz::{ssz_encode, Decode};
use std::sync::Arc;
use types::{Attestation, EthSpec};

View File

@@ -11,7 +11,7 @@ use protos::services::{
use protos::services_grpc::BeaconBlockService;
use slog::Logger;
use slog::{error, info, trace, warn};
use ssz::{ssz_encode, Decodable};
use ssz::{ssz_encode, Decode};
use std::sync::Arc;
use types::{BeaconBlock, EthSpec, Signature, Slot};

View File

@@ -5,7 +5,7 @@ use grpcio::{RpcContext, RpcStatus, RpcStatusCode, UnarySink};
use protos::services::{ActiveValidator, GetDutiesRequest, GetDutiesResponse, ValidatorDuty};
use protos::services_grpc::ValidatorService;
use slog::{trace, warn};
use ssz::Decodable;
use ssz::Decode;
use std::sync::Arc;
use types::{Epoch, EthSpec, RelativeEpoch};