Skip to content

Commit

Permalink
Change dependency to tendermint master (informalsystems#790)
Browse files Browse the repository at this point in the history
* Change dependency to tendermint master

* Fix unit tests

* Add websocket_addr config option for WebSocket endpoint

* Change type of grpc_addr config option to tendermint_rpc::Url

* CI fix

Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
ancazamfir and romac authored Apr 1, 2021
1 parent ac9abf8 commit 8634265
Show file tree
Hide file tree
Showing 20 changed files with 590 additions and 161 deletions.
442 changes: 432 additions & 10 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ exclude = [
"proto-compiler"
]

# [patch.crates-io]
# tendermint = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
# tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
# tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
# tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
# tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
[patch.crates-io]
tendermint = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs", branch = "master" }
8 changes: 4 additions & 4 deletions ci/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ hermes -c "$CONFIG_PATH" keys add "$CHAIN_B" key_seed_"$CHAIN_B".json
echo "-----------------------------------------------------------------------------------------------------------------"
echo "Set the primary peers for clients on each chain "
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_A="hermes -c $CONFIG_PATH light add tcp://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME -p -y -f"
LIGHT_ADD_CHAIN_A="hermes -c $CONFIG_PATH light add http://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME -p -y -f"
echo "Executing: $LIGHT_ADD_CHAIN_A"
bash -c "$LIGHT_ADD_CHAIN_A"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_B="hermes -c $CONFIG_PATH light add tcp://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME -p -y -f"
LIGHT_ADD_CHAIN_B="hermes -c $CONFIG_PATH light add http://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME -p -y -f"
echo "Executing: $LIGHT_ADD_CHAIN_B"
bash -c "$LIGHT_ADD_CHAIN_B"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
echo "Set the secondary peers for clients on each chain "
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_A_PEER="hermes -c $CONFIG_PATH light add tcp://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME --peer-id 17D46D8C1576A79203A6733F63B2C9B7235DD559 -y"
LIGHT_ADD_CHAIN_A_PEER="hermes -c $CONFIG_PATH light add http://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME --peer-id 17D46D8C1576A79203A6733F63B2C9B7235DD559 -y"
echo "Executing: $LIGHT_ADD_CHAIN_A_PEER"
bash -c "$LIGHT_ADD_CHAIN_A_PEER"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_B_PEER="hermes -c $CONFIG_PATH light add tcp://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME --peer-id A885BB3D3DFF6101188B462466AE926E7A6CD51E -y"
LIGHT_ADD_CHAIN_B_PEER="hermes -c $CONFIG_PATH light add http://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME --peer-id A885BB3D3DFF6101188B462466AE926E7A6CD51E -y"
echo "Executing: $LIGHT_ADD_CHAIN_B_PEER"
bash -c "$LIGHT_ADD_CHAIN_B_PEER"
sleep 2
Expand Down
20 changes: 11 additions & 9 deletions ci/simple_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@ log_level = 'info'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://ibc-0:26657'
grpc_addr = 'tcp://ibc-0:9090'
rpc_addr = 'http://ibc-0:26657'
grpc_addr = 'http://ibc-0:9090'
websocket_addr = 'ws://ibc-0:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
gas = 200000
clock_drift = '5s'
trusting_period = '14days'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://ibc-1:26657'
grpc_addr = 'tcp://ibc-1:9090'
rpc_addr = 'http://ibc-1:26657'
grpc_addr = 'http://ibc-1:9090'
websocket_addr = 'ws://ibc-1:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
gas = 200000
clock_drift = '5s'
trusting_period = '14days'
trusting_period = '14days'
14 changes: 8 additions & 6 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ log_level = 'error'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand All @@ -22,14 +23,15 @@ denominator = '3'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
rpc_addr = 'http://127.0.0.1:26557'
grpc_addr = 'http://127.0.0.1:9091'
websocket_addr = 'ws://127.0.0.1:26557/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 1000
fee_denom = 'stake'
fee_amount = 1000
clock_drift = '5s'
trusting_period = '14days'

Expand Down
6 changes: 4 additions & 2 deletions config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ log_level = 'error'
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
websocket_addr = 'ws://localhost:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand All @@ -24,12 +25,13 @@ denominator = '3'
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
websocket_addr = 'ws://localhost:26557/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-002-ibc-relayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub struct GlobalConfig {

pub struct ChainConfig {
pub id: ChainId,
pub rpc_addr: net::Address,
pub rpc_addr: tendermint_rpc::Url,
pub account_prefix: String,
pub key_name: String,
pub client_ids: Vec<String>,
Expand Down
28 changes: 14 additions & 14 deletions guide/src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ A `chains` section includes parameters related to a chain and the full node to w

* __gas__: Specify the maximum amount of gas to be used as the gas limit for a transaction. Default value is `300000`

* __fee_amount__: Specify the amount value to be used in the fee for a transaction. Default value is `1000`

* __fee_denom__: Specify the denom to be used in the fee for a transaction.

* __fee_amount__: Specify the amount value to be used in the fee for a transaction. Default value is `1000`

* __clock_drift__: Specify the maximum amount of time to tolerate a clock drift. The clock drift parameter defines how much new (untrusted) header's Time can drift into the future. Default value is `5s`

* __trusting_period__: Specify the amount of time to be used as the trusting period. It should be significantly less than the unbonding period (e.g. unbonding period = 3 weeks, trusting period = 2 weeks). Default value is `14days` (336 hours)
Expand All @@ -76,8 +76,8 @@ For example if you want to add a configuration for a chain named `ibc-0`:
```toml
[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand Down Expand Up @@ -106,14 +106,14 @@ log_level = 'error'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand All @@ -126,7 +126,7 @@ primary = '66E3B7083DF9DD1FC57A611929BF4C505E34AA88'

[[chains.peers.light_clients]]
peer_id = '66E3B7083DF9DD1FC57A611929BF4C505E34AA88'
address = 'tcp://localhost:26657'
address = 'http://127.0.0.1:26657'
timeout = '10s'
trusted_header_hash = 'A24F654188BC3FC9EFE589FB33D513CE9AC86BFA48B063BDBF1D769750713E09'
trusted_height = '15'
Expand All @@ -137,7 +137,7 @@ path = '/ibc-rs/data/ibc-0/data/66E3B7083DF9DD1FC57A611929BF4C505E34AA88'

[[chains.peers.light_clients]]
peer_id = '2427F8D914A6862279B3326FA64F76E3BC06DB2E'
address = 'tcp://localhost:26657'
address = 'http://127.0.0.1:26657'
timeout = '10s'
trusted_header_hash = '44E7C90BFA53256AD72B84286BFDA70FE87BBC7C0D80A1DB199C72A4FBE88FB6'
trusted_height = '16'
Expand All @@ -148,14 +148,14 @@ path = '/ibc-rs/data/ibc-0/data/2427F8D914A6862279B3326FA64F76E3BC06DB2E'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
rpc_addr = 'http://127.0.0.1:26557'
grpc_addr = 'http://127.0.0.1:9091'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand All @@ -168,7 +168,7 @@ primary = '28ED8856CBACA85DA866AB99F50DB22A58DA35F4'

[[chains.peers.light_clients]]
peer_id = '28ED8856CBACA85DA866AB99F50DB22A58DA35F4'
address = 'tcp://localhost:26557'
address = 'http://127.0.0.1:26557'
timeout = '10s'
trusted_header_hash = '66BD0E5ED1FA2022A036782F7D8444DB98DC0326B379BCA6BA75864295D1C910'
trusted_height = '4'
Expand All @@ -179,7 +179,7 @@ path = '/ibc-rs/data/ibc-1/data/28ED8856CBACA85DA866AB99F50DB22A58DA35F4'

[[chains.peers.light_clients]]
peer_id = 'A885BB3D3DFF6101188B462466AE926E7A6CD51E'
address = 'tcp://localhost:26557'
address = 'http://127.0.0.1:26557'
timeout = '10s'
trusted_header_hash = '0325BFAA36407D1F11966AEC57D34131CB27B370D3698F284F09152ADE3423C4'
trusted_height = '5'
Expand Down
4 changes: 2 additions & 2 deletions guide/src/local_chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand All @@ -55,8 +55,8 @@ account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 3000000
fee_amount = 10
fee_denom = 'stake'
fee_amount = 10
clock_drift = '5s'
trusting_period = '14days'

Expand Down
10 changes: 5 additions & 5 deletions relayer-cli/src/commands/light/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use ibc_relayer::{
config::{Config, LightClientConfig, PeersConfig},
util::block_on,
};
use tendermint::block::Height;
use tendermint::hash::Hash;
use tendermint::{block::Height, net};
use tendermint_light_client::types::PeerId;
use tendermint_rpc::{Client, HttpClient};

Expand All @@ -20,7 +20,7 @@ use crate::prelude::*;
pub struct AddCmd {
/// RPC network address (required)
#[options(free)]
address: Option<net::Address>,
address: Option<tendermint_rpc::Url>,

/// identifier of the chain (required)
#[options(short = "c")]
Expand Down Expand Up @@ -77,7 +77,7 @@ struct AddOptions {
chain_id: ChainId,

/// RPC network address
address: net::Address,
address: tendermint_rpc::Url,

/// whether this is the primary peer or not
primary: bool,
Expand Down Expand Up @@ -136,7 +136,7 @@ impl AddOptions {
#[derive(Debug, Clone)]
pub struct NodeStatus {
chain_id: ChainId,
address: net::Address,
address: tendermint_rpc::Url,
peer_id: PeerId,
hash: Hash,
height: Height,
Expand Down Expand Up @@ -183,7 +183,7 @@ fn add(mut config: Config, options: AddOptions) -> Result<(), BoxError> {
Ok(())
}

fn fetch_status(chain_id: ChainId, address: net::Address) -> Result<NodeStatus, BoxError> {
fn fetch_status(chain_id: ChainId, address: tendermint_rpc::Url) -> Result<NodeStatus, BoxError> {
let rpc_client = HttpClient::new(address.clone())?;
let response = block_on(rpc_client.status())?;

Expand Down
5 changes: 3 additions & 2 deletions relayer-cli/src/commands/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ fn subscribe(
chain_config: ChainConfig,
rt: Arc<TokioRuntime>,
) -> Result<(EventMonitor, channel::Receiver<EventBatch>), BoxError> {
let (mut event_monitor, rx) = EventMonitor::new(chain_config.id, chain_config.rpc_addr, rt)
.map_err(|e| format!("couldn't initialize event monitor: {}", e))?;
let (mut event_monitor, rx) =
EventMonitor::new(chain_config.id, chain_config.websocket_addr, rt)
.map_err(|e| format!("couldn't initialize event monitor: {}", e))?;

event_monitor
.subscribe()
Expand Down
14 changes: 8 additions & 6 deletions relayer-cli/tests/fixtures/two_chains.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ log_level = 'error' # valid options: 'error', 'warn', 'info', 'debug', 'trace'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand All @@ -28,7 +29,7 @@ primary = 'E0DE6C540C65FC9059660A7A8535F70048A94539'

[[chains.peers.light_clients]]
peer_id = 'E0DE6C540C65FC9059660A7A8535F70048A94539'
address = 'tcp://localhost:26657'
address = 'http://127.0.0.1:26657'
trusted_header_hash = '169F8F6318B8FAABDBA128AD1689E238566B69DDBD2B36F1911C0DFCA73FD401'
trusted_height = '7806'

Expand All @@ -37,8 +38,9 @@ type = 'memory'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand All @@ -56,7 +58,7 @@ primary = '356DB878F398BA707DBE69950067C8E6471D8948'

[[chains.peers.light_clients]]
peer_id = '356DB878F398BA707DBE69950067C8E6471D8948'
address = 'tcp://localhost:26557'
address = 'http://127.0.0.1:26557'
trusted_header_hash = 'CC291E79B2E2068984EB13BBF420B4F4AE95357E25B9BA0A30CA26FF27AF3C75'
trusted_height = '7741'

Expand Down
Loading

0 comments on commit 8634265

Please sign in to comment.