Compare commits

..

6 Commits

Author SHA1 Message Date
georgehao
4eba64c3fb feat: update 2023-12-13 10:41:04 +08:00
georgehao
9a60a6bf9c feat: update 2023-12-13 10:37:51 +08:00
Luke Ma
bf2692b7cb refactor: add address(0) check for constructors. (#1010)
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
2023-12-11 16:49:29 +08:00
Thompson
566fb23b9d refactor(common): use strings.ToLower for LOG_DOCKER env variable check to improve code readability and maintainability (#1035)
Co-authored-by: luogz17 <luogz17@annto.com.cn>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
2023-12-11 15:57:15 +08:00
Xargin
2e627f781a fix: add connection timeout for db conn pool (#1032)
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
2023-12-11 15:46:13 +08:00
ys-0212
bc5ec89b70 docs: fix typos (#1038) 2023-12-11 15:32:38 +08:00
11 changed files with 23 additions and 6 deletions

View File

@@ -45,7 +45,7 @@ var (
L2BatchWithdrawERC721Sig common.Hash
L2BatchWithdrawERC1155Sig common.Hash
// scroll mono repo
// scroll monorepo
// ScrollChainABI holds information about ScrollChain's context and available invokable methods.
ScrollChainABI *abi.ABI
@@ -323,7 +323,7 @@ type L1RelayedMessageEvent struct {
MessageHash common.Hash
}
// L2AppendMessageEvent represents a AppendMessage event raised by the L2MessageQueue contract.
// L2AppendMessageEvent represents an AppendMessage event raised by the L2MessageQueue contract.
type L2AppendMessageEvent struct {
Index *big.Int
MessageHash common.Hash

View File

@@ -74,6 +74,8 @@ func InitDB(config *config.DBConfig) (*gorm.DB, error) {
return nil, pingErr
}
sqlDB.SetConnMaxLifetime(time.Minute * 10)
sqlDB.SetConnMaxIdleTime(time.Minute * 5)
sqlDB.SetMaxOpenConns(config.MaxOpenNum)
sqlDB.SetMaxIdleConns(config.MaxIdleNum)

View File

@@ -15,7 +15,7 @@ var verbose bool
func init() {
v := os.Getenv("LOG_DOCKER")
if v == "true" || v == "TRUE" {
if strings.ToLower(v) == "true" {
verbose = true
}
}

View File

@@ -70,6 +70,9 @@ func InitDB(config *Config) (*gorm.DB, error) {
return nil, pingErr
}
sqlDB.SetConnMaxLifetime(time.Minute * 10)
sqlDB.SetConnMaxIdleTime(time.Minute * 5)
sqlDB.SetMaxOpenConns(config.MaxOpenNum)
sqlDB.SetMaxIdleConns(config.MaxIdleNum)

View File

@@ -18,7 +18,7 @@ func LogSetup(ctx *cli.Context) error {
if logFile := ctx.String(LogFileFlag.Name); len(logFile) > 0 {
fp, err := os.OpenFile(filepath.Clean(logFile), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)
if err != nil {
utils.Fatalf("Failed to open log file", "err", err)
utils.Fatalf("Failed to open log file", "err", err)
}
if ctx.Bool(LogJSONFormat.Name) {
ostream = log.StreamHandler(io.Writer(fp), log.JSONFormat())

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.3.42"
var tag = "v4.3.43"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -95,6 +95,9 @@ contract L1ScrollMessenger is ScrollMessengerBase, IL1ScrollMessenger {
address _rollup,
address _messageQueue
) public initializer {
if (_counterpart == address(0) || _rollup == address(0) || _messageQueue == address(0)) {
revert ErrZeroAddress();
}
ScrollMessengerBase.__ScrollMessengerBase_init(_counterpart, _feeVault);
rollup = _rollup;

View File

@@ -49,12 +49,15 @@ contract L2ScrollMessenger is ScrollMessengerBase, IL2ScrollMessenger {
***************/
constructor(address _messageQueue) {
if (_messageQueue == address(0)) revert ErrZeroAddress();
_disableInitializers();
messageQueue = _messageQueue;
}
function initialize(address _counterpart) external initializer {
if (_counterpart == address(0)) revert ErrZeroAddress();
ScrollMessengerBase.__ScrollMessengerBase_init(_counterpart, address(0));
}

View File

@@ -3,6 +3,11 @@
pragma solidity ^0.8.16;
interface IScrollMessenger {
/***********
* Errors *
***********/
error ErrZeroAddress();
/**********
* Events *
**********/

View File

@@ -82,7 +82,7 @@ abstract contract L1GatewayTestBase is DSTestPlus {
verifier = new MockRollupVerifier();
// Deploy L2 contracts
l2Messenger = new L2ScrollMessenger(address(0));
l2Messenger = new L2ScrollMessenger(address(1));
// Initialize L1 contracts
l1Messenger.initialize(address(l2Messenger), feeVault, address(rollup), address(messageQueue));

View File

@@ -3,5 +3,6 @@ package main
import "scroll-tech/coordinator/cmd/cron/app"
func main() {
app.Run()
}