Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rachit77 committed Sep 6, 2024
1 parent b687ac3 commit 30ae500
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 70 deletions.
2 changes: 1 addition & 1 deletion aggregator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type Config struct {
ChainID uint64

// ForkID is the L2 ForkID provided by the Network Config
ForkId uint64 `mapstructure:"ForkId"`
ForkId uint64 `mapstructure:"ForkId"` //nolint:stylecheck

// SenderAddress defines which private key the eth tx manager needs to use
// to sign the L1 txs
Expand Down
14 changes: 7 additions & 7 deletions aggregator/prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const (
)

var (
ErrBadProverResponse = errors.New("Prover returned wrong type for response") //nolint:revive
ErrProverInternalError = errors.New("Prover returned INTERNAL_ERROR response") //nolint:revive
ErrProverCompletedError = errors.New("Prover returned COMPLETED_ERROR response") //nolint:revive
ErrBadRequest = errors.New("Prover returned ERROR for a bad request") //nolint:revive
ErrUnspecified = errors.New("Prover returned an UNSPECIFIED response") //nolint:revive
ErrUnknown = errors.New("Prover returned an unknown response") //nolint:revive
ErrProofCanceled = errors.New("Proof has been canceled") //nolint:revive
ErrBadProverResponse = errors.New("prover returned wrong type for response") //nolint:revive
ErrProverInternalError = errors.New("prover returned INTERNAL_ERROR response") //nolint:revive
ErrProverCompletedError = errors.New("prover returned COMPLETED_ERROR response") //nolint:revive
ErrBadRequest = errors.New("prover returned ERROR for a bad request") //nolint:revive
ErrUnspecified = errors.New("prover returned an UNSPECIFIED response") //nolint:revive
ErrUnknown = errors.New("prover returned an unknown response") //nolint:revive
ErrProofCanceled = errors.New("proof has been canceled") //nolint:revive
)

// Prover abstraction of the grpc prover client.
Expand Down
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appName = "cdk"

const (
// SEQUENCE_SENDER name to identify the sequence-sender component
SEQUENCE_SENDER = "sequence-sender"
SEQUENCE_SENDER = "sequence-sender" //nolint:stylecheck
// AGGREGATOR name to identify the aggregator component
AGGREGATOR = "aggregator"
// AGGORACLE name to identify the aggoracle component
Expand All @@ -23,8 +23,8 @@ const (
)

const (
// NETWORK_CONFIGFILE name to identify the netowk_custom (genesis) config-file
NETWORK_CONFIGFILE = "custom_network"
// NetworkConfigFile name to identify the network_custom (genesis) config-file
NetworkConfigFile = "custom_network"
)

var (
Expand Down
28 changes: 26 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,19 @@ func runReorgDetectorL1IfNeeded(
return nil
}
rd := newReorgDetector(cfg, l1Client)
go rd.Start(ctx)

errChan := make(chan error, 1)
go func() {
if err := rd.Start(ctx); err != nil {
errChan <- err
}
close(errChan)
}()
go func() {
if err := <-errChan; err != nil {
log.Errorf("Failed to start ReorgDetector: %v", err)
}
}()

return rd
}
Expand All @@ -534,7 +546,19 @@ func runReorgDetectorL2IfNeeded(
return nil
}
rd := newReorgDetector(cfg, l2Client)
go rd.Start(ctx)

errChan := make(chan error, 1)
go func() {
if err := rd.Start(ctx); err != nil {
errChan <- err
}
close(errChan)
}()
go func() {
if err := <-errChan; err != nil {
log.Errorf("Failed to start ReorgDetector: %v", err)
}
}()

return rd
}
Expand Down
8 changes: 4 additions & 4 deletions etherman/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ func (etherMan *Client) BuildTrustedVerifyBatchesTxData(
}

// GetBatchAccInputHash gets the batch accumulated input hash from the ethereum
func (etherman *Client) GetBatchAccInputHash(ctx context.Context, batchNumber uint64) (common.Hash, error) {
rollupData, err := etherman.Contracts.Banana.RollupManager.GetRollupSequencedBatches(
&bind.CallOpts{Pending: false}, etherman.RollupID, batchNumber,
func (etherMan *Client) GetBatchAccInputHash(ctx context.Context, batchNumber uint64) (common.Hash, error) {
rollupData, err := etherMan.Contracts.Banana.RollupManager.GetRollupSequencedBatches(
&bind.CallOpts{Pending: false}, etherMan.RollupID, batchNumber,
)
if err != nil {
return common.Hash{}, err
Expand All @@ -79,7 +79,7 @@ func (etherman *Client) GetBatchAccInputHash(ctx context.Context, batchNumber ui
}

// GetRollupId returns the rollup id
func (etherMan *Client) GetRollupId() uint32 {
func (etherMan *Client) GetRollupId() uint32 { //nolint:stylecheck
return etherMan.RollupID
}

Expand Down
Loading

0 comments on commit 30ae500

Please sign in to comment.