Skip to content

Commit

Permalink
relayer/config: switch default block gas limit const to unexported
Browse files Browse the repository at this point in the history
  • Loading branch information
najeal committed Jan 16, 2025
1 parent d9040bb commit 98082dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions messages/teleporter/message_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ func TestShouldSendMessage(t *testing.T) {
)
require.NoError(t, err)

const blockGasLimit = 10_000
gasLimitExceededTeleporterMessage := validTeleporterMessage
gasLimitExceededTeleporterMessage.RequiredGasLimit = big.NewInt(config.DefaultBlockGasLimit + 1)
gasLimitExceededTeleporterMessage.RequiredGasLimit = big.NewInt(blockGasLimit + 1)
gasLimitExceededTeleporterMessageBytes, err := gasLimitExceededTeleporterMessage.Pack()
require.NoError(t, err)

Expand Down Expand Up @@ -233,7 +234,7 @@ func TestShouldSendMessage(t *testing.T) {
SenderAddress().
Return(test.senderAddressResult).
Times(test.senderAddressTimes)
mockClient.EXPECT().BlockGasLimit().Return(uint64(config.DefaultBlockGasLimit)).AnyTimes()
mockClient.EXPECT().BlockGasLimit().Return(uint64(blockGasLimit)).AnyTimes()
mockClient.EXPECT().DestinationBlockchainID().Return(destinationBlockchainID).AnyTimes()
if test.messageReceivedCall != nil {
messageReceivedInput := interfaces.CallMsg{
Expand Down
6 changes: 3 additions & 3 deletions relayer/config/destination_blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
const (
// The block gas limit that can be specified for a Teleporter message
// Based on the C-Chain 15_000_000 gas limit per block, with other Warp message gas overhead conservatively estimated.
DefaultBlockGasLimit = 12_000_000
defaultBlockGasLimit = 12_000_000
)

// Destination blockchain configuration. Specifies how to connect to and issue
Expand All @@ -42,7 +42,7 @@ type DestinationBlockchain struct {
// Validates the destination subnet configuration
func (s *DestinationBlockchain) Validate() error {
if s.BlockGasLimit == 0 {
s.BlockGasLimit = DefaultBlockGasLimit
s.BlockGasLimit = defaultBlockGasLimit
}
if err := s.RPCEndpoint.Validate(); err != nil {
return fmt.Errorf("invalid rpc-endpoint in destination subnet configuration: %w", err)
Expand Down Expand Up @@ -79,7 +79,7 @@ func (s *DestinationBlockchain) Validate() error {
s.subnetID = subnetID

if s.subnetID == constants.PrimaryNetworkID &&
s.BlockGasLimit > DefaultBlockGasLimit {
s.BlockGasLimit > defaultBlockGasLimit {
return fmt.Errorf("C-Chain block-gas-limit '%d' exceeded", s.BlockGasLimit)
}

Expand Down

0 comments on commit 98082dc

Please sign in to comment.