release: switch to apache fastrlp (#1803)

* release: switch to apache fastrlp

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

* s/fastrlp/open_fastrlp
This commit is contained in:
Georgios Konstantopoulos 2022-10-23 11:44:48 -07:00 committed by GitHub
parent 50973b99b6
commit 3d9c3290d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 35 deletions

92
Cargo.lock generated
View File

@ -952,6 +952,17 @@ dependencies = [
"zeroize",
]
[[package]]
name = "derive_more"
version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "dialoguer"
version = "0.8.0"
@ -1171,8 +1182,10 @@ checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef"
dependencies = [
"crunchy",
"fixed-hash",
"impl-codec",
"impl-rlp",
"impl-serde",
"scale-info",
"tiny-keccak",
]
@ -1184,9 +1197,11 @@ checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6"
dependencies = [
"ethbloom",
"fixed-hash",
"impl-codec",
"impl-rlp",
"impl-serde",
"primitive-types",
"scale-info",
"uint",
]
@ -1291,12 +1306,12 @@ dependencies = [
"convert_case",
"elliptic-curve",
"ethabi",
"fastrlp",
"generic-array 0.14.6",
"hex",
"hex-literal",
"k256",
"once_cell",
"open-fastrlp",
"proc-macro2",
"rand 0.8.5",
"rlp",
@ -1524,31 +1539,6 @@ dependencies = [
"instant",
]
[[package]]
name = "fastrlp"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "089263294bb1c38ac73649a6ad563dd9a5142c8dc0482be15b8b9acb22a1611e"
dependencies = [
"arrayvec 0.7.2",
"auto_impl 1.0.1",
"bytes",
"ethereum-types",
"fastrlp-derive",
]
[[package]]
name = "fastrlp-derive"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9499f20a2fa1a744422de24d1b4d1ec58f240147de1d0a3ceacadf2e240b4fc2"
dependencies = [
"bytes",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "ff"
version = "0.12.0"
@ -2445,6 +2435,31 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open-fastrlp"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "131de184f045153e72c537ef4f1d57babddf2a897ca19e67bdff697aebba7f3d"
dependencies = [
"arrayvec 0.7.2",
"auto_impl 1.0.1",
"bytes",
"ethereum-types",
"open-fastrlp-derive",
]
[[package]]
name = "open-fastrlp-derive"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c"
dependencies = [
"bytes",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "openssl"
version = "0.10.38"
@ -2845,6 +2860,7 @@ dependencies = [
"impl-codec",
"impl-rlp",
"impl-serde",
"scale-info",
"uint",
]
@ -3341,6 +3357,30 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "scale-info"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153"
dependencies = [
"cfg-if 1.0.0",
"derive_more",
"parity-scale-codec",
"scale-info-derive",
]
[[package]]
name = "scale-info-derive"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "schannel"
version = "0.1.19"

View File

@ -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 }

View File

@ -1,4 +1,4 @@
use fastrlp::{Decodable, Encodable};
use open_fastrlp::{Decodable, Encodable};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{
borrow::Borrow,
@ -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)?))
}
}

View File

@ -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::{
@ -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;
@ -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()
}

View File

@ -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,
};