fix(ethabi): breaking changes and force enable serialize for eth-types (#448)

* fix(ethabi): breaking changes and force enable serialize for eth-types

* chore(ethereum-types) enable rlp
This commit is contained in:
Georgios Konstantopoulos 2021-09-13 20:43:54 +03:00 committed by GitHub
parent f2e41c0500
commit a6918aed2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

3
Cargo.lock generated
View File

@ -805,7 +805,7 @@ dependencies = [
[[package]] [[package]]
name = "ethabi" name = "ethabi"
version = "14.1.0" version = "14.1.0"
source = "git+https://github.com/rust-ethereum/ethabi/?branch=master#506f6cc364cdb458ac09f2be4f300779da256b08" source = "git+https://github.com/rust-ethereum/ethabi/?branch=master#8bd90d13956edf18bb47c6e39dcf7ab99bf264c7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"ethereum-types", "ethereum-types",
@ -923,6 +923,7 @@ dependencies = [
"ecdsa", "ecdsa",
"elliptic-curve", "elliptic-curve",
"ethabi", "ethabi",
"ethereum-types",
"futures-util", "futures-util",
"generic-array 0.14.4", "generic-array 0.14.4",
"glob", "glob",

View File

@ -8,7 +8,12 @@ use ethers_core::{
}; };
use ethers_providers::Middleware; use ethers_providers::Middleware;
use std::{collections::HashMap, fmt::Debug, hash::Hash, sync::Arc}; use std::{
collections::{BTreeMap, HashMap},
fmt::Debug,
hash::Hash,
sync::Arc,
};
use thiserror::Error; use thiserror::Error;
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -175,7 +180,7 @@ pub fn decode_function_data<D: Detokenize, T: AsRef<[u8]>>(
/// Utility function for creating a mapping between a unique signature and a /// Utility function for creating a mapping between a unique signature and a
/// name-index pair for accessing contract ABI items. /// name-index pair for accessing contract ABI items.
fn create_mapping<T, S, F>( fn create_mapping<T, S, F>(
elements: &HashMap<String, Vec<T>>, elements: &BTreeMap<String, Vec<T>>,
signature: F, signature: F,
) -> HashMap<S, (String, usize)> ) -> HashMap<S, (String, usize)>
where where

View File

@ -13,6 +13,7 @@ keywords = ["ethereum", "web3", "celo", "ethers"]
rlp = { version = "0.5.0", default-features = false } rlp = { version = "0.5.0", default-features = false }
# ethabi = { version = "14.1.0", default-features = false } # ethabi = { version = "14.1.0", default-features = false }
ethabi = { git = "https://github.com/rust-ethereum/ethabi/", branch = "master" } ethabi = { git = "https://github.com/rust-ethereum/ethabi/", branch = "master" }
ethereum-types = { version = "0.12.0", default-features = false, features = ["serialize", "rlp"] }
arrayvec = { version = "0.7.1", default-features = false } arrayvec = { version = "0.7.1", default-features = false }
rlp-derive = { version = "0.1.0", default-features = false } rlp-derive = { version = "0.1.0", default-features = false }

View File

@ -1,4 +1,4 @@
use std::collections::{HashMap, VecDeque}; use std::collections::{BTreeMap, HashMap, VecDeque};
use crate::abi::error::{bail, format_err, ParseError, Result}; use crate::abi::error::{bail, format_err, ParseError, Result};
use crate::abi::struct_def::{FieldType, StructFieldType}; use crate::abi::struct_def::{FieldType, StructFieldType};
@ -52,8 +52,8 @@ impl AbiParser {
// parse struct first // parse struct first
let mut abi = Abi { let mut abi = Abi {
constructor: None, constructor: None,
functions: HashMap::new(), functions: BTreeMap::new(),
events: HashMap::new(), events: BTreeMap::new(),
receive: false, receive: false,
fallback: false, fallback: false,
}; };