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

[blockchain] set default config values for blob storage #4411

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
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
22 changes: 14 additions & 8 deletions blockchain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ import (
type (
// Config is the config struct for blockchain package
Config struct {
ChainDBPath string `yaml:"chainDBPath"`
TrieDBPatchFile string `yaml:"trieDBPatchFile"`
TrieDBPath string `yaml:"trieDBPath"`
StakingPatchDir string `yaml:"stakingPatchDir"`
IndexDBPath string `yaml:"indexDBPath"`
BloomfilterIndexDBPath string `yaml:"bloomfilterIndexDBPath"`
CandidateIndexDBPath string `yaml:"candidateIndexDBPath"`
StakingIndexDBPath string `yaml:"stakingIndexDBPath"`
ChainDBPath string `yaml:"chainDBPath"`
TrieDBPatchFile string `yaml:"trieDBPatchFile"`
TrieDBPath string `yaml:"trieDBPath"`
StakingPatchDir string `yaml:"stakingPatchDir"`
IndexDBPath string `yaml:"indexDBPath"`
BloomfilterIndexDBPath string `yaml:"bloomfilterIndexDBPath"`
CandidateIndexDBPath string `yaml:"candidateIndexDBPath"`
StakingIndexDBPath string `yaml:"stakingIndexDBPath"`
// deprecated
SGDIndexDBPath string `yaml:"sgdIndexDBPath"`
Copy link
Member Author

Choose a reason for hiding this comment

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

add back since default config.yaml on bootstrap repo has this field

ContractStakingIndexDBPath string `yaml:"contractStakingIndexDBPath"`
BlobStoreDBPath string `yaml:"blobStoreDBPath"`
BlobStoreRetentionDays uint32 `yaml:"blobStoreRetentionDays"`
Expand Down Expand Up @@ -89,7 +91,11 @@ var (
BloomfilterIndexDBPath: "/var/data/bloomfilter.index.db",
CandidateIndexDBPath: "/var/data/candidate.index.db",
StakingIndexDBPath: "/var/data/staking.index.db",
SGDIndexDBPath: "/var/data/sgd.index.db",
ContractStakingIndexDBPath: "/var/data/contractstaking.index.db",
BlobStoreDBPath: "/var/data/blob.db",
BlobStoreRetentionDays: 20,
BlobPurgeInterval: time.Hour,
Copy link
Member Author

Choose a reason for hiding this comment

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

enforce 20 days of blob storage

Copy link
Collaborator

Choose a reason for hiding this comment

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

After reviewing the implementation of blobstore, we may need to make the following two changes:

  1. Change BlobStoreRetentionDays to BlobStoreRetentionBlocks
  2. instead of deleting blobs every hour in a batch, deleting them when PutBlock is called. Because deleting in a batch may delay PutBlock and cause possible delay to the whole network.

Copy link
Member

Choose a reason for hiding this comment

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

recommend extra 1 day for enhancing robustness of blobsync, like bsc does

ID: 1,
EVMNetworkID: 4689,
Address: "",
Expand Down
4 changes: 4 additions & 0 deletions blockchain/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ type (
SystemStakingContractAddress string `yaml:"systemStakingContractAddress"`
// SystemStakingContractHeight is the height of system staking contract
SystemStakingContractHeight uint64 `yaml:"systemStakingContractHeight"`
// deprecated
SystemSGDContractAddress string `yaml:"systemSGDContractAddress"`
// deprecated
SystemSGDContractHeight uint64 `yaml:"systemSGDContractHeight"`
Copy link
Member Author

Choose a reason for hiding this comment

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

add back since default genesis.yaml on bootstrap repo has this field

// SystemStakingContractV2Address is the address of system staking contract
SystemStakingContractV2Address string `yaml:"systemStakingContractV2Address"`
// SystemStakingContractV2Height is the height of system staking contract
Expand Down
9 changes: 9 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"path/filepath"
"strings"
"testing"
"time"

"github.com/iotexproject/go-pkgs/crypto"
"github.com/pkg/errors"
Expand Down Expand Up @@ -309,6 +310,14 @@ func TestValidateActPool(t *testing.T) {
)
}

func TestBlobConfig(t *testing.T) {
r := require.New(t)
cfg := Default
blocks := uint32(time.Hour / cfg.DardanellesUpgrade.BlockInterval)
blocks *= cfg.Chain.BlobStoreRetentionDays * 24
r.EqualValues(345600, blocks)
}

func TestValidateForkHeights(t *testing.T) {
r := require.New(t)

Expand Down
Loading