Skip to content

Commit

Permalink
update aggoracle configs
Browse files Browse the repository at this point in the history
  • Loading branch information
rachit77 committed Jan 17, 2025
1 parent 2b91212 commit 34434d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 0 additions & 1 deletion aggoracle/chaingersender/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ type L2GERManagerContract interface {
type EVMConfig struct {
GlobalExitRootL2Addr common.Address `mapstructure:"GlobalExitRootL2"`
URLRPCL2 string `mapstructure:"URLRPCL2"`
ChainIDL2 uint64 `mapstructure:"ChainIDL2"`
GasOffset uint64 `mapstructure:"GasOffset"`
WaitPeriodMonitorTx cfgtypes.Duration `mapstructure:"WaitPeriodMonitorTx"`
EthTxManager ethtxmanager.Config `mapstructure:"EthTxManager"`
Expand Down
5 changes: 5 additions & 0 deletions aggoracle/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ type Config struct {
WaitPeriodNextGER types.Duration `mapstructure:"WaitPeriodNextGER"`
EVMSender chaingersender.EVMConfig `mapstructure:"EVMSender"`
}

// ApplyL2ChainID copies L2ChainID to the L1ChainID in the Etherman config
func (c *Config) ApplyL2ChainID(l2ChainID uint64) {
c.EVMSender.EthTxManager.Etherman.L1ChainID = l2ChainID
}
10 changes: 10 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ func createAggoracle(
syncer *l1infotreesync.L1InfoTreeSync,
) *aggoracle.AggOracle {
logger := log.WithFields("module", aggkitcommon.AGGORACLE)
ethermanClient, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config, cfg.Common)
if err != nil {
logger.Fatal(err)
}
l2ChainID, err := ethermanClient.GetL2ChainID()
if err != nil {
logger.Fatal(err)
}
cfg.AggOracle.ApplyL2ChainID(l2ChainID)

var sender aggoracle.ChainSender
switch cfg.AggOracle.TargetChainType {
case aggoracle.EVMChain:
Expand Down
2 changes: 0 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ WaitPeriodNextGER="100ms"
[AggOracle.EVMSender]
GlobalExitRootL2="{{L2Config.GlobalExitRootAddr}}"
URLRPCL2="{{L2URL}}"
ChainIDL2=1337
GasOffset=0
WaitPeriodMonitorTx="100ms"
[AggOracle.EVMSender.EthTxManager]
Expand All @@ -122,7 +121,6 @@ WaitPeriodNextGER="100ms"
[AggOracle.EVMSender.EthTxManager.Etherman]
URL = "{{L2URL}}"
MultiGasProvider = false
L1ChainID = {{NetworkConfig.L1.L1ChainID}}
HTTPHeaders = []
[RPC]
Expand Down

0 comments on commit 34434d4

Please sign in to comment.