Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
99004f9
add based sequencer initial implementation
gupadhyaya Apr 9, 2025
f15e495
Delete rollkit.toml
gupadhyaya Apr 9, 2025
130e752
use jsonrpc client if available
gupadhyaya Apr 9, 2025
1565fa5
use real DA for rollkit
gupadhyaya Apr 9, 2025
3f32b86
update ADR to include relaying cost
gupadhyaya Apr 10, 2025
0b9b4cf
add clarification to forkchoice and rollup light client
gupadhyaya Apr 10, 2025
3615d39
disabled gasPrice & gasMultiplier rpc calls, decode namespace as hex …
gupadhyaya Apr 10, 2025
71a455a
fix submit by adding the submit with options api that is supported in…
gupadhyaya Apr 10, 2025
e6baffb
add persistence to reaper and avoid submitting duplicate transactions
gupadhyaya Apr 10, 2025
fa00b6c
add persistence to pendingTxs in the sequencer
gupadhyaya Apr 10, 2025
814ea48
add last scanned da height, disable batch retrieve loop
gupadhyaya Apr 11, 2025
d0f535e
pluggable forkchoice
gupadhyaya Apr 11, 2025
18445c7
Merge branch 'feature/exec_api' into based
gupadhyaya Apr 14, 2025
b66a251
merge fixes
gupadhyaya Apr 14, 2025
55be1b3
force da start height as starting point for da scan
gupadhyaya Apr 15, 2025
70c4e8f
Merge branch 'feature/exec_api' into based
gupadhyaya Apr 16, 2025
e612a93
Merge branch 'feature/exec_api' into based
gupadhyaya Apr 16, 2025
d767c80
remove additional inits
gupadhyaya Apr 18, 2025
748de3e
capture the start context, add default interval
gupadhyaya Apr 18, 2025
4d49f64
submit with options fix
gupadhyaya Apr 18, 2025
ca6b4d9
remove GetTxs from lazy aggregation loop and comment out the test for…
gupadhyaya Apr 18, 2025
2665a88
Merge branch 'feature/exec_api' into based
gupadhyaya Apr 18, 2025
4297ab1
fixes
gupadhyaya Apr 18, 2025
922bfc6
lint
gupadhyaya Apr 18, 2025
2dbc2bd
cleanup
gupadhyaya Apr 18, 2025
fd9db02
more fixes
gupadhyaya Apr 18, 2025
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
Prev Previous commit
Next Next commit
fixes
  • Loading branch information
gupadhyaya committed Apr 18, 2025
commit 4297ab1421d3683bdc2afa552e1d306d94c12264
19 changes: 18 additions & 1 deletion da/cmd/local-da/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,24 @@ func (d *LocalDA) Commit(ctx context.Context, blobs []coreda.Blob, _ []byte) ([]
}

// SubmitWithOptions stores blobs in DA layer (options are ignored).
func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice float64, _ []byte, _ []byte) ([]coreda.ID, error) {
func (d *LocalDA) SubmitWithOptions(ctx context.Context, blobs []coreda.Blob, gasPrice float64, _ []byte, _ []byte) ([]coreda.ID, error) {
d.logger.Info("SubmitWithOptions called", "numBlobs", len(blobs), "gasPrice", gasPrice)
d.mu.Lock()
defer d.mu.Unlock()
ids := make([]coreda.ID, len(blobs))
d.height += 1
d.timestamps[d.height] = time.Now()
for i, blob := range blobs {
ids[i] = append(d.nextID(), d.getHash(blob)...)

d.data[d.height] = append(d.data[d.height], kvp{ids[i], blob})
}
d.logger.Info("SubmitWithOptions successful", "newHeight", d.height, "count", len(ids))
return ids, nil
}

// Submit stores blobs in DA layer (options are ignored).
func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice float64, _ []byte) ([]coreda.ID, error) {
d.logger.Info("Submit called", "numBlobs", len(blobs), "gasPrice", gasPrice)
d.mu.Lock()
defer d.mu.Unlock()
Expand Down
5 changes: 3 additions & 2 deletions da/da_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func TestMockDAErrors(t *testing.T) {
// Set up the mock to throw context deadline exceeded
mockDA.On("MaxBlobSize", mock.Anything).Return(uint64(1234), nil)
mockDA.
On("Submit", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
// On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
After(submitTimeout).
Return(nil, ErrContextDeadline)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
Expand Down Expand Up @@ -76,7 +77,7 @@ func TestMockDAErrors(t *testing.T) {
// Set up the mock to throw tx too large
mockDA.On("MaxBlobSize", mock.Anything).Return(uint64(1234), nil)
mockDA.
On("Submit", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
Return([]coreda.ID{}, ErrTxTooLarge)

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
Expand Down
75 changes: 75 additions & 0 deletions rollups/evm/based/cmd/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"

rollcmd "github.com/rollkit/rollkit/pkg/cmd"
rollconf "github.com/rollkit/rollkit/pkg/config"
)

// InitCmd initializes a new rollkit.yaml file in the current directory
func InitCmd() *cobra.Command {
initCmd := &cobra.Command{
Use: "init",
Short: "Initialize rollkit config",
Long: fmt.Sprintf("This command initializes a new %s file in the specified directory (or current directory if not specified).", rollconf.ConfigName),
RunE: func(cmd *cobra.Command, args []string) error {
homePath, err := cmd.Flags().GetString(rollconf.FlagRootDir)
if err != nil {
return fmt.Errorf("error reading home flag: %w", err)
}

aggregator, err := cmd.Flags().GetBool(rollconf.FlagAggregator)
if err != nil {
return fmt.Errorf("error reading aggregator flag: %w", err)
}

// ignore error, as we are creating a new config
// we use load in order to parse all the flags
cfg, _ := rollconf.Load(cmd)
cfg.Node.Aggregator = aggregator
if err := cfg.Validate(); err != nil {
return fmt.Errorf("error validating config: %w", err)
}

passphrase, err := cmd.Flags().GetString(rollconf.FlagSignerPassphrase)
if err != nil {
return fmt.Errorf("error reading passphrase flag: %w", err)
}

proposerAddress, err := rollcmd.InitializeSigner(&cfg, homePath, passphrase)
if err != nil {
return err
}

if err := cfg.SaveAsYaml(); err != nil {
return fmt.Errorf("error writing rollkit.yaml file: %w", err)
}

if err := rollcmd.InitializeNodeKey(homePath); err != nil {
return err
}

// get chain ID or use default
chainID, _ := cmd.Flags().GetString(rollconf.FlagChainID)
if chainID == "" {
chainID = "rollkit-test"
}

// Initialize genesis with empty app state
if err := rollcmd.InitializeGenesis(homePath, chainID, 1, proposerAddress, []byte("{}")); err != nil {
return fmt.Errorf("error initializing genesis file: %w", err)
}

cmd.Printf("Successfully initialized config file at %s\n", cfg.ConfigPath())
return nil
},
}

// Add flags to the command
rollconf.AddFlags(initCmd)

return initCmd
}
3 changes: 2 additions & 1 deletion rollups/evm/based/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/rollkit/rollkit/pkg/p2p"
"github.com/rollkit/rollkit/pkg/p2p/key"
"github.com/rollkit/rollkit/pkg/store"
"github.com/rollkit/rollkit/rollups/evm/based/cmd"
"github.com/rollkit/rollkit/sequencers/based"
"github.com/spf13/cobra"
Comment thread
gupadhyaya marked this conversation as resolved.
)
Expand Down Expand Up @@ -233,7 +234,7 @@ func main() {
rollcmd.NewDocsGenCmd(rootCmd, AppName),
NewExtendedRunNodeCmd(ctx),
rollcmd.VersionCmd,
rollcmd.InitCmd,
cmd.InitCmd(),
)

if err := rootCmd.Execute(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion sequencers/single/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/ipfs/go-datastore v0.8.2
github.com/prometheus/client_golang v1.21.1
github.com/rollkit/rollkit v0.0.0-00010101000000-000000000000
github.com/rollkit/rollkit/core v0.0.0-00010101000000-000000000000
github.com/rollkit/rollkit/core v0.0.0-20250312114929-104787ba1a4c
github.com/rollkit/rollkit/da v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.10.0
google.golang.org/protobuf v1.36.6
Expand Down
2 changes: 1 addition & 1 deletion sequencers/single/sequencer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func TestSequencer_GetNextBatch_BeforeDASubmission(t *testing.T) {
mockDA.On("MaxBlobSize", mock.Anything).Return(uint64(100_000_000), nil)
mockDA.On("GasPrice", mock.Anything).Return(float64(0), nil)
mockDA.On("GasMultiplier", mock.Anything).Return(float64(0), nil)
mockDA.On("Submit", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).
mockDA.On("SubmitWithOptions", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).
Return(nil, errors.New("mock DA always rejects submissions"))

// Submit a batch
Expand Down