Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@ func ParseStateScheme(ctx *cli.Context, disk ethdb.Database) (string, error) {
// If state scheme is specified, ensure it's compatible with
// persistent state.
scheme := ctx.String(StateSchemeFlag.Name)
if stored != "" || scheme == stored {
if stored == "" || scheme == stored {
log.Info("State scheme set by user", "scheme", scheme)
return scheme, nil
}
Expand Down
10 changes: 7 additions & 3 deletions consensus/consortium/v1/consortium.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,13 @@ func (c *Consortium) verifyCascadingFields(chain consensus.ChainHeaderReader, he
func (c *Consortium) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
// Search for a snapshot in memory or on disk for checkpoints
var (
headers []*types.Header
snap *Snapshot
headers []*types.Header
snap *Snapshot
cpyParents = make([]*types.Header, len(parents))
)
// We must copy parents before going to the loop because parents are modified.
// If not, the FindAncientHeader function can not find its block ancestor
copy(cpyParents, parents)
for snap == nil {
// If an in-memory snapshot was found, use that
if s, ok := c.recents.Get(hash); ok {
Expand Down Expand Up @@ -370,7 +374,7 @@ func (c *Consortium) snapshot(chain consensus.ChainHeaderReader, number uint64,
for i := 0; i < len(headers)/2; i++ {
headers[i], headers[len(headers)-1-i] = headers[len(headers)-1-i], headers[i]
}
snap, err := snap.apply(chain, c, headers, parents)
snap, err := snap.apply(chain, c, headers, cpyParents)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/ancient_scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var (
)

// freezers the collections of all builtin freezers.
var freezers = []string{chainFreezerName}
var freezers = []string{chainFreezerName, stateFreezerName}

// NewStateFreezer initializes the freezer for state history.
func NewStateFreezer(ancientDir string, readOnly bool) (*ResettableFreezer, error) {
Expand Down
22 changes: 15 additions & 7 deletions docker/chainnode/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ params=""
syncmode="snap"
mine="true"
blsParams=""
state_scheme="hash"

set -e

Expand All @@ -48,6 +49,11 @@ if [[ ! -z $WS_PORT ]]; then
ws_port="$WS_PORT"
fi

if [[ ! -z $STATE_SCHEME ]]; then
state_scheme="$STATE_SCHEME"
fi


# networkid
if [[ ! -z $NETWORK_ID ]]; then
case $NETWORK_ID in
Expand Down Expand Up @@ -78,15 +84,14 @@ fi

# data dir
if [[ ! -d $datadir/ronin ]]; then
echo "No blockchain data, creating genesis block."
ronin init $dbEngine --datadir $datadir $genesisPath 2> /dev/null
echo "No blockchain data, creating genesis block with $genesisPath, state_scheme $state_scheme ..."
ronin init $dbEngine --datadir $datadir --state.scheme $state_scheme $genesisPath $genesisPath
elif [[ "$FORCE_INIT" = "true" && "$INIT_FORCE_OVERRIDE_CHAIN_CONFIG" = "true" ]]; then
echo "Forcing update chain config with force overriding chain config."
ronin init $dbEngine --overrideChainConfig --datadir $datadir $genesisPath 2> /dev/null
echo "Forcing update chain config with force overriding chain config with $genesisPath, state_scheme $state_scheme ..."
ronin init $dbEngine --overrideChainConfig --datadir $datadir --state.scheme $state_scheme $genesisPath
elif [ "$FORCE_INIT" = "true" ]; then
echo "Forcing update chain config."
ronin init $dbEngine --datadir $datadir $genesisPath 2> /dev/null
fi
echo "Forcing update chain config with $genesisPath, state_scheme $state_scheme ..."
ronin init $dbEngine --datadir $datadir --state.scheme $state_scheme $genesisPath

# password file
if [[ ! -f $PASSWORD_FILE ]]; then
Expand Down Expand Up @@ -333,6 +338,9 @@ if [[ "$BLS_SHOW_PRIVATE_KEY" = "true" ]]; then
--finality.blswalletpath $BLS_PRIVATE_KEY_DIR \
--secret
fi
echo "---------------------------------"
echo "Starting the Ronin Node"
echo "---------------------------------"

exec ronin $params \
--syncmode $syncmode \
Expand Down
5 changes: 3 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}
)
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, config.OverrideArrowGlacier, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory)
chainConfig := eth.blockchain.Config()
genesisHash := eth.blockchain.Genesis().Hash()
if err != nil {
return nil, err
}
chainConfig := eth.blockchain.Config()
genesisHash := eth.blockchain.Genesis().Hash()

if config.EnableMonitorDoubleSign {
go eth.blockchain.StartDoubleSignMonitor()
}
Expand Down
Loading