Skip to content

Commit

Permalink
Merge branch 'develop' into fix-bridge-history-api-write-db
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Dec 11, 2023
2 parents c4c68ef + bf2692b commit bee9489
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
3 changes: 3 additions & 0 deletions common/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions contracts/src/L1/L1ScrollMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions contracts/src/L2/L2ScrollMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
5 changes: 5 additions & 0 deletions contracts/src/libraries/IScrollMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
pragma solidity ^0.8.16;

interface IScrollMessenger {
/***********
* Errors *
***********/
error ErrZeroAddress();

/**********
* Events *
**********/
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/test/L1GatewayTestBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit bee9489

Please sign in to comment.