Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Moved logging of the errors to the top level of the call-stack for et…
Browse files Browse the repository at this point in the history
…herman.GetSequencerAddr
  • Loading branch information
nivida committed Jan 12, 2024
1 parent 09a9493 commit f130f50
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func New(ethClient EthereumClient, auth bind.TransactOpts, cfg *config.Config) (
func (e *Etherman) GetSequencerAddr(rollupId uint32) (common.Address, error) {
address, err := e.getTrustedSequencerAddress(rollupId)
if err != nil {
log.Errorf("error requesting the 'TrustedSequencer' address: %s", err)
return common.Address{}, err
}

Expand Down Expand Up @@ -91,13 +92,11 @@ func (e *Etherman) CallContract(ctx context.Context, call ethereum.CallMsg, bloc
func (e *Etherman) getRollupContractAddress(rollupId uint32) (common.Address, error) {
contract, err := polygonrollupmanager.NewPolygonrollupmanager(e.config.L1.RollupManagerContract, e.ethClient)
if err != nil {
log.Errorf("error instantiating contract: %s", err)
return common.Address{}, err
}

rollupData, err := contract.RollupIDToRollupData(&bind.CallOpts{Pending: false}, rollupId)
if err != nil {
log.Errorf("error receiving the 'RollupData' struct: %s", err)
return common.Address{}, err
}

Expand All @@ -107,13 +106,11 @@ func (e *Etherman) getRollupContractAddress(rollupId uint32) (common.Address, er
func (e *Etherman) getTrustedSequencerAddress(rollupId uint32) (common.Address, error) {
rollupContractAddress, err := e.getRollupContractAddress(rollupId)
if err != nil {
log.Errorf("error requesting the RollupContract address from PolygonRollupManager: %s", err)
return common.Address{}, err
}

contract, err := polygonzkevm.NewPolygonzkevm(rollupContractAddress, e.ethClient)
if err != nil {
log.Errorf("error instantiating contract: %s", err)
return common.Address{}, err
}

Expand Down

0 comments on commit f130f50

Please sign in to comment.