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

Added genesis block of L1 contract to DAC config #63

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type L1Config struct {
Timeout types.Duration `mapstructure:"Timeout"`
RetryPeriod types.Duration `mapstructure:"RetryPeriod"`
BlockBatchSize uint `mapstructure:"BlockBatchSize"`

// GenesisBlock represents the block number where PolygonValidium contract is deployed on L1
GenesisBlock uint64 `mapstructure:"GenesisBlock"`
}

// Load loads the configuration baseed on the cli context
Expand Down
1 change: 1 addition & 0 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ DataCommitteeAddress = "0x68B1D87F95878fE05B998F19b66F4baba5De1aed"
Timeout = "1m"
RetryPeriod = "5s"
BlockBatchSize = "64"
GenesisBlock = "0"

[Log]
Environment = "development" # "production" or "development"
Expand Down
11 changes: 8 additions & 3 deletions synchronizer/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ func InitStartBlock(db db.DB, ethClientFactory types.EthClientFactory, l1 config
return err
}

startBlock, err := findContractDeploymentBlock(ctx, ethClient, common.HexToAddress(l1.PolygonValidiumAddress))
if err != nil {
return err
startBlock := new(big.Int)
if l1.GenesisBlock != 0 {
startBlock.SetUint64(l1.GenesisBlock)
} else {
startBlock, err = findContractDeploymentBlock(ctx, ethClient, common.HexToAddress(l1.PolygonValidiumAddress))
if err != nil {
return err
}
}

return setStartBlock(db, startBlock.Uint64())
Expand Down
Loading