Skip to content

Commit 4c690a5

Browse files
committed
feat: initial draft of single-sequencer EVM rollup binary
1 parent 8374715 commit 4c690a5

9 files changed

Lines changed: 2783 additions & 8 deletions

File tree

block/manager.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func getInitialState(ctx context.Context, genesis *RollkitGenesis, store store.S
207207
s := types.State{
208208
ChainID: genesis.ChainID,
209209
InitialHeight: genesis.InitialHeight,
210-
LastBlockHeight: genesis.InitialHeight - 1,
210+
LastBlockHeight: genesis.InitialHeight,
211211
LastBlockID: cmtypes.BlockID{},
212212
LastBlockTime: genesis.GenesisTime,
213213
AppHash: stateRoot,
@@ -1167,7 +1167,7 @@ func (m *Manager) publishBlock(ctx context.Context) error {
11671167
}
11681168

11691169
m.logger.Debug("Submitting transaction to sequencer",
1170-
"txCount", len(execTxs))
1170+
"txCount", len(execTxs), "rollupId", m.genesis.ChainID)
11711171
_, err = m.sequencer.SubmitRollupBatchTxs(ctx, coresequencer.SubmitRollupBatchTxsRequest{
11721172
RollupId: sequencing.RollupId(m.genesis.ChainID),
11731173
Batch: &coresequencer.Batch{Transactions: execTxs},
@@ -1181,6 +1181,7 @@ func (m *Manager) publishBlock(ctx context.Context) error {
11811181
m.logger.Debug("Successfully submitted transaction to sequencer")
11821182
}
11831183

1184+
time.Sleep(100 * time.Millisecond)
11841185
txs, timestamp, err := m.getTxsFromBatch()
11851186
if errors.Is(err, ErrNoBatch) {
11861187
m.logger.Debug("No batch available, creating empty block")
@@ -1195,7 +1196,7 @@ func (m *Manager) publishBlock(ctx context.Context) error {
11951196
if timestamp.Before(lastHeaderTime) {
11961197
return fmt.Errorf("timestamp is not monotonically increasing: %s < %s", timestamp, m.getLastBlockTime())
11971198
}
1198-
m.logger.Info("Creating and publishing block", "height", newHeight)
1199+
m.logger.Info("Creating and publishing block", "height", newHeight, "num_txs", len(txs))
11991200
header, data, err = m.createBlock(ctx, newHeight, lastSignature, lastHeaderHash, txs, *timestamp)
12001201
if err != nil {
12011202
return err

block/sync_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (syncService *SyncService[H]) WriteToStoreAndBroadcast(ctx context.Context,
130130
if !syncService.syncerStatus.started.Load() {
131131
firstStart = true
132132
if err := syncService.StartSyncer(ctx); err != nil {
133-
return fmt.Errorf("failed to start syncer after initializing the store")
133+
return fmt.Errorf("failed to start syncer after initializing the store: %w", err)
134134
}
135135
}
136136

rollups/evm/centralized/go.mod

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package commands
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
6+
rollkitconfig "github.com/rollkit/rollkit/config"
7+
)
8+
9+
func init() {
10+
registerFlagsRootCmd(RootCmd)
11+
}
12+
13+
// registerFlagsRootCmd registers the flags for the root command
14+
func registerFlagsRootCmd(cmd *cobra.Command) {
15+
cmd.PersistentFlags().String("log_level", rollkitconfig.DefaultLogLevel, "set the log level; default is info. other options include debug, info, error, none")
16+
cmd.PersistentFlags().String("log_format", "plain", "set the log format; options include plain and json")
17+
cmd.PersistentFlags().Bool("trace", false, "print out full stack trace on errors")
18+
}
19+
20+
// RootCmd is the root command for Rollkit
21+
var RootCmd = &cobra.Command{
22+
Use: "rollkit",
23+
Short: "The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract.",
24+
Long: `
25+
Rollkit is the first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract.
26+
The rollkit-cli uses the environment variable "RKHOME" to point to a file path where the node keys, config, and data will be stored.
27+
If a path is not specified for RKHOME, the rollkit command will create a folder "~/.rollkit" where it will store said data.
28+
`,
29+
}

0 commit comments

Comments
 (0)