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

tests: tallying and block finalization #446

Merged
merged 25 commits into from
Jul 5, 2024

Conversation

gusin13
Copy link
Collaborator

@gusin13 gusin13 commented Jun 28, 2024

This pr adds necessary assertions and code needed to make sure tallying and block finalization works

  1. Inserts contract addresses in genesis (when bcd chain start, this is a hack ideally this would happen by gov proposal)
  2. In the end check if the latest comet height is finalized (because tallying should work now)
  3. Also changes the order of tests, this is in sync with this comment
    https://github.com/babylonchain/babylon-deployment/pull/99#issuecomment-2193909123

@gusin13 gusin13 marked this pull request as ready for review June 28, 2024 17:20
Copy link
Member

@SebastianElvis SebastianElvis left a comment

Choose a reason for hiding this comment

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

The code lgtm. Somehow the e2e test failed though.

--- FAIL: TestConsumerFpLifecycle (0.02s)
    babylon_node_handler.go:145: 
                Error Trace:    /home/circleci/project/itest/babylon_node_handler.go:145
                                                        /home/circleci/project/itest/cosmwasm/bcd/bcd_test_manager.go:66
                                                        /home/circleci/project/itest/cosmwasm/bcd/bcd_consumer_e2e_test.go:32
                Error:          Received unexpected error:
                                exec: "babylond": executable file not found in $PATH
                Test:           TestConsumerFpLifecycle
FAIL
FAIL    github.com/babylonchain/finality-provider/itest/cosmwasm/bcd    0.226s
ok      github.com/babylonchain/finality-provider/keyring       0.964s
FAIL

maybe somehow babylond is not installed?

itest/cosmwasm/bcd/bcd_handler.go Show resolved Hide resolved
Copy link
Contributor

@maurolacy maurolacy left a comment

Choose a reason for hiding this comment

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

Just some comments. Can work in a follow-up with some fixes if you want.

go.mod Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's tag v0.7.1 or so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i intend to use a newer commit than the tagged one, maybe once we have the next release in babylon-contract i'll bump the version here as well

@@ -37,6 +37,7 @@ func NewBcdNodeHandler(t *testing.T) *BcdNodeHandler {

setupBcd(t, testDir)
Copy link
Contributor

@maurolacy maurolacy Jul 1, 2024

Choose a reason for hiding this comment

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

This requires that bcd is built and installed. Let's use a submodule for it, along with a commit / tag reference, and add the build instructions to the test and test-e2e targets.

For the test-e2e test targets, perhaps a series of docker images is better. But I think this is OK for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This requires that bcd is built and installed

bcd command is installed using make target then later the node is started using bcd cli

Let's use a submodule for it, along with a commit / tag reference, and add the build instructions to the test and test-e2e targets.

not sure if i got this properly, can you elaborate how would a submodule be used here? Docker image is a good idea similar to the way tests are done in babylon repo, but this requires major refactoring

Copy link
Contributor

@maurolacy maurolacy Jul 4, 2024

Choose a reason for hiding this comment

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

I mean, similar to how babylon-deployment works. But instead of compiling a docker image using the build-docker target in the sub-module, you just issue make build && make install.

Not sure this is the right approach / place to do this though. Perhaps these tests, which are a kind of integration / e2e test, should live in the babylon-deployment repo instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

have opened a issue to track this probably will be done in a separate pr
#477

@maurolacy
Copy link
Contributor

Tests are broken atm. Contracts seems to be deployed into the wrong chain (Babylon chain instead of bcd Consumer chain).

@gusin13
Copy link
Collaborator Author

gusin13 commented Jul 4, 2024

Tests are broken atm. Contracts seems to be deployed into the wrong chain (Babylon chain instead of bcd Consumer chain).

contract is deployed on bcd ref, the problem seems to be something else. The bcd cmd package is not being installed properly in ci jobs, if I run the tests locally they are passing. On my local I manually install the bcd by cloning babylon-sdk and then make install the tests pass, but if i use go install github.com/babylonchain/babylon-sdk/demo/cmd/bcd then it errors out not sure why this is happening.

If the package is install using go install (like its done in ci jobs), then

gusin@Gurjots-MacBook-Pro bin % bcd version

if its done manually using make install (by cloning babylon-sdk and cd babylon-sdk then make install)

gusin@Gurjots-MacBook-Pro bin % bcd version
v0.2.0-rc.1

trying to debug why this is happening

@bap2pecs
Copy link
Contributor

bap2pecs commented Jul 5, 2024

@gusin13 op tests failed likely due to rate limiting querying BTC mainnet RPCs. we fixed it already to mock the RPC client. after you rebase, it should be fixed

@gusin13 gusin13 merged commit fb9405a into base/consumer-chain-support Jul 5, 2024
7 checks passed
@gusin13 gusin13 deleted the gusin13/tallying-works branch July 5, 2024 20:36
gusin13 added a commit that referenced this pull request Jul 9, 2024
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.

4 participants