Merge remote-tracking branch 'origin/main' into dev
This commit is contained in:
commit
32fd2b484c
92
.github/workflows/build.yml
vendored
92
.github/workflows/build.yml
vendored
@ -19,7 +19,6 @@ jobs:
|
|||||||
platform:
|
platform:
|
||||||
- ubuntu-16.04
|
- ubuntu-16.04
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows2019
|
|
||||||
toolchain:
|
toolchain:
|
||||||
- stable
|
- stable
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
@ -37,25 +36,25 @@ jobs:
|
|||||||
# Windows Build
|
# Windows Build
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
- name: Install LLVM for Windows
|
# - name: Install LLVM for Windows
|
||||||
if: matrix.platform == 'windows2019'
|
# if: matrix.platform == 'windows2019'
|
||||||
run: choco install llvm -y
|
# run: choco install llvm
|
||||||
|
|
||||||
- name: Build OpenEthereum for Windows
|
# - name: Build OpenEthereum for Windows
|
||||||
if: matrix.platform == 'windows2019'
|
# if: matrix.platform == 'windows2019'
|
||||||
run: sh scripts/actions/build-windows.sh ${{matrix.platform}}
|
# run: sh scripts/actions/build-windows.sh ${{matrix.platform}}
|
||||||
|
|
||||||
- name: Upload Windows build
|
# - name: Upload Windows build
|
||||||
uses: actions/upload-artifact@v2
|
# uses: actions/upload-artifact@v2
|
||||||
if: matrix.platform == 'windows2019'
|
# if: matrix.platform == 'windows2019'
|
||||||
with:
|
# with:
|
||||||
name: windows-artifacts
|
# name: windows-artifacts
|
||||||
path: artifacts
|
# path: artifacts
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Linux/Macos Build
|
# Linux/Macos Build
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
- name: Build OpenEthereum for ${{matrix.platform}}
|
- name: Build OpenEthereum for ${{matrix.platform}}
|
||||||
if: matrix.platform != 'windows2019'
|
if: matrix.platform != 'windows2019'
|
||||||
run: sh scripts/actions/build-linux.sh ${{matrix.platform}}
|
run: sh scripts/actions/build-linux.sh ${{matrix.platform}}
|
||||||
@ -133,17 +132,18 @@ jobs:
|
|||||||
echo ::set-output name=MACOS_ARTIFACT::openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
echo ::set-output name=MACOS_ARTIFACT::openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||||
echo ::set-output name=MACOS_SHASUM::$(shasum -a 256 openethereum-macos-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
echo ::set-output name=MACOS_SHASUM::$(shasum -a 256 openethereum-macos-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
||||||
|
|
||||||
- name: Create zip Windows
|
# - name: Create zip Windows
|
||||||
id: create_zip_windows
|
# id: create_zip_windows
|
||||||
run: |
|
# run: |
|
||||||
cd windows-artifacts/
|
# cd windows-artifacts/
|
||||||
zip -rT openethereum-windows-${{ env.RELEASE_VERSION }}.zip *
|
# zip -rT openethereum-windows-${{ env.RELEASE_VERSION }}.zip *
|
||||||
ls openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# ls openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
cd ..
|
# cd ..
|
||||||
mv windows-artifacts/openethereum-windows-${{ env.RELEASE_VERSION }}.zip .
|
# mv windows-artifacts/openethereum-windows-${{ env.RELEASE_VERSION }}.zip .
|
||||||
echo "Setting outputs..."
|
|
||||||
echo ::set-output name=WINDOWS_ARTIFACT::openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# echo "Setting outputs..."
|
||||||
echo ::set-output name=WINDOWS_SHASUM::$(shasum -a 256 openethereum-windows-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
# echo ::set-output name=WINDOWS_ARTIFACT::openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
# echo ::set-output name=WINDOWS_SHASUM::$(shasum -a 256 openethereum-windows-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
||||||
|
|
||||||
# =======================================================================
|
# =======================================================================
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
@ -162,11 +162,11 @@ jobs:
|
|||||||
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||||
path: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
path: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
|
||||||
- name: Upload artifacts
|
# - name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
# uses: actions/upload-artifact@v2
|
||||||
with:
|
# with:
|
||||||
name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
path: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# path: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
|
||||||
# =======================================================================
|
# =======================================================================
|
||||||
# Upload artifacts to S3
|
# Upload artifacts to S3
|
||||||
@ -191,8 +191,8 @@ jobs:
|
|||||||
linux-shasum: ${{ steps.create_zip_linux.outputs.LINUX_SHASUM }}
|
linux-shasum: ${{ steps.create_zip_linux.outputs.LINUX_SHASUM }}
|
||||||
macos-artifact: ${{ steps.create_zip_macos.outputs.MACOS_ARTIFACT }}
|
macos-artifact: ${{ steps.create_zip_macos.outputs.MACOS_ARTIFACT }}
|
||||||
macos-shasum: ${{ steps.create_zip_macos.outputs.MACOS_SHASUM }}
|
macos-shasum: ${{ steps.create_zip_macos.outputs.MACOS_SHASUM }}
|
||||||
windows-artifact: ${{ steps.create_zip_windows.outputs.WINDOWS_ARTIFACT }}
|
# windows-artifact: ${{ steps.create_zip_windows.outputs.WINDOWS_ARTIFACT }}
|
||||||
windows-shasum: ${{ steps.create_zip_windows.outputs.WINDOWS_SHASUM }}
|
# windows-shasum: ${{ steps.create_zip_windows.outputs.WINDOWS_SHASUM }}
|
||||||
|
|
||||||
draft-release:
|
draft-release:
|
||||||
name: Draft Release
|
name: Draft Release
|
||||||
@ -216,10 +216,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
|
||||||
- name: Download artifacts
|
# - name: Download artifacts
|
||||||
uses: actions/download-artifact@v2
|
# uses: actions/download-artifact@v2
|
||||||
with:
|
# with:
|
||||||
name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
|
||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
run: ls
|
run: ls
|
||||||
@ -273,13 +273,13 @@ jobs:
|
|||||||
asset_name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
asset_name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
||||||
- name: Upload Release Asset - Windows
|
# - name: Upload Release Asset - Windows
|
||||||
id: upload_release_asset_windows
|
# id: upload_release_asset_windows
|
||||||
uses: actions/upload-release-asset@v1
|
# uses: actions/upload-release-asset@v1
|
||||||
env:
|
# env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
# with:
|
||||||
upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
# upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||||
asset_path: ./openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# asset_path: ./openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
asset_name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
# asset_name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||||
asset_content_type: application/zip
|
# asset_content_type: application/zip
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
## OpenEthereum v3.2.0-rc.1
|
## OpenEthereum v3.2.0
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
* Update EWF's chains with Istanbul transition block numbers (#11482) (#254)
|
* Update EWF's chains with Istanbul transition block numbers (#11482) (#254)
|
||||||
* fix Supplied instant is later than self (#169)
|
* fix Supplied instant is later than self (#169)
|
||||||
|
* ethcore/snapshot: fix double-lock in Service::feed_chunk (#289)
|
||||||
|
|
||||||
Enhancements:
|
Enhancements:
|
||||||
* Berlin hardfork blocks: mainnet (12,244,000), goerli (4,460,644), rinkeby (8,290,928) and ropsten (9,812,189)
|
* Berlin hardfork blocks: mainnet (12,244,000), goerli (4,460,644), rinkeby (8,290,928) and ropsten (9,812,189)
|
||||||
* yolo3x spec (#241)
|
* yolo3x spec (#241)
|
||||||
|
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -439,7 +439,6 @@ name = "common-types"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethereum-types 0.4.2",
|
"ethereum-types 0.4.2",
|
||||||
"ethjson",
|
|
||||||
"ethkey",
|
"ethkey",
|
||||||
"heapsize",
|
"heapsize",
|
||||||
"keccak-hash",
|
"keccak-hash",
|
||||||
@ -1380,7 +1379,9 @@ dependencies = [
|
|||||||
name = "ethjson"
|
name = "ethjson"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"common-types",
|
||||||
"ethereum-types 0.4.2",
|
"ethereum-types 0.4.2",
|
||||||
|
"ethkey",
|
||||||
"macros",
|
"macros",
|
||||||
"maplit",
|
"maplit",
|
||||||
"rustc-hex 1.0.0",
|
"rustc-hex 1.0.0",
|
||||||
@ -2830,7 +2831,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openethereum"
|
name = "openethereum"
|
||||||
version = "3.2.0-rc.1"
|
version = "3.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.10.2",
|
"ansi_term 0.10.2",
|
||||||
"atty",
|
"atty",
|
||||||
@ -3194,7 +3195,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-version"
|
name = "parity-version"
|
||||||
version = "3.2.0-rc.1"
|
version = "3.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-bytes",
|
"parity-bytes",
|
||||||
"rlp 0.3.0",
|
"rlp 0.3.0",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
description = "OpenEthereum"
|
description = "OpenEthereum"
|
||||||
name = "openethereum"
|
name = "openethereum"
|
||||||
# NOTE Make sure to update util/version/Cargo.toml as well
|
# NOTE Make sure to update util/version/Cargo.toml as well
|
||||||
version = "3.2.0-rc.1"
|
version = "3.2.0"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = [
|
authors = [
|
||||||
"OpenEthereum developers",
|
"OpenEthereum developers",
|
||||||
|
@ -204,7 +204,7 @@ fn run_state_test(args: Args) {
|
|||||||
}
|
}
|
||||||
for (idx, state) in states.into_iter().enumerate() {
|
for (idx, state) in states.into_iter().enumerate() {
|
||||||
let post_root = state.hash.into();
|
let post_root = state.hash.into();
|
||||||
let transaction = multitransaction.select(&state.indexes).into();
|
let transaction = multitransaction.select(&state.indexes);
|
||||||
|
|
||||||
let trie_spec = if args.flag_std_dump_json {
|
let trie_spec = if args.flag_std_dump_json {
|
||||||
TrieSpec::Fat
|
TrieSpec::Fat
|
||||||
|
@ -170,7 +170,6 @@
|
|||||||
"eip1706Transition": "0x8a61c8",
|
"eip1706Transition": "0x8a61c8",
|
||||||
"eip1884Transition": "0x8a61c8",
|
"eip1884Transition": "0x8a61c8",
|
||||||
"eip2028Transition": "0x8a61c8",
|
"eip2028Transition": "0x8a61c8",
|
||||||
"eip2315Transition": "0xbad420",
|
|
||||||
"eip2929Transition": "0xbad420",
|
"eip2929Transition": "0xbad420",
|
||||||
"eip2930Transition": "0xbad420"
|
"eip2930Transition": "0xbad420"
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
"eip1706Transition": "0x17d433",
|
"eip1706Transition": "0x17d433",
|
||||||
"eip1884Transition": "0x17d433",
|
"eip1884Transition": "0x17d433",
|
||||||
"eip2028Transition": "0x17d433",
|
"eip2028Transition": "0x17d433",
|
||||||
"eip2315Transition": "0x441064",
|
|
||||||
"eip2929Transition": "0x441064",
|
"eip2929Transition": "0x441064",
|
||||||
"eip2930Transition": "0x441064",
|
"eip2930Transition": "0x441064",
|
||||||
"gasLimitBoundDivisor": "0x400",
|
"gasLimitBoundDivisor": "0x400",
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
"eip1706Transition": "0x52efd1",
|
"eip1706Transition": "0x52efd1",
|
||||||
"eip1884Transition": "0x52efd1",
|
"eip1884Transition": "0x52efd1",
|
||||||
"eip2028Transition": "0x52efd1",
|
"eip2028Transition": "0x52efd1",
|
||||||
"eip2315Transition": "0x7e8270",
|
|
||||||
"eip2929Transition": "0x7e8270",
|
"eip2929Transition": "0x7e8270",
|
||||||
"eip2930Transition": "0x7e8270",
|
"eip2930Transition": "0x7e8270",
|
||||||
"gasLimitBoundDivisor": "0x400",
|
"gasLimitBoundDivisor": "0x400",
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
"eip1706Transition": "0x62f756",
|
"eip1706Transition": "0x62f756",
|
||||||
"eip1884Transition": "0x62f756",
|
"eip1884Transition": "0x62f756",
|
||||||
"eip2028Transition": "0x62f756",
|
"eip2028Transition": "0x62f756",
|
||||||
"eip2315Transition": "0x95b8dd",
|
|
||||||
"eip2929Transition": "0x95b8dd",
|
"eip2929Transition": "0x95b8dd",
|
||||||
"eip2930Transition": "0x95b8dd"
|
"eip2930Transition": "0x95b8dd"
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
"eip1706Transition": "0x0",
|
"eip1706Transition": "0x0",
|
||||||
"eip1884Transition": "0x0",
|
"eip1884Transition": "0x0",
|
||||||
"eip2028Transition": "0x0",
|
"eip2028Transition": "0x0",
|
||||||
"eip2315Transition": "0x0",
|
|
||||||
"eip2929Transition": "0x0",
|
"eip2929Transition": "0x0",
|
||||||
"eip2930Transition": "0x0"
|
"eip2930Transition": "0x0"
|
||||||
},
|
},
|
||||||
@ -203,4 +202,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
"eip2028Transition": "0x0",
|
"eip2028Transition": "0x0",
|
||||||
"eip211Transition": "0x0",
|
"eip211Transition": "0x0",
|
||||||
"eip214Transition": "0x0",
|
"eip214Transition": "0x0",
|
||||||
"eip2315Transition": "0x0",
|
|
||||||
"eip2929Transition": "0x0",
|
"eip2929Transition": "0x0",
|
||||||
"eip2930Transition": "0x0",
|
"eip2930Transition": "0x0",
|
||||||
"eip658Transition": "0x0",
|
"eip658Transition": "0x0",
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1508126ea04cd61495b60db2f036ac823de274b1
|
Subproject commit e431795bf750166671afc3516f5e0332af3318f1
|
@ -184,7 +184,7 @@ impl TestRunner {
|
|||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super::state::json_chain_test(&test, &path, &json, &mut |_, _| {})
|
super::state::json_state_test(&test, &path, &json, &mut |_, _| {})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ use ethjson;
|
|||||||
use pod_state::PodState;
|
use pod_state::PodState;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use trace;
|
use trace;
|
||||||
use types::transaction::SignedTransaction;
|
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
|
|
||||||
fn skip_test(
|
fn skip_test(
|
||||||
@ -42,7 +41,7 @@ fn skip_test(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn json_chain_test<H: FnMut(&str, HookType)>(
|
pub fn json_state_test<H: FnMut(&str, HookType)>(
|
||||||
state_test: ðjson::test::StateTests,
|
state_test: ðjson::test::StateTests,
|
||||||
path: &Path,
|
path: &Path,
|
||||||
json_data: &[u8],
|
json_data: &[u8],
|
||||||
@ -91,8 +90,7 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let post_root: H256 = state.hash.into();
|
let post_root: H256 = state.hash.into();
|
||||||
let transaction: SignedTransaction =
|
let transaction = multitransaction.select(&state.indexes);
|
||||||
multitransaction.select(&state.indexes).into();
|
|
||||||
|
|
||||||
let result = || -> Result<_, EvmTestError> {
|
let result = || -> Result<_, EvmTestError> {
|
||||||
Ok(EvmTestClient::from_pod_state(&spec, pre.clone())?.transact(
|
Ok(EvmTestClient::from_pod_state(&spec, pre.clone())?.transact(
|
||||||
|
@ -6,7 +6,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
ethjson = { path = "../../ethjson" }
|
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
ethkey = { path = "../../accounts/ethkey" }
|
||||||
heapsize = "0.4"
|
heapsize = "0.4"
|
||||||
keccak-hash = "0.1"
|
keccak-hash = "0.1"
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#![warn(unused_extern_crates)]
|
#![warn(unused_extern_crates)]
|
||||||
|
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethjson;
|
|
||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
extern crate heapsize;
|
extern crate heapsize;
|
||||||
extern crate keccak_hash as hash;
|
extern crate keccak_hash as hash;
|
||||||
|
@ -21,7 +21,6 @@ use ethereum_types::{Address, Bloom, BloomInput, H256};
|
|||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use ethjson;
|
|
||||||
use BlockNumber;
|
use BlockNumber;
|
||||||
|
|
||||||
/// A record of execution for a `LOG` operation.
|
/// A record of execution for a `LOG` operation.
|
||||||
@ -53,16 +52,6 @@ impl LogEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ethjson::state::Log> for LogEntry {
|
|
||||||
fn from(l: ethjson::state::Log) -> Self {
|
|
||||||
LogEntry {
|
|
||||||
address: l.address.into(),
|
|
||||||
topics: l.topics.into_iter().map(Into::into).collect(),
|
|
||||||
data: l.data.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Log localized in a blockchain.
|
/// Log localized in a blockchain.
|
||||||
#[derive(Default, Debug, PartialEq, Clone)]
|
#[derive(Default, Debug, PartialEq, Clone)]
|
||||||
pub struct LocalizedLogEntry {
|
pub struct LocalizedLogEntry {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
//! Transaction data structure.
|
//! Transaction data structure.
|
||||||
|
|
||||||
use ethereum_types::{Address, H160, H256, U256};
|
use ethereum_types::{Address, H160, H256, U256};
|
||||||
use ethjson;
|
|
||||||
use ethkey::{self, public_to_address, recover, Public, Secret, Signature};
|
use ethkey::{self, public_to_address, recover, Public, Secret, Signature};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
@ -606,56 +605,6 @@ impl SignatureComponents {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-helpers"))]
|
|
||||||
impl From<ethjson::state::Transaction> for SignedTransaction {
|
|
||||||
fn from(t: ethjson::state::Transaction) -> Self {
|
|
||||||
let to: Option<ethjson::hash::Address> = t.to.into();
|
|
||||||
let secret = t.secret.map(|s| Secret::from(s.0));
|
|
||||||
let tx = TypedTransaction::Legacy(Transaction {
|
|
||||||
nonce: t.nonce.into(),
|
|
||||||
gas_price: t.gas_price.into(),
|
|
||||||
gas: t.gas_limit.into(),
|
|
||||||
action: match to {
|
|
||||||
Some(to) => Action::Call(to.into()),
|
|
||||||
None => Action::Create,
|
|
||||||
},
|
|
||||||
value: t.value.into(),
|
|
||||||
data: t.data.into(),
|
|
||||||
});
|
|
||||||
match secret {
|
|
||||||
Some(s) => tx.sign(&s, None),
|
|
||||||
None => tx.null_sign(1),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ethjson::transaction::Transaction> for UnverifiedTransaction {
|
|
||||||
fn from(t: ethjson::transaction::Transaction) -> Self {
|
|
||||||
let to: Option<ethjson::hash::Address> = t.to.into();
|
|
||||||
UnverifiedTransaction {
|
|
||||||
unsigned: TypedTransaction::Legacy(Transaction {
|
|
||||||
nonce: t.nonce.into(),
|
|
||||||
gas_price: t.gas_price.into(),
|
|
||||||
gas: t.gas_limit.into(),
|
|
||||||
action: match to {
|
|
||||||
Some(to) => Action::Call(to.into()),
|
|
||||||
None => Action::Create,
|
|
||||||
},
|
|
||||||
value: t.value.into(),
|
|
||||||
data: t.data.into(),
|
|
||||||
}),
|
|
||||||
chain_id: signature::extract_chain_id_from_legacy_v(t.v.into()),
|
|
||||||
signature: SignatureComponents {
|
|
||||||
r: t.r.into(),
|
|
||||||
s: t.s.into(),
|
|
||||||
standard_v: signature::extract_standard_v(t.v.into()),
|
|
||||||
},
|
|
||||||
hash: 0.into(),
|
|
||||||
}
|
|
||||||
.compute_hash()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Signed transaction information without verified signature.
|
/// Signed transaction information without verified signature.
|
||||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct UnverifiedTransaction {
|
pub struct UnverifiedTransaction {
|
||||||
|
@ -5,6 +5,8 @@ version = "0.1.0"
|
|||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
common-types = { path = "../ethcore/types", features = ["test-helpers"] }
|
||||||
|
ethkey = { path = "../accounts/ethkey" }
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@ -41,7 +41,7 @@ pub struct Transaction {
|
|||||||
|
|
||||||
pub type AccessList = Vec<AccessListItem>;
|
pub type AccessList = Vec<AccessListItem>;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AccessListItem {
|
pub struct AccessListItem {
|
||||||
pub address: H160,
|
pub address: H160,
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
extern crate common_types as types;
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
|
extern crate ethkey;
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
@ -17,14 +17,18 @@
|
|||||||
//! General test deserialization.
|
//! General test deserialization.
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethkey::Secret;
|
||||||
use hash::{Address, H256};
|
use hash::{Address, H256};
|
||||||
use maybe::MaybeEmpty;
|
use maybe::MaybeEmpty;
|
||||||
use serde_json::{self, Error};
|
use serde_json::{self, Error};
|
||||||
use spec::ForkSpec;
|
use spec::ForkSpec;
|
||||||
use state::{AccountState, Env, Transaction};
|
use state::{AccountState, Env};
|
||||||
use std::{collections::BTreeMap, io::Read};
|
use std::{collections::BTreeMap, io::Read};
|
||||||
|
use types::transaction::{AccessListTx, Action, SignedTransaction, Transaction, TypedTransaction};
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
|
|
||||||
|
use crate::blockchain::transaction::AccessList;
|
||||||
|
|
||||||
/// State test deserializer.
|
/// State test deserializer.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
pub struct Test(BTreeMap<String, State>);
|
pub struct Test(BTreeMap<String, State>);
|
||||||
@ -69,6 +73,8 @@ pub struct State {
|
|||||||
pub struct MultiTransaction {
|
pub struct MultiTransaction {
|
||||||
/// Transaction data set.
|
/// Transaction data set.
|
||||||
pub data: Vec<Bytes>,
|
pub data: Vec<Bytes>,
|
||||||
|
/// Optional access list
|
||||||
|
pub access_lists: Option<Vec<Option<AccessList>>>,
|
||||||
/// Gas limit set.
|
/// Gas limit set.
|
||||||
pub gas_limit: Vec<Uint>,
|
pub gas_limit: Vec<Uint>,
|
||||||
/// Gas price.
|
/// Gas price.
|
||||||
@ -84,18 +90,57 @@ pub struct MultiTransaction {
|
|||||||
pub value: Vec<Uint>,
|
pub value: Vec<Uint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sign_with_secret(tx: TypedTransaction, secret: Option<Secret>) -> SignedTransaction {
|
||||||
|
match secret {
|
||||||
|
Some(s) => tx.sign(&s, None),
|
||||||
|
None => tx.null_sign(1),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MultiTransaction {
|
impl MultiTransaction {
|
||||||
/// Build transaction with given indexes.
|
/// Build transaction with given indexes.
|
||||||
pub fn select(&self, indexes: &PostStateIndexes) -> Transaction {
|
pub fn select(&self, indexes: &PostStateIndexes) -> SignedTransaction {
|
||||||
Transaction {
|
let secret = self.secret.clone().map(|s| Secret::from(s.0));
|
||||||
data: self.data[indexes.data as usize].clone(),
|
let to: Option<Address> = self.to.clone().into();
|
||||||
gas_limit: self.gas_limit[indexes.gas as usize].clone(),
|
let transaction = Transaction {
|
||||||
gas_price: self.gas_price.clone(),
|
nonce: self.nonce.clone().into(),
|
||||||
nonce: self.nonce.clone(),
|
gas_price: self.gas_price.clone().into(),
|
||||||
secret: self.secret.clone(),
|
gas: self.gas_limit[indexes.gas as usize].clone().into(),
|
||||||
to: self.to.clone(),
|
action: match to {
|
||||||
value: self.value[indexes.value as usize].clone(),
|
Some(to) => Action::Call(to.into()),
|
||||||
|
None => Action::Create,
|
||||||
|
},
|
||||||
|
value: self.value[indexes.value as usize].clone().into(),
|
||||||
|
data: self.data[indexes.data as usize].clone().into(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(access_lists) = self.access_lists.as_ref() {
|
||||||
|
if access_lists.len() > indexes.data as usize {
|
||||||
|
if let Some(access_list) = access_lists[indexes.data as usize].clone() {
|
||||||
|
//access list type of transaction
|
||||||
|
|
||||||
|
let access_list = access_list
|
||||||
|
.into_iter()
|
||||||
|
.map(|elem| {
|
||||||
|
(
|
||||||
|
elem.address.into(),
|
||||||
|
elem.storage_keys.into_iter().map(Into::into).collect(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let tx = TypedTransaction::AccessList(AccessListTx {
|
||||||
|
transaction,
|
||||||
|
access_list,
|
||||||
|
});
|
||||||
|
|
||||||
|
return sign_with_secret(tx, secret);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tx = TypedTransaction::Legacy(transaction);
|
||||||
|
sign_with_secret(tx, secret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +183,39 @@ mod tests {
|
|||||||
let _deserialized: MultiTransaction = serde_json::from_str(s).unwrap();
|
let _deserialized: MultiTransaction = serde_json::from_str(s).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multi_transaction_deserialization_with_access_list() {
|
||||||
|
let s = r#"{
|
||||||
|
"data" : [ "" ],
|
||||||
|
"accessLists" : [
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"address" : "0x0000000000000000000000000000000000000102",
|
||||||
|
"storageKeys" : [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address" : "0x0000000000000000000000000000000000000101",
|
||||||
|
"storageKeys" : [
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000010"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"gasLimit" : [ "0x2dc6c0", "0x222222" ],
|
||||||
|
"gasPrice" : "0x01",
|
||||||
|
"nonce" : "0x00",
|
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||||
|
"to" : "1000000000000000000000000000000000000000",
|
||||||
|
"value" : [ "0x00", "0x01", "0x02" ]
|
||||||
|
}"#;
|
||||||
|
let _deserialized: MultiTransaction = serde_json::from_str(s).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn state_deserialization() {
|
fn state_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
|
@ -51,6 +51,7 @@ mod tests {
|
|||||||
fn transaction_deserialization() {
|
fn transaction_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"data" : "",
|
"data" : "",
|
||||||
|
"accessLists": null,
|
||||||
"gasLimit" : "0x2dc6c0",
|
"gasLimit" : "0x2dc6c0",
|
||||||
"gasPrice" : "0x01",
|
"gasPrice" : "0x01",
|
||||||
"nonce" : "0x00",
|
"nonce" : "0x00",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "parity-version"
|
name = "parity-version"
|
||||||
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
|
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
|
||||||
version = "3.2.0-rc.1"
|
version = "3.2.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user