Merge pull request #616 from hermeznetwork/fix/typos-and-lint fix some code typos
jump to
@@ -44,7 +44,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type accountResponse struct { Accounts []historydb.AccountAPI `json:"accounts"` PendingItems uint64 `json:"pendingItems"`
@@ -47,7 +47,7 @@ if err != nil {
retSQLErr(err, c) return } - // Build succesfull response + // Build successful response c.JSON(http.StatusOK, auth) }
@@ -201,7 +201,7 @@ database, err := db.InitSQLDB(5432, "localhost", "hermez", pass, "hermez")
if err != nil { panic(err) } - apiConnCon := db.NewAPICnnectionController(1, time.Second) + apiConnCon := db.NewAPIConnectionController(1, time.Second) hdb := historydb.NewHistoryDB(database, database, apiConnCon) if err != nil { panic(err)@@ -260,7 +260,7 @@
// Reset DB test.WipeDB(api.h.DB()) - // Genratre blockchain data with til + // Generate blockchain data with til tcc := til.NewContext(chainID, common.RollupConstMaxL1UserTx) tilCfgExtra := til.ConfigExtra{ BootCoordAddr: ethCommon.HexToAddress("0xE39fEc6224708f0772D2A74fd3f9055A90E0A9f2"),@@ -512,7 +512,7 @@ wdelayerVars := common.WDelayerVariables{
WithdrawalDelay: uint64(3000), } - // Generate test data, as expected to be received/sended from/to the API + // Generate test data, as expected to be received/sent from/to the API testCoords := genTestCoordinators(commonCoords) testBids := genTestBids(commonBlocks, testCoords, bids) testExits := genTestExits(commonExitTree, testTokens, commonAccounts)@@ -599,7 +599,7 @@ func TestTimeout(t *testing.T) {
pass := os.Getenv("POSTGRES_PASS") databaseTO, err := db.InitSQLDB(5432, "localhost", "hermez", pass, "hermez") require.NoError(t, err) - apiConnConTO := db.NewAPICnnectionController(1, 100*time.Millisecond) + apiConnConTO := db.NewAPIConnectionController(1, 100*time.Millisecond) hdbTO := historydb.NewHistoryDB(databaseTO, databaseTO, apiConnConTO) require.NoError(t, err) // L2DB
@@ -52,7 +52,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type batchesResponse struct { Batches []historydb.BatchAPI `json:"batches"` PendingItems uint64 `json:"pendingItems"`
@@ -34,7 +34,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type bidsResponse struct { Bids []historydb.BidAPI `json:"bids"` PendingItems uint64 `json:"pendingItems"`
@@ -32,7 +32,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type coordinatorsResponse struct { Coordinators []historydb.CoordinatorAPI `json:"coordinators"` PendingItems uint64 `json:"pendingItems"`
@@ -43,7 +43,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type exitsResponse struct { Exits []historydb.ExitAPI `json:"exits"` PendingItems uint64 `json:"pendingItems"`@@ -72,6 +72,6 @@ if err != nil {
retSQLErr(err, c) return } - // Build succesfull response + // Build successful response c.JSON(http.StatusOK, exit) }
@@ -14,7 +14,7 @@ "github.com/russross/meddler"
) const ( - // maxLimit is the max permited items to be returned in paginated responses + // maxLimit is the max permitted items to be returned in paginated responses maxLimit uint = 2049 // dfltOrder indicates how paginated endpoints are ordered if not specified@@ -40,8 +40,8 @@ errCtxTimeout = "context deadline exceeded"
) var ( - // ErrNillBidderAddr is used when a nil bidderAddr is received in the getCoordinator method - ErrNillBidderAddr = errors.New("biderAddr can not be nil") + // ErrNilBidderAddr is used when a nil bidderAddr is received in the getCoordinator method + ErrNilBidderAddr = errors.New("biderAddr can not be nil") ) func retSQLErr(err error, c *gin.Context) {
@@ -50,19 +50,19 @@ }
return fromItem, order, limit, nil } -// nolint reason: res may be not overwriten +// nolint reason: res may be not overwritten func parseQueryUint(name string, dflt *uint, min, max uint, c querier) (*uint, error) { //nolint:SA4009 str := c.Query(name) return stringToUint(str, name, dflt, min, max) } -// nolint reason: res may be not overwriten +// nolint reason: res may be not overwritten func parseQueryInt64(name string, dflt *int64, min, max int64, c querier) (*int64, error) { //nolint:SA4009 str := c.Query(name) return stringToInt64(str, name, dflt, min, max) } -// nolint reason: res may be not overwriten +// nolint reason: res may be not overwritten func parseQueryBool(name string, dflt *bool, c querier) (*bool, error) { //nolint:SA4009 str := c.Query(name) if str == "" {@@ -295,13 +295,13 @@ idxStr := c.Param(name)
return stringToIdx(idxStr, name) } -// nolint reason: res may be not overwriten +// nolint reason: res may be not overwritten func parseParamUint(name string, dflt *uint, min, max uint, c paramer) (*uint, error) { //nolint:SA4009 str := c.Param(name) return stringToUint(str, name, dflt, min, max) } -// nolint reason: res may be not overwriten +// nolint reason: res may be not overwritten func parseParamInt64(name string, dflt *int64, min, max int64, c paramer) (*int64, error) { //nolint:SA4009 str := c.Param(name) return stringToInt64(str, name, dflt, min, max)
@@ -11,7 +11,7 @@ "github.com/hermeznetwork/hermez-node/db/historydb"
"github.com/hermeznetwork/tracerr" ) -// SlotAPI is a repesentation of a slot information +// SlotAPI is a representation of a slot information type SlotAPI struct { ItemID uint64 `json:"itemId"` SlotNum int64 `json:"slotNum"`@@ -316,7 +316,7 @@ retSQLErr(sql.ErrNoRows, c)
return } - // Build succesfull response + // Build successful response type slotsResponse struct { Slots []SlotAPI `json:"slots"` PendingItems uint64 `json:"pendingItems"`
@@ -53,7 +53,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type tokensResponse struct { Tokens []historydb.TokenWithUSD `json:"tokens"` PendingItems uint64 `json:"pendingItems"`
@@ -42,7 +42,7 @@ retSQLErr(err, c)
return } - // Build succesfull response + // Build successful response type txsResponse struct { Txs []historydb.TxAPI `json:"transactions"` PendingItems uint64 `json:"pendingItems"`@@ -66,6 +66,6 @@ if err != nil {
retSQLErr(err, c) return } - // Build succesfull response + // Build successful response c.JSON(http.StatusOK, tx) }
@@ -455,7 +455,7 @@ assertTxs(t, tc.txs, fetchedTxs)
// 400, due invalid TxID err := doBadReq("GET", endpoint+"0x001", nil, 400) assert.NoError(t, err) - // 404, due inexistent TxID in DB + // 404, due nonexistent TxID in DB err = doBadReq("GET", endpoint+"0x00eb5e95e1ce5e9f6c4ed402d415e8d0bdd7664769cfd2064d28da04a2c76be432", nil, 404) assert.NoError(t, err) }
@@ -51,7 +51,7 @@ if err != nil {
retSQLErr(err, c) return } - // Build succesfull response + // Build successful response c.JSON(http.StatusOK, tx) }
@@ -235,7 +235,7 @@ }
// 400, due invalid TxID err = doBadReq("GET", endpoint+"0xG2241b6f2b1dd772dba391f4a1a3407c7c21f598d86e2585a14e616fb4a255f823", nil, 400) require.NoError(t, err) - // 404, due inexistent TxID in DB + // 404, due nonexistent TxID in DB err = doBadReq("GET", endpoint+"0x02241b6f2b1dd772dba391f4a1a3407c7c21f598d86e2585a14e616fb4a255f823", nil, 404) require.NoError(t, err) }
@@ -91,7 +91,7 @@ // *c = CollectedFees(bStrMap)
return nil } -// HezEthAddr is used to scan/value Ethereum Address directly into strings that follow the Ethereum address hez fotmat (^hez:0x[a-fA-F0-9]{40}$) from/to sql DBs. +// HezEthAddr is used to scan/value Ethereum Address directly into strings that follow the Ethereum address hez format (^hez:0x[a-fA-F0-9]{40}$) from/to sql DBs. // It assumes that Ethereum Address are inserted/fetched to/from the DB using the default Scan/Value interface type HezEthAddr string@@ -143,7 +143,7 @@ *s = StrHezEthAddr(addr)
return nil } -// HezBJJ is used to scan/value *babyjub.PublicKeyComp directly into strings that follow the BJJ public key hez fotmat (^hez:[A-Za-z0-9_-]{44}$) from/to sql DBs. +// HezBJJ is used to scan/value *babyjub.PublicKeyComp directly into strings that follow the BJJ public key hez format (^hez:[A-Za-z0-9_-]{44}$) from/to sql DBs. // It assumes that *babyjub.PublicKeyComp are inserted/fetched to/from the DB using the default Scan/Value interface type HezBJJ string@@ -216,7 +216,7 @@
// StrHezBJJ is used to unmarshal HezBJJ directly into an alias of babyjub.PublicKeyComp type StrHezBJJ babyjub.PublicKeyComp -// UnmarshalText unmarshals a StrHezBJJ +// UnmarshalText unmarshalls a StrHezBJJ func (s *StrHezBJJ) UnmarshalText(text []byte) error { bjj, err := hezStrToBJJ(string(text)) if err != nil {@@ -226,8 +226,8 @@ *s = StrHezBJJ(bjj)
return nil } -// HezIdx is used to value common.Idx directly into strings that follow the Idx key hez fotmat (hez:tokenSymbol:idx) to sql DBs. -// Note that this can only be used to insert to DB since there is no way to automaticaly read from the DB since it needs the tokenSymbol +// HezIdx is used to value common.Idx directly into strings that follow the Idx key hez format (hez:tokenSymbol:idx) to sql DBs. +// Note that this can only be used to insert to DB since there is no way to automatically read from the DB since it needs the tokenSymbol type HezIdx string // StrHezIdx is used to unmarshal HezIdx directly into an alias of common.Idx
@@ -84,7 +84,7 @@ rawData = append(rawData, typedDataHash...)
return rawData, nil } -// HashToSign returns the hash to be signed by the Etherum address to authorize +// HashToSign returns the hash to be signed by the Ethereum address to authorize // the account creation, which follows the EIP-712 encoding func (a *AccountCreationAuth) HashToSign(chainID uint16, hermezContractAddr ethCommon.Address) ([]byte, error) {@@ -96,9 +96,9 @@ return ethCrypto.Keccak256(b), nil
} // Sign signs the account creation authorization message using the provided -// `signHash` function, and stores the signaure in `a.Signature`. `signHash` +// `signHash` function, and stores the signature in `a.Signature`. `signHash` // should do an ethereum signature using the account corresponding to -// `a.EthAddr`. The `signHash` function is used to make signig flexible: in +// `a.EthAddr`. The `signHash` function is used to make signing flexible: in // tests we sign directly using the private key, outside tests we sign using // the keystore (which never exposes the private key). Sign follows the EIP-712 // encoding.
@@ -34,7 +34,7 @@ ForgerCommitment bool
// BatchesLen int BidValue *big.Int BootCoord bool - // Bidder, Forer and URL correspond to the winner of the slot (which is + // Bidder, Forger and URL correspond to the winner of the slot (which is // not always the highest bidder). These are the values of the // coordinator that is able to forge exclusively before the deadline. Bidder ethCommon.Address
@@ -10,7 +10,7 @@ )
// L2Tx is a struct that represents an already forged L2 tx type L2Tx struct { - // Stored in DB: mandatory fileds + // Stored in DB: mandatory fields TxID TxID `meddler:"id"` BatchNum BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged. Position int `meddler:"position"`
@@ -88,7 +88,7 @@ func (txid TxID) MarshalText() ([]byte, error) {
return []byte(txid.String()), nil } -// UnmarshalText unmarshals a TxID +// UnmarshalText unmarshalls a TxID func (txid *TxID) UnmarshalText(data []byte) error { idStr := string(data) id, err := NewTxIDFromString(idStr)
@@ -67,7 +67,7 @@ FeeIdxs []*big.Int `json:"feeIdxs"` // uint64 (max nLevels bits), len: [maxFeeIdxs]
// accumulate fees // FeePlanTokens contains all the tokenIDs for which the fees are being - // accumulated and those fees accoumulated will be paid to the FeeIdxs + // accumulated and those fees accumulated will be paid to the FeeIdxs // array. The order of FeeIdxs & FeePlanTokens & State3 must match. // Coordinator fees are processed correlated such as: // [FeePlanTokens[i], FeeIdxs[i]]
@@ -73,7 +73,7 @@ // the forger address is checked to be allowed to forge (apart from
// checking the next block), used to decide when to stop scheduling new // batches (by stopping the pipeline). // For example, if we are at block 10 and ScheduleBatchBlocksAheadCheck - // is 5, eventhough at block 11 we canForge, the pipeline will be + // is 5, even though at block 11 we canForge, the pipeline will be // stopped if we can't forge at block 15. // This value should be the expected number of blocks it takes between // scheduling a batch and having it mined.@@ -83,7 +83,7 @@ // which the coordinator is also checked to be allowed to forge, apart
// from the next block; used to decide when to stop sending batches to // the smart contract. // For example, if we are at block 10 and SendBatchBlocksMarginCheck is - // 5, eventhough at block 11 we canForge, the batch will be discarded + // 5, even though at block 11 we canForge, the batch will be discarded // if we can't forge at block 15. SendBatchBlocksMarginCheck int64 // ProofServerPollInterval is the waiting interval between polling the@@ -126,7 +126,7 @@ // TTL is the Time To Live for L2Txs in the pool. Once MaxTxs
// L2Txs is reached, L2Txs older than TTL will be deleted. TTL Duration `validate:"required"` // PurgeBatchDelay is the delay between batches to purge - // outdated transactions. Oudated L2Txs are those that have + // outdated transactions. Outdated L2Txs are those that have // been forged or marked as invalid for longer than the // SafetyPeriod and pending L2Txs that have been in the pool // for longer than TTL once there are MaxTxs.@@ -136,7 +136,7 @@ // invalid transactions due to nonce lower than the account
// nonce. InvalidateBatchDelay int64 `validate:"required"` // PurgeBlockDelay is the delay between blocks to purge - // outdated transactions. Oudated L2Txs are those that have + // outdated transactions. Outdated L2Txs are those that have // been forged or marked as invalid for longer than the // SafetyPeriod and pending L2Txs that have been in the pool // for longer than TTL once there are MaxTxs.@@ -168,7 +168,7 @@ // transactions
MaxGasPrice *big.Int `validate:"required"` // GasPriceIncPerc is the percentage increase of gas price set // in an ethereum transaction from the suggested gas price by - // the ehtereum node + // the ethereum node GasPriceIncPerc int64 // CheckLoopInterval is the waiting interval between receipt // checks of ethereum transactions in the TxManager
@@ -54,7 +54,7 @@ // the forger address is checked to be allowed to forge (apart from
// checking the next block), used to decide when to stop scheduling new // batches (by stopping the pipeline). // For example, if we are at block 10 and ScheduleBatchBlocksAheadCheck - // is 5, eventhough at block 11 we canForge, the pipeline will be + // is 5, even though at block 11 we canForge, the pipeline will be // stopped if we can't forge at block 15. // This value should be the expected number of blocks it takes between // scheduling a batch and having it mined.@@ -64,7 +64,7 @@ // which the coordinator is also checked to be allowed to forge, apart
// from the next block; used to decide when to stop sending batches to // the smart contract. // For example, if we are at block 10 and SendBatchBlocksMarginCheck is - // 5, eventhough at block 11 we canForge, the batch will be discarded + // 5, even though at block 11 we canForge, the batch will be discarded // if we can't forge at block 15. // This value should be the expected number of blocks it takes between // sending a batch and having it mined.
@@ -504,7 +504,7 @@ if err := p.l2DB.UpdateTxsInfo(discardedL2Txs); err != nil {
return nil, tracerr.Wrap(err) } - // Invalidate transactions that become invalid beause of + // Invalidate transactions that become invalid because of // the poolL2Txs selected. Will mark as invalid the txs that have a // (fromIdx, nonce) which already appears in the selected txs (includes // all the nonces smaller than the current one)
@@ -14,7 +14,7 @@
// PurgerCfg is the purger configuration type PurgerCfg struct { // PurgeBatchDelay is the delay between batches to purge outdated - // transactions. Oudated L2Txs are those that have been forged or + // transactions. Outdated L2Txs are those that have been forged or // marked as invalid for longer than the SafetyPeriod and pending L2Txs // that have been in the pool for longer than TTL once there are // MaxTxs.@@ -23,7 +23,7 @@ // InvalidateBatchDelay is the delay between batches to mark invalid
// transactions due to nonce lower than the account nonce. InvalidateBatchDelay int64 // PurgeBlockDelay is the delay between blocks to purge outdated - // transactions. Oudated L2Txs are those that have been forged or + // transactions. Outdated L2Txs are those that have been forged or // marked as invalid for longer than the SafetyPeriod and pending L2Txs // that have been in the pool for longer than TTL once there are // MaxTxs.
@@ -503,7 +503,7 @@ } else if err != nil { //nolint:staticcheck
// Our ethNode is giving an error different // than "not found" when getting the receipt // for the transaction, so we can't figure out - // if it was not mined, mined and succesfull or + // if it was not mined, mined and successful or // mined and failed. This could be due to the // ethNode failure. t.coord.SendMsg(ctx, MsgStopPipeline{@@ -568,7 +568,7 @@ } else if err != nil {
// Our ethNode is giving an error different // than "not found" when getting the receipt // for the transaction, so we can't figure out - // if it was not mined, mined and succesfull or + // if it was not mined, mined and successful or // mined and failed. This could be due to the // ethNode failure. next++
@@ -43,7 +43,7 @@ historyDB = NewHistoryDB(db, db, nil)
if err != nil { panic(err) } - apiConnCon := dbUtils.NewAPICnnectionController(1, time.Second) + apiConnCon := dbUtils.NewAPIConnectionController(1, time.Second) historyDBWithACC = NewHistoryDB(db, db, apiConnCon) // Run tests result := m.Run()
@@ -316,7 +316,7 @@ }
checkpointPath := path.Join(k.cfg.Path, fmt.Sprintf("%s%d", PathBatchNum, batchNum)) - // copy synchronizer'BatchNumX' to 'BatchNumX' + // copy synchronizer 'BatchNumX' to 'BatchNumX' if err := synchronizerKVDB.MakeCheckpointFromTo(batchNum, checkpointPath); err != nil { return tracerr.Wrap(err) }
@@ -310,7 +310,7 @@ if len(updatedAccounts) == 0 {
return nil } // Fill the batch_num in the query with Sprintf because we are using a - // named query which works with slices, and doens't handle an extra + // named query which works with slices, and doesn't handle an extra // individual argument. query := fmt.Sprintf(invalidateOldNoncesQuery, batchNum) if _, err := sqlx.NamedExec(l2db.dbWrite, query, updatedAccounts); err != nil {
@@ -38,7 +38,7 @@ if err != nil {
panic(err) } l2DB = NewL2DB(db, db, 10, 1000, 0.0, 24*time.Hour, nil) - apiConnCon := dbUtils.NewAPICnnectionController(1, time.Second) + apiConnCon := dbUtils.NewAPIConnectionController(1, time.Second) l2DBWithACC = NewL2DB(db, db, 10, 1000, 0.0, 24*time.Hour, apiConnCon) test.WipeDB(l2DB.DB()) historyDB = historydb.NewHistoryDB(db, db, nil)
@@ -510,7 +510,7 @@ func (l *LocalStateDB) CheckpointExists(batchNum common.BatchNum) (bool, error) {
return l.db.CheckpointExists(batchNum) } -// Reset performs a reset in the LocaStateDB. If fromSynchronizer is true, it +// Reset performs a reset in the LocalStateDB. If fromSynchronizer is true, it // gets the state from LocalStateDB.synchronizerStateDB for the given batchNum. // If fromSynchronizer is false, get the state from LocalStateDB checkpoints. func (l *LocalStateDB) Reset(batchNum common.BatchNum, fromSynchronizer bool) error {
@@ -93,8 +93,8 @@ smphr *semaphore.Weighted
timeout time.Duration } -// NewAPICnnectionController initialize APIConnectionController -func NewAPICnnectionController(maxConnections int, timeout time.Duration) *APIConnectionController { +// NewAPIConnectionController initialize APIConnectionController +func NewAPIConnectionController(maxConnections int, timeout time.Duration) *APIConnectionController { return &APIConnectionController{ smphr: semaphore.NewWeighted(int64(maxConnections)), timeout: timeout,
@@ -107,7 +107,7 @@ }
} var apiConnCon *dbUtils.APIConnectionController if cfg.API.Explorer || mode == ModeCoordinator { - apiConnCon = dbUtils.NewAPICnnectionController( + apiConnCon = dbUtils.NewAPIConnectionController( cfg.API.MaxSQLConnections, cfg.API.SQLConnectionTimeout.Duration, )@@ -491,8 +491,8 @@ engine: engine,
}, nil } -// Run starts the http server of the NodeAPI. To stop it, pass a context with -// cancelation. +// Run starts the http server of the NodeAPI. To stop it, pass a context +// with cancellation. func (a *NodeAPI) Run(ctx context.Context) error { server := &http.Server{ Handler: a.engine,
@@ -235,7 +235,7 @@ func (p *ProofServerClient) CalculateProof(ctx context.Context, zkInputs *common.ZKInputs) error {
return tracerr.Wrap(p.apiInput(ctx, zkInputs)) } -// GetProof retreives the Proof and Public Data (public inputs) from the +// GetProof retrieves the Proof and Public Data (public inputs) from the // ServerProof, blocking until the proof is ready. func (p *ProofServerClient) GetProof(ctx context.Context) (*Proof, []*big.Int, error) { if err := p.WaitReady(ctx); err != nil {@@ -298,7 +298,7 @@ func (p *MockClient) CalculateProof(ctx context.Context, zkInputs *common.ZKInputs) error {
return nil } -// GetProof retreives the Proof from the ServerProof +// GetProof retrieves the Proof from the ServerProof func (p *MockClient) GetProof(ctx context.Context) (*Proof, []*big.Int, error) { // Simulate a delay select {
@@ -31,7 +31,7 @@ // to it being discarded from a reorg.
ErrUnknownBlock = fmt.Errorf("unknown block") ) -// Stats of the syncrhonizer +// Stats of the synchronizer type Stats struct { Eth struct { RefreshPeriod time.Duration@@ -347,7 +347,7 @@ return nil
} // updateCurrentSlot updates the slot with information of the current slot. -// The information abouth which coordinator is allowed to forge is only updated +// The information about which coordinator is allowed to forge is only updated // when we are Synced. // hasBatch is true when the last synced block contained at least one batch. func (s *Synchronizer) updateCurrentSlot(slot *common.Slot, reset bool, hasBatch bool) error {@@ -400,7 +400,7 @@ return nil
} // updateNextSlot updates the slot with information of the next slot. -// The information abouth which coordinator is allowed to forge is only updated +// The information about which coordinator is allowed to forge is only updated // when we are Synced. func (s *Synchronizer) updateNextSlot(slot *common.Slot) error { // We want the next block because the current one is already mined@@ -503,9 +503,9 @@ s.resetStateFailed = false
return nil } -// Sync attems to synchronize an ethereum block starting from lastSavedBlock. +// Sync attempts to synchronize an ethereum block starting from lastSavedBlock. // If lastSavedBlock is nil, the lastSavedBlock value is obtained from de DB. -// If a block is synched, it will be returned and also stored in the DB. If a +// If a block is synced, it will be returned and also stored in the DB. If a // reorg is detected, the number of discarded blocks will be returned and no // synchronization will be made. // TODO: Be smart about locking: only lock during the read/write operations@@ -558,7 +558,7 @@ "block", nextBlockNum,
"ethLastBlock", s.stats.Eth.LastBlock, ) - // Check that the obtianed ethBlock.ParentHash == prevEthBlock.Hash; if not, reorg! + // Check that the obtained ethBlock.ParentHash == prevEthBlock.Hash; if not, reorg! if lastSavedBlock != nil { if lastSavedBlock.Hash != ethBlock.ParentHash { // Reorg detected@@ -578,7 +578,7 @@ defer func() {
// If there was an error during sync, reset to the last block // in the historyDB because the historyDB is written last in // the Sync method and is the source of consistency. This - // allows reseting the stateDB in the case a batch was + // allows resetting the stateDB in the case a batch was // processed but the historyDB block was not committed due to an // error. if err != nil {@@ -818,7 +818,7 @@ }
return nil } -// rollupSync retreives all the Rollup Smart Contract Data that happened at +// rollupSync retrieves all the Rollup Smart Contract Data that happened at // ethBlock.blockNum with ethBlock.Hash. func (s *Synchronizer) rollupSync(ethBlock *common.Block) (*common.RollupData, error) { blockNum := ethBlock.Num
@@ -823,7 +823,7 @@ require.Equal(t, int64(1), stats.Sync.LastBlock.Num)
// Store ForgerComitmnent observed at every block by the live synchronizer syncCommitment := map[int64]bool{} - // Store ForgerComitmnent observed at every block by a syncrhonizer that is restarted + // Store ForgerComitmnent observed at every block by a synchronizer that is restarted syncRestartedCommitment := map[int64]bool{} for _, block := range blocks { // Add block data to the smart contracts
@@ -101,8 +101,8 @@ stats := a.sync.Stats()
c.JSON(http.StatusOK, stats) } -// Run starts the http server of the DebugAPI. To stop it, pass a context with -// cancelation (see `debugapi_test.go` for an example). +// Run starts the http server of the DebugAPI. To stop it, pass a context +// with cancellation (see `debugapi_test.go` for an example). func (a *DebugAPI) Run(ctx context.Context) error { api := gin.Default() api.NoRoute(handleNoRoute)
@@ -51,7 +51,7 @@ err = sdb.MakeCheckpoint() // Make a checkpoint to increment the batchNum
require.Nil(t, err) addr := "localhost:12345" - // We won't test the sync/stats endpoint, so we can se the Syncrhonizer to nil + // We won't test the sync/stats endpoint, so we can se the synchronizer to nil debugAPI := NewDebugAPI(addr, sdb, nil) ctx, cancel := context.WithCancel(context.Background())