Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts and dockerfiles to support gaia at stargate-4 version #279

Merged
merged 9 commits into from
Oct 15, 2020

Conversation

andynog
Copy link
Contributor

@andynog andynog commented Sep 30, 2020

Closes: #278

Description

Upgrade the docker images and chains to the latest stargate-4 version.


For contributor use:

  • Unit tests written
  • Added test to CI if applicable
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer

Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Andy! To actually test this we need to update the images on Docker Hub, right?

@andynog
Copy link
Contributor Author

andynog commented Oct 6, 2020

I've tested this with the updated (local) Docker images and I cannot start the relayer. I get an error that I'm not sure is related to the images.

andy@lnx-01:~/Development/github.com/informalsystems/ibc-rs$ cargo run --bin relayer -- -c ./relayer/tests/config/fixtures/relayer_conf_example.toml light init -x "5F37C73284A9460D303EEFF4797D91886761E9D7506C38A4CB5A97EF79BDCA87" -h 347 chain_A
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/relayer -c ./relayer/tests/config/fixtures/relayer_conf_example.toml light init -x 5F37C73284A9460D303EEFF4797D91886761E9D7506C38A4CB5A97EF79BDCA87 -h 347 chain_A`
     chain_A Set trusted options: hash=5F37C73284A9460D303EEFF4797D91886761E9D7506C38A4CB5A97EF79BDCA87 height=347
andy@lnx-01:~/Development/github.com/informalsystems/ibc-rs$ cargo run --bin relayer -- -c ./relayer/tests/config/fixtures/relayer_conf_example.toml light init -x "DCC609A432F98C48A268B4F631EBC7657807A0E2D41883A958B334A175CF6F97" -h 346 chain_B
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/relayer -c ./relayer/tests/config/fixtures/relayer_conf_example.toml light init -x DCC609A432F98C48A268B4F631EBC7657807A0E2D41883A958B334A175CF6F97 -h 346 chain_B`
     chain_B Set trusted options: hash=DCC609A432F98C48A268B4F631EBC7657807A0E2D41883A958B334A175CF6F97 height=346
andy@lnx-01:~/Development/github.com/informalsystems/ibc-rs$ cargo run --bin relayer -- -c ./relayer/tests/config/fixtures/relayer_conf_example.toml start --reset
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/relayer -c ./relayer/tests/config/fixtures/relayer_conf_example.toml start --reset`
Oct 06 13:52:48.747  INFO relayer_cli::commands::start: spawning light client chain.id=chain_A
     Relayer spawning light client for chain chain_A
Oct 06 13:52:48.889  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=chain_A
error: relayer-cli fatal error: I/O error: Parse error. Invalid JSON: missing field `app` at line 9 column 9 (code: -32700)

I'm going to test this with the original images to see if I get the same error, if so then something that might have been introduced in the relayer logic that might be breaking.

@andynog
Copy link
Contributor Author

andynog commented Oct 8, 2020

After tendermint-rs fix #622, the error above missing field app is not happening anymore. Now getting a hash mismatch error. Here spinning two-chains using the dev-env script from go relayer (but the same error happens using docker images). One common variable between these two environments is that they use a startgate-3 branch.

$> curl -s http://localhost:26657/status | jq '.result.sync_info|.latest_block_hash,.latest_block_height'
"73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F"
"2133"
$> cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml light init -x "73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F" -h 2133 ibc0
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/relayer -c ./relayer-cli/tests/fixtures/two_chains.toml light init -x 73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F -h 2133 ibc0`
        ibc0 Set trusted options: hash=73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F height=2133
$> curl -s http://localhost:26557/status | jq '.result.sync_info|.latest_block_hash,.latest_block_height'
"9B2B144DCCC052228B3E58171F645A1973CD7AD92ACEA69CEE5BB881453DC1FD"
"2211"
cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml light init -x "9B2B144DCCC052228B3E58171F645A1973CD7AD92ACEA69CEE5BB881453DC1FD" -h 2211 ibc1
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/relayer -c ./relayer-cli/tests/fixtures/two_chains.toml light init -x 9B2B144DCCC052228B3E58171F645A1973CD7AD92ACEA69CEE5BB881453DC1FD -h 2211 ibc1`
        ibc1 Set trusted options: hash=9B2B144DCCC052228B3E58171F645A1973CD7AD92ACEA69CEE5BB881453DC1FD height=2211
$> cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/relayer -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset`
Oct 08 17:15:59.779  INFO relayer_cli::commands::start: spawning light client chain.id=ibc0
     Relayer spawning light client for chain ibc0
Oct 08 17:15:59.930  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc0
error: relayer-cli fatal error: hash mismatch: given = 73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F, found = 1661F082AC04E73A45390636B090194932DA3660706CD24EABC3DCFA8A1BAF06

If I query the block 2133 for ibc0 chain, I get the right hash at that height 73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F

$> curl http://localhost:26657/block?height=2133
{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "block_id": {
      "hash": "73538125C2540CA1DC9DF6E28C295E46B5214D5A800D1AA6327228C62F0A526F",
      "parts": {
        "total": 1,
        "hash": "D7CE116964172EDA4829E107F02A87D6F960A8EC08DC86FF4ADB3A782D605B06"
      }
    },
...

So not sure why the relayer is spitting out a hash mismatch.

@andynog
Copy link
Contributor Author

andynog commented Oct 9, 2020

Test it again using the go relayer dev-env script after master changes (#299). Now I'm getting another error

cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/relayer -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset`
Oct 09 12:14:23.505  INFO relayer_cli::commands::start: spawning light client chain.id=ibc0
     Relayer spawning light client for chain ibc0
Oct 09 12:14:23.642  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc0
Oct 09 12:14:23.664  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc0
The application panicked (crashed).
Message:  Pre-condition of witness violated: self . primary != Some(peer_id)
Location: /home/andy/.cargo/git/checkouts/tendermint-rs-7b2e4433a0119a31/0681df8/light-client/src/peer_list.rs:202

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

@romac
Copy link
Member

romac commented Oct 9, 2020

This error means that we are setting both the primary's and witness' peer id to the same value. It stems from the fact that we don't have peer ids in the relayer config and we currently have to make one up. The issue is that we re-use it for both the primary and the witness, whereas we should at least make up two different ones until we decide on whether we want to add peer ids to the config, or get rid of them altogether.

@andynog
Copy link
Contributor Author

andynog commented Oct 9, 2020

With latest updates on this branch by @romac I could start the relayer now 😄

cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/relayer -c ./relayer-cli/tests/fixtures/two_chains.toml start --reset`
Oct 09 12:59:01.372  INFO relayer_cli::commands::start: spawning light client chain.id=ibc0
     Relayer spawning light client for chain ibc0
Oct 09 12:59:01.537  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc0
Oct 09 12:59:01.561  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc0
Oct 09 12:59:01.578  INFO relayer_cli::commands::start: spawning light client chain.id=ibc1
     Relayer spawning light client for chain ibc1
Oct 09 12:59:01.580  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc1
Oct 09 12:59:01.599  INFO relayer_cli::commands::start: resetting client to trust options state chain.id=ibc1
Oct 09 12:59:01.623  INFO relayer_cli::commands::start: spawned new client now at trusted state: B630247BD6C06FE821DF50622B59EF8744485FEFA64875F520A54FC63FBB10DC at height 14653 chain.id=ibc0
Oct 09 12:59:01.624  INFO relayer_cli::commands::start: spawned new client now at trusted state: D483740A03C67AE0E4778DD40E16C25F90A83E7031F402C7C6CF5040B93B4546 at height 14790 chain.id=ibc1
Oct 09 12:59:01.625  INFO relayer_cli::commands::start: updating client chain.id=ibc0
Oct 09 12:59:01.710  INFO relayer_cli::commands::start: client updated to trusted state: 01E117AB16BC9C451BF5AF904E99C0E6BFD38DEFA8636F25AD10BCA71F6A568E at height 14838 chain.id=ibc0
Oct 09 12:59:01.711  INFO relayer_cli::commands::start: updating client chain.id=ibc1
Oct 09 12:59:01.790  INFO relayer_cli::commands::start: client updated to trusted state: 18FFE2AE084693DC7AF1DCECD1DAAF646F3C6BB0EE5D1D839999901603B89F63 at height 14830 chain.id=ibc1
Oct 09 12:59:04.624  INFO relayer_cli::commands::start: updating client chain.id=ibc0
Oct 09 12:59:04.722  INFO relayer_cli::commands::start: client updated to trusted state: 32D89D5F6C7125A4368F1DA619E1A2332F4C4E65C68CA63559AB60F900EB3435 at height 14840 chain.id=ibc0
Oct 09 12:59:04.722  INFO relayer_cli::commands::start: updating client chain.id=ibc1
Oct 09 12:59:04.805  INFO relayer_cli::commands::start: client updated to trusted state: B006979018EBA20C1DE4B881A342D91052D6305C0AB7021CD2ECCA829B4BFEF9 at height 14833 chain.id=ibc1

@ancazamfir
Copy link
Collaborator

Since this is not closed, could we actually move to stargate-4. Our code base is currently compatible with 4 and we could use these scripts to run queries and Tx-es hopefully soon :)

* Upgrade to stargate-4

* Bug fix to return node ID
@codecov-io
Copy link

codecov-io commented Oct 15, 2020

Codecov Report

Merging #279 into master will increase coverage by 23.8%.
The diff coverage is 60.7%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #279      +/-   ##
=========================================
+ Coverage    13.6%   37.5%   +23.8%     
=========================================
  Files          69     124      +55     
  Lines        3752    7994    +4242     
  Branches     1374    2771    +1397     
=========================================
+ Hits          513    3001    +2488     
- Misses       2618    4754    +2136     
+ Partials      621     239     -382     
Impacted Files Coverage Δ
modules/src/events.rs 0.0% <0.0%> (ø)
modules/src/ics02_client/events.rs 0.0% <ø> (ø)
modules/src/ics02_client/raw.rs 0.0% <0.0%> (ø)
modules/src/ics03_connection/context.rs 0.0% <0.0%> (ø)
modules/src/ics03_connection/error.rs 16.6% <0.0%> (-16.7%) ⬇️
modules/src/ics04_channel/error.rs 75.0% <ø> (+50.0%) ⬆️
modules/src/ics04_channel/packet.rs 0.0% <0.0%> (ø)
modules/src/ics07_tendermint/client_def.rs 0.0% <0.0%> (ø)
modules/src/ics07_tendermint/error.rs 75.0% <ø> (+75.0%) ⬆️
modules/src/ics18_relayer/error.rs 0.0% <0.0%> (ø)
... and 214 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3a8384...53f65d0. Read the comment docs.

Copy link
Collaborator

@ancazamfir ancazamfir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wohooo! Thanks Andy!

@ancazamfir ancazamfir changed the title Update scripts and dockerfiles to support gaia at stargate-3 version Update scripts and dockerfiles to support gaia at stargate-4 version Oct 15, 2020
@andynog
Copy link
Contributor Author

andynog commented Oct 15, 2020

Tested docker images with gaia stargate-4 and it's working now after latest fix. Good to merge. Ran the commands (from README) to initialize light clients and start the relayer and it's working.

@andynog andynog merged commit ef84543 into master Oct 15, 2020
@greg-szabo greg-szabo deleted the andy/chains-update branch October 15, 2020 16:22
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
…nformalsystems#279)

* Update scripts and dockerfiles to support gaia at stargate-3 version

* Fixing wrong chain id informalsystems#279

* Make up two different peer ids for primary and witness

* Formatting

* Minor changes (informalsystems#279):

* Upgrade to stargate-4

* Bug fix to return node ID

* Changed folder to 'gaia' since that's the default in stargate-4 (informalsystems#279)

Co-authored-by: Romain Ruetschi <romain@informal.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update CI files to upgrade chains to Stargate-4 level
6 participants