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

build contract staking indexer only when staking protocol enabled #3886

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chainservice/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ func (builder *Builder) buildSGDRegistry(forTest bool) error {
}

func (builder *Builder) buildContractStakingIndexer(forTest bool) error {
if !builder.cfg.Chain.EnableStakingProtocol {
Copy link
Member

Choose a reason for hiding this comment

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

will contractStakingIndexer be nil when enabled?

Copy link
Member

@dustinxie dustinxie Aug 1, 2023

Choose a reason for hiding this comment

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

in theory it could be, if cfg.Genesis.SystemStakingContractAddress == "" in the config
in prod, the contract address is valid, and contractStakingIndexer will be created

Copy link
Member

Choose a reason for hiding this comment

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

should ContractStakingIndexer be built when cfg.Genesis.SystemStakingContractAddress == ""

Copy link
Member

@dustinxie dustinxie Aug 1, 2023

Choose a reason for hiding this comment

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

no, in that case, means SystemStaking (IIP-13) is not enabled on the chain, no need to build the indexer

return nil
}
if builder.cs.contractStakingIndexer != nil {
return nil
}
Expand Down