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

chore: QueryFinalityProviderHasPower returns false if there is no public randomness #150

Merged
merged 4 commits into from
Nov 23, 2024

Conversation

lesterli
Copy link

@lesterli lesterli commented Nov 22, 2024

Summary

This PR updates the function QueryFinalityProviderHasPower, it will return false if there is no public randomness at the queried height.

More content: #115 (comment)

Test Plan

open the debug log in op_test_manager.go, line 74: zapcore.InfoLevel -> zapcore.DebugLevel, and then run e2e test:

make test-e2e-op-filter FILTER=TestOpFpNoVotingPower

once it is done, it should have some debug logs, like this but the value of fp pk is different:

    utils.go:100: Public randomness for fp 9ff0d9db0a73b7d4b3aa19b0b6c7f56ec4089ea22194a6b5019f021b8d342487 is successfully committed at height 64
2024-11-22T11:08:30.761+0800    DEBUG   opstackl2/consumer.go:285       FP last committed public randomness     {"height": 64}
2024-11-22T11:08:30.761+0800    DEBUG   opstackl2/consumer.go:290       FP has 0 voting power because there is no public randomness at this height      {"height": 65}

2024-11-22T11:08:31.772+0800    DEBUG   opstackl2/consumer.go:285       FP last committed public randomness     {"height": 64}
2024-11-22T11:08:31.774+0800    DEBUG   opstackl2/consumer.go:326       FP has 0 voting power because there is no BTC delegation        {"fp_btc_pk": "9ff0d9db0a73b7d4b3aa19b0b6c7f56ec4089ea22194a6b5019f021b8d342487", "height": 1}
2024-11-22T11:08:31.774+0800    DEBUG   service/fp_instance.go:474      the finality-provider does not have voting power        {"pk": "9ff0d9db0a73b7d4b3aa19b0b6c7f56ec4089ea22194a6b5019f021b8d342487", "block_height": 1}

Note: For the op e2e test, there is a working branch test/fix-fg-circular-dependency-e2e-tests

}

// fp has 0 voting power if there is no public randomness at this height
lastCommittedPubRandHeight := pubRand.StartHeight + pubRand.NumPubRand - 1
Copy link
Member

Choose a reason for hiding this comment

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

Nit: pubRand.StartHeight + pubRand.NumPubRand - 1 can be a function EndHeight() under pubRand

"FP last committed public randomness",
zap.Uint64("height", lastCommittedPubRandHeight),
)
if blockHeight > lastCommittedPubRandHeight {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is good but there is another case that this check won't cover

what if pubrand is not consecutive? so block 1-100 and 300-400 has PRs. if blockHeight is 200, lastCommittedPubRandHeight will be 400 and it should be considered not having VP

but this check doesn't cover it

Copy link
Member

Choose a reason for hiding this comment

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

Good point as Babylon allows gaps. Better to add a TODO here.

Also, currently BTC-timestamping is not involved, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it doesn't need to be in this PR. we can add a TODO

no currently BTC ts is not involved

go.mod Outdated
Comment on lines 449 to 456
// fix for `make build` error: invalid CFI advance_loc expression
github.com/supranational/blst => github.com/supranational/blst v0.3.13
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

// avoid v1.66 that has a breaking change for protobuf. That change breaks the relayer.
// https://github.com/grpc/grpc-go/issues/7569
google.golang.org/grpc => google.golang.org/grpc v1.65.0
// fix for `go mod tidy` error: unknown revision v1.8.6
nhooyr.io/websocket => github.com/coder/websocket v1.8.7
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, why previous CI run never detect these?

Copy link
Author

@lesterli lesterli Nov 23, 2024

Choose a reason for hiding this comment

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

yes, i tested on a new server with ubuntu 22.04, and it works fine.

for go mod tidy, i saw it automatically selects the appropriate version on this new server

go: downloading nhooyr.io/websocket v1.8.17

for make build, the error "invalid CFI advance_loc expression" only occurs on x86 macOS using LLVM 17

so i will revert these changes.

@lesterli lesterli merged commit dbc246f into base/consumer-chain-support Nov 23, 2024
12 checks passed
@lesterli lesterli deleted the chore/fp-votes branch November 23, 2024 04:07
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