Skip to content

Commit

Permalink
Comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Oct 31, 2022
1 parent a298d0e commit 4b02a07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
25 changes: 10 additions & 15 deletions consensus/polybft/consensus_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,26 +276,21 @@ func (c *consensusRuntime) FSM() (*fsm, error) {
return nil, err
}

eventRoot, err := c.getExitEventRootHash(epoch.Number)
if err != nil {
return nil, err
}

pendingBlockNumber := c.getPendingBlockNumber()
isEndOfSprint := c.isEndOfSprint(pendingBlockNumber)
isEndOfEpoch := c.isEndOfEpoch(pendingBlockNumber)

ff := &fsm{
config: c.config.PolyBFTConfig,
parent: parent,
backend: c.config.blockchain,
polybftBackend: c.config.polybftBackend,
blockBuilder: blockBuilder,
validators: newValidatorSet(types.BytesToAddress(parent.Miner), epoch.Validators),
isEndOfEpoch: isEndOfEpoch,
isEndOfSprint: isEndOfSprint,
eventRoot: eventRoot,
logger: c.logger.Named("fsm"),
config: c.config.PolyBFTConfig,
parent: parent,
backend: c.config.blockchain,
polybftBackend: c.config.polybftBackend,
blockBuilder: blockBuilder,
validators: newValidatorSet(types.BytesToAddress(parent.Miner), epoch.Validators),
isEndOfEpoch: isEndOfEpoch,
isEndOfSprint: isEndOfSprint,
generateEventRoot: c.getExitEventRootHash,
logger: c.logger.Named("fsm"),
}

if c.IsBridgeEnabled() {
Expand Down
4 changes: 3 additions & 1 deletion consensus/polybft/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type fsm struct {
stateSyncExecutionIndex uint64

// eventRoot is the root hash of exit event tree
eventRoot types.Hash
generateEventRoot func(epoch uint64) (types.Hash, error)

logger hcf.Logger // The logger object
}
Expand Down Expand Up @@ -161,6 +161,8 @@ func (f *fsm) BuildProposal() (*pbft.Proposal, error) {
headerTime = time.Now()
}

// TODO - Here we will call f.generateEventRootFunc(epoch) to get the exit root after adding transactions

stateBlock, err := f.blockBuilder.Build(func(h *types.Header) {
h.Timestamp = uint64(headerTime.Unix())
h.ExtraData = append(make([]byte, signer.IstanbulExtraVanity), extra.MarshalRLPTo(nil)...)
Expand Down

0 comments on commit 4b02a07

Please sign in to comment.