Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
release: switch to apache fastrlp (#1803)
Browse files Browse the repository at this point in the history
* release: switch to apache fastrlp

https://github.com/gakonst/open-fastrlp

* s/fastrlp/open_fastrlp
  • Loading branch information
gakonst authored Oct 23, 2022
1 parent 50973b9 commit 3d9c329
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 35 deletions.
92 changes: 66 additions & 26 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion ethers-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ repository = "https://github.com/gakonst/ethers-rs"
keywords = ["ethereum", "web3", "celo", "ethers"]

[dependencies]
fastrlp = { version = "0.1.3", features = ["std", "derive", "ethereum-types"] }
# Pin FastRLP to 0.1.2 when it was still Apache.
open-fastrlp = { version = "=0.1.2", features = ["std", "derive", "ethereum-types"] }
rlp = { version = "0.5.0", default-features = false, features = ["std"] }
ethabi = { version = "17.2.0", default-features = false, features = ["full-serde", "rlp"] }
arrayvec = { version = "0.7.2", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions ethers-core/src/types/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fastrlp::{Decodable, Encodable};
use open_fastrlp::{Decodable, Encodable};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{
borrow::Borrow,
Expand Down Expand Up @@ -147,7 +147,7 @@ impl Encodable for Bytes {
}

impl Decodable for Bytes {
fn decode(buf: &mut &[u8]) -> Result<Self, fastrlp::DecodeError> {
fn decode(buf: &mut &[u8]) -> Result<Self, open_fastrlp::DecodeError> {
Ok(Self(bytes::Bytes::decode(buf)?))
}
}
Expand Down
10 changes: 5 additions & 5 deletions ethers-core/src/types/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
utils::hash_message,
};
use elliptic_curve::{consts::U32, sec1::ToEncodedPoint};
use fastrlp::Decodable;
use generic_array::GenericArray;
use k256::{
ecdsa::{
Expand All @@ -13,6 +12,7 @@ use k256::{
},
PublicKey as K256PublicKey,
};
use open_fastrlp::Decodable;
use serde::{Deserialize, Serialize};
use std::{convert::TryFrom, fmt, str::FromStr};
use thiserror::Error;
Expand Down Expand Up @@ -141,19 +141,19 @@ impl Signature {
}

/// Decodes a signature from RLP bytes, assuming no RLP header
pub(crate) fn decode_signature(buf: &mut &[u8]) -> Result<Self, fastrlp::DecodeError> {
pub(crate) fn decode_signature(buf: &mut &[u8]) -> Result<Self, open_fastrlp::DecodeError> {
let v = u64::decode(buf)?;
Ok(Self { r: U256::decode(buf)?, s: U256::decode(buf)?, v })
}
}

impl fastrlp::Decodable for Signature {
fn decode(buf: &mut &[u8]) -> Result<Self, fastrlp::DecodeError> {
impl open_fastrlp::Decodable for Signature {
fn decode(buf: &mut &[u8]) -> Result<Self, open_fastrlp::DecodeError> {
Self::decode_signature(buf)
}
}

impl fastrlp::Encodable for Signature {
impl open_fastrlp::Encodable for Signature {
fn length(&self) -> usize {
self.r.length() + self.s.length() + self.v.length()
}
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/src/types/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{eip2718::TypedTransaction, normalize_v};
use crate::types::{
Address, Bytes, Signature, SignatureError, Transaction, TransactionRequest, H256, U256, U64,
};
use fastrlp::{
use open_fastrlp::{
RlpDecodable as FastRlpDecodable, RlpDecodableWrapper as FastRlpDecodableWrapper,
RlpEncodable as FastRlpEncodable, RlpEncodableWrapper as FastRlpEncodableWrapper,
};
Expand Down

0 comments on commit 3d9c329

Please sign in to comment.