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

zoneconcierge: add checkpoint info and epoch info to FinalizedChainInfo API #210

Merged
merged 4 commits into from
Nov 22, 2022

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Nov 22, 2022

Resolves https://babylon-chain.atlassian.net/wiki/spaces/BABYLON/pages/41549900/Simple+Oracle+Page+for+Demo+Purpose?focusedCommentId=41910291

This PR adds the information of the checkpoint/epoch w.r.t. the finalised header to FinalizedChainInfo. The checkpoint information is in type SubmissionKey that provides the positions of two BTC txs and is implemented in BTCCheckpoint module. The epoch information is in type Epoch and is implemented in Epoching module.

Along the way, this PR also changes the order of initialising keepers in app.go and adds some mocking functionality for testing ZoneConcierge.

@KonradStaniec Do you think #204 will be useful for this PR?

@SebastianElvis SebastianElvis changed the title zoneconcierge: add submission key to FinalizedChainInfo API zoneconcierge: add checkpoint info and epoch info to FinalizedChainInfo API Nov 22, 2022
Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

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

Looks good! In the explorer, do we want to show the height of the BTC header in which the first transaction of the checkpoint is included or the second one?


ctx := babylonChain.GetContext()
czChainID := string(datagen.GenRandomByteArray(10))
Copy link
Member

Choose a reason for hiding this comment

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

What's the expected size of the chain id? We can have this a random string in the range of [1,50] for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

Normally ~10bytes. Randomised the length then.

@SebastianElvis SebastianElvis merged commit 42ae67b into dev Nov 22, 2022
@SebastianElvis SebastianElvis deleted the zoneconcierge-api-fixes branch November 22, 2022 08:29
@SebastianElvis SebastianElvis mentioned this pull request Nov 22, 2022
err := fmt.Errorf("finalized epoch %d should have at least 1 checkpoint submission", finalizedEpoch)
panic(err)
}
bestSubmissionKey := ed.Key[0]
Copy link
Collaborator

@KonradStaniec KonradStaniec Nov 22, 2022

Choose a reason for hiding this comment

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

just fyi without #204, this will not necessarily return best submission key (i.e the deepest one) but it will return the submission which was first subbmitted to babylon. (cc @SebastianElvis )

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. I merged this PR due to the time constraint. Will simplify this part based on #204 in the future 👍

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.

3 participants