depolymerization

wire gateway for Bitcoin/Ethereum
Log | Files | Refs | Submodules | README | LICENSE

commit ddd627b080c3656c3ef8e4e4720e0d3d6e6cdb94
parent f83ecda42ee694ade4e5f4e16ce019d92b3754f4
Author: Antoine A <>
Date:   Mon, 28 Feb 2022 18:40:03 +0100

eth-wire: catch rpc EOF

Diffstat:
MCargo.lock | 4++--
Meth-wire/src/rpc.rs | 6+++++-
Mtest/common.sh | 3+--
Mtest/eth/analysis.sh | 2+-
Mtest/eth/maxfee.sh | 6++++--
5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -2190,6 +2190,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c88870063c39ee00ec285a2f8d6a966e5b6fb2becc4e8dac77ed0d370ed6006" +checksum = "50344758e2f40e3a1fcfc8f6f91aa57b5f8ebd8d27919fe6451f15aaaf9ee608" diff --git a/eth-wire/src/rpc.rs b/eth-wire/src/rpc.rs @@ -147,6 +147,10 @@ impl Rpc { self.read_buf.resize(self.cursor * 2, 0); } match self.conn.get_mut().read(&mut self.read_buf[self.cursor..]) { + Ok(0) => Err(std::io::Error::new( + ErrorKind::UnexpectedEof, + "RPC EOF".to_string(), + ))?, Ok(nb) => { self.cursor += nb; let mut de: serde_json::StreamDeserializer<_, T> = @@ -251,7 +255,7 @@ impl Rpc { } pub fn miner_start(&mut self) -> Result<()> { - match self.call("miner_start", &[1]) { + match self.call("miner_start", &[8]) { Err(Error::Null) => Ok(()), i => i, } diff --git a/test/common.sh b/test/common.sh @@ -287,14 +287,13 @@ function init_eth2() { # Disconnect the two nodes function eth_deco() { $WIRE_UTILS disconnect $WIRE_DIR2 - $WIRE_UTILS2 disconnect $WIRE_DIR } # Create a fork on the second node and reconnect the two node function eth_fork() { + sleep 5 # Sync before fork $WIRE_UTILS2 mine $RESERVE ${1:-} $WIRE_UTILS connect $WIRE_DIR2 - $WIRE_UTILS2 connect $WIRE_DIR sleep 10 # Can take soooooo long for nodes to sync } diff --git a/test/eth/analysis.sh b/test/eth/analysis.sh @@ -55,7 +55,7 @@ echo " OK" echo -n "Perform fork and check eth-wire learned from previous attack:" gateway_up -eth_fork 6 +eth_fork 10 check_balance_eth 999580000 420000 gateway_up echo " OK" diff --git a/test/eth/maxfee.sh b/test/eth/maxfee.sh @@ -7,7 +7,7 @@ set -eu source "${BASH_SOURCE%/*}/../common.sh" CONFIG=taler_eth.conf -echo "----- Setup -----" +echo "----- Setup -----" echo "Load config file" load_config echo "Start ethereum node" @@ -57,7 +57,9 @@ restart_eth --miner.gasprice 0 echo "OK" echo -n "Check transaction have been made: " -#check_balance_eth 999851500 148500 TODO recover from bas fees +sleep 5 +mine_eth # Mine transactions +check_balance_eth 999851500 148500 echo "OK" echo "All tests passed!" \ No newline at end of file