Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'beta' into tx-penalize
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Sep 23, 2016
2 parents 6fffede + 9df5931 commit d4312d1
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 28 deletions.
46 changes: 34 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ linux-stable:
paths:
- target/release/parity
name: "stable-x86_64-unknown-linux-gnu_parity"
linux-stable-14.04:
stage: build
image: ethcore/rust-14.04:latest
only:
- master
- beta
- tags
- stable
script:
- cargo build --release --verbose
- strip target/release/parity
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity --body target/release/parity
tags:
- rust
- rust-14.04
artifacts:
paths:
- target/release/parity
name: "stable-x86_64-unknown-ubuntu_14_04-gnu_parity"
linux-beta:
stage: build
image: ethcore/rust:beta
Expand Down Expand Up @@ -83,14 +104,14 @@ linux-centos:
- strip target/release/parity
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-centos-linux-gnu/parity --body target/release/parity
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity
tags:
- rust
- rust-centos
artifacts:
paths:
- target/release/parity
name: "centos-x86_64-unknown-linux-gnu_parity"
name: "x86_64-unknown-centos-gnu_parity"
linux-armv7:
stage: build
image: ethcore/rust-armv7:latest
Expand All @@ -115,7 +136,7 @@ linux-armv7:
- rust-arm
artifacts:
paths:
- target/release/parity
- target/armv7-unknown-linux-gnueabihf/release/parity
name: "armv7_unknown_linux_gnueabihf_parity"
allow_failure: true
linux-arm:
Expand All @@ -136,13 +157,13 @@ linux-arm:
- arm-linux-gnueabihf-strip target/arm-unknown-linux-gnueabihf/release/parity
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/release/parity
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
tags:
- rust
- rust-arm
artifacts:
paths:
- target/release/parity
- target/arm-unknown-linux-gnueabihf/release/parity
name: "arm-unknown-linux-gnueabihf_parity"
allow_failure: true
linux-armv6:
Expand All @@ -163,13 +184,13 @@ linux-armv6:
- arm-linux-gnueabi-strip target/arm-unknown-linux-gnueabi/release/parity
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/release/parity
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
tags:
- rust
- rust-arm
artifacts:
paths:
- target/release/parity
- target/arm-unknown-linux-gnueabi/release/parity
name: "arm-unknown-linux-gnueabi_parity"
allow_failure: true
linux-aarch64:
Expand All @@ -190,13 +211,13 @@ linux-aarch64:
- aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/parity
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/release/parity
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
tags:
- rust
- rust-arm
artifacts:
paths:
- target/release/parity
- target/aarch64-unknown-linux-gnu/release/parity
name: "aarch64-unknown-linux-gnu_parity"
allow_failure: true
darwin:
Expand Down Expand Up @@ -230,9 +251,10 @@ windows:
- set RUST_BACKTRACE=1
- rustup default stable-x86_64-pc-windows-msvc
- cargo build --release --verbose
- aws configure set aws_access_key_id $s3_key
- aws configure set aws_secret_access_key $s3_secret
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-pc-windows-msvc/parity --body target/release/parity.exe
- aws configure set aws_access_key_id %s3_key%
- aws configure set aws_secret_access_key %s3_secret%
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity --body target/release/parity.exe
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity --body target/release/parity.pdb
tags:
- rust-windows
artifacts:
Expand Down
8 changes: 1 addition & 7 deletions docker/ubuntu-aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ RUN rustup target add aarch64-unknown-linux-gnu
# show backtraces
ENV RUST_BACKTRACE 1

# set compilers
ENV CXX aarch64-linux-gnu-g++
ENV CC aarch64-linux-gnu-gcc

# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
cargo -V

# build parity
RUN git clone https://github.com/ethcore/parity && \
Expand Down
8 changes: 1 addition & 7 deletions docker/ubuntu-arm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ RUN rustup target add armv7-unknown-linux-gnueabihf
# show backtraces
ENV RUST_BACKTRACE 1

# set compilers
ENV CXX arm-linux-gnueabihf-g++
ENV CC arm-linux-gnueabihf-gcc

# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
cargo -V

# build parity
RUN git clone https://github.com/ethcore/parity && \
Expand Down
9 changes: 8 additions & 1 deletion rpc/src/v1/impls/ethcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use ethcore::client::{MiningBlockChainClient};

use jsonrpc_core::*;
use v1::traits::Ethcore;
use v1::types::{Bytes, U256, Peers, H160};
use v1::types::{Bytes, U256, Peers, H160, Transaction};
use v1::helpers::{errors, SigningQueue, ConfirmationsQueue, NetworkSettings};
use v1::helpers::params::expect_no_params;

Expand Down Expand Up @@ -200,4 +200,11 @@ impl<C, M, S: ?Sized> Ethcore for EthcoreClient<C, M, S> where M: MinerService +
Some(ref queue) => to_value(&queue.len()),
}
}

fn pending_transactions(&self, params: Params) -> Result<Value, Error> {
try!(self.active());
try!(expect_no_params(params));

to_value(&take_weak!(self.miner).all_transactions().into_iter().map(Into::into).collect::<Vec<Transaction>>())
}
}
15 changes: 15 additions & 0 deletions rpc/src/v1/tests/mocked/ethcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,18 @@ fn rpc_ethcore_unsigned_transactions_count_when_signer_disabled() {

assert_eq!(io.handle_request(request), Some(response.to_owned()));
}

#[test]
fn rpc_ethcore_pending_transactions() {
let miner = miner_service();
let client = client_service();
let sync = sync_provider();
let net = network_service();
let io = IoHandler::new();
io.add_delegate(ethcore_client(&client, &miner, &sync, &net).to_delegate());

let request = r#"{"jsonrpc": "2.0", "method": "ethcore_pendingTransactions", "params":[], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":[],"id":1}"#;

assert_eq!(io.handle_request(request), Some(response.to_owned()));
}
4 changes: 4 additions & 0 deletions rpc/src/v1/traits/ethcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
/// Returns the value of the registrar for this network.
fn registry_address(&self, _: Params) -> Result<Value, Error>;

/// Returns all transactions in transaction queue.
fn pending_transactions(&self, _: Params) -> Result<Value, Error>;

/// Should be used to convert object to io delegate.
fn to_delegate(self) -> IoDelegate<Self> {
let mut delegate = IoDelegate::new(Arc::new(self));
Expand All @@ -90,6 +93,7 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
delegate.add_method("ethcore_gasPriceStatistics", Ethcore::gas_price_statistics);
delegate.add_method("ethcore_unsignedTransactionsCount", Ethcore::unsigned_transactions_count);
delegate.add_method("ethcore_registryAddress", Ethcore::registry_address);
delegate.add_method("ethcore_pendingTransactions", Ethcore::pending_transactions);
delegate
}
}
4 changes: 3 additions & 1 deletion util/src/rlp/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ pub enum FromBytesError {
DataIsTooLong,
/// Integer-representation is non-canonically prefixed with zero byte(s).
ZeroPrefixedInt,
/// String representation is not utf-8
InvalidUtf8,
}

impl StdError for FromBytesError {
Expand All @@ -199,7 +201,7 @@ pub trait FromBytes: Sized {

impl FromBytes for String {
fn from_bytes(bytes: &[u8]) -> FromBytesResult<String> {
Ok(::std::str::from_utf8(bytes).unwrap().to_owned())
::std::str::from_utf8(bytes).map(|s| s.to_owned()).map_err(|_| FromBytesError::InvalidUtf8)
}
}

Expand Down

0 comments on commit d4312d1

Please sign in to comment.