Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/bee/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const (
optionReserveCapacityDoubling = "reserve-capacity-doubling"
optionSkipPostageSnapshot = "skip-postage-snapshot"
optionNameMinimumGasTipCap = "minimum-gas-tip-cap"
optionNameGasLimitFallback = "gas-limit-fallback"
Copy link
Copy Markdown
Contributor

@akrem-chabchoub akrem-chabchoub Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag should be added to docker-compose and env files

optionNameP2PWSSEnable = "p2p-wss-enable"
optionP2PWSSAddr = "p2p-wss-addr"
optionNATWSSAddr = "nat-wss-addr"
Expand Down Expand Up @@ -297,6 +298,7 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
cmd.Flags().Int(optionReserveCapacityDoubling, 0, "reserve capacity doubling")
cmd.Flags().Bool(optionSkipPostageSnapshot, false, "skip postage snapshot")
cmd.Flags().Uint64(optionNameMinimumGasTipCap, 0, "minimum gas tip cap in wei for transactions, 0 means use suggested gas tip cap")
cmd.Flags().Uint64(optionNameGasLimitFallback, 500_000, "gas limit fallback when estimation fails for contract transactions")
cmd.Flags().Bool(optionNameP2PWSSEnable, false, "Enable Secure WebSocket P2P connections")
cmd.Flags().String(optionP2PWSSAddr, ":1635", "p2p wss address")
cmd.Flags().String(optionNATWSSAddr, "", "WSS NAT exposed address")
Expand Down
1 change: 1 addition & 0 deletions cmd/bee/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (c *command) initDeployCmd() error {
blocktime,
true,
c.config.GetUint64(optionNameMinimumGasTipCap),
c.config.GetUint64(optionNameGasLimitFallback),
)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/bee/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
FullNodeMode: fullNode,
Logger: logger,
MinimumGasTipCap: c.config.GetUint64(optionNameMinimumGasTipCap),
GasLimitFallback: c.config.GetUint64(optionNameGasLimitFallback),
MinimumStorageRadius: c.config.GetUint(optionMinimumStorageRadius),
MutexProfile: c.config.GetBool(optionNamePProfMutex),
NATAddr: c.config.GetString(optionNameNATAddr),
Expand Down
2 changes: 2 additions & 0 deletions packaging/bee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ password-file: "/var/lib/bee/password"
# tracing-port: ""
## service name identifier for tracing
# tracing-service-name: bee
## gas limit fallback when estimation fails for contract transactions (default 500000)
# gas-limit-fallback: 500000
## skips the gas estimate step for contract transactions
# transaction-debug-mode: false
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace
Expand Down
1 change: 1 addition & 0 deletions packaging/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
- BEE_TRACING_ENABLE
- BEE_TRACING_ENDPOINT
- BEE_TRACING_SERVICE_NAME
- BEE_GAS_LIMIT_FALLBACK
- BEE_TRANSACTION
- BEE_VERBOSITY
- BEE_WELCOME_MESSAGE
Expand Down
2 changes: 2 additions & 0 deletions packaging/docker/env
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
# BEE_TRACING_PORT=
## service name identifier for tracing
# BEE_TRACING_SERVICE_NAME=
## gas limit fallback when estimation fails for contract transactions (default 500000)
# BEE_GAS_LIMIT_FALLBACK=500000
## skips the gas estimate step for contract transactions
# BEE_TRANSACTION_DEBUG_MODE=false
## bootstrap node using postage snapshot from the network
Expand Down
2 changes: 2 additions & 0 deletions packaging/homebrew-amd64/bee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ password-file: "/usr/local/var/lib/swarm-bee/password"
# tracing-port: ""
## service name identifier for tracing
# tracing-service-name: bee
## gas limit fallback when estimation fails for contract transactions (default 500000)
# gas-limit-fallback: 500000
## skips the gas estimate step for contract transactions
# transaction-debug-mode: false
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace
Expand Down
2 changes: 2 additions & 0 deletions packaging/homebrew-arm64/bee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ password-file: "/opt/homebrew/var/lib/swarm-bee/password"
# tracing-port: ""
## service name identifier for tracing
# tracing-service-name: bee
## gas limit fallback when estimation fails for contract transactions (default 500000)
# gas-limit-fallback: 500000
## skips the gas estimate step for contract transactions
# transaction-debug-mode: false
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace
Expand Down
2 changes: 2 additions & 0 deletions packaging/scoop/bee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ password-file: "./password"
# tracing-port: ""
## service name identifier for tracing
# tracing-service-name: bee
## gas limit fallback when estimation fails for contract transactions (default 500000)
# gas-limit-fallback: 500000
## skips the gas estimate step for contract transactions
# transaction-debug-mode: false
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace
Expand Down
3 changes: 2 additions & 1 deletion pkg/node/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func InitChain(
pollingInterval time.Duration,
chainEnabled bool,
minimumGasTipCap uint64,
fallbackGasLimit uint64,
) (transaction.Backend, common.Address, int64, transaction.Monitor, transaction.Service, error) {
backend := backendnoop.New(chainID)

Expand Down Expand Up @@ -91,7 +92,7 @@ func InitChain(

transactionMonitor := transaction.NewMonitor(logger, backend, overlayEthAddress, pollingInterval, cancellationDepth)

transactionService, err := transaction.NewService(logger, overlayEthAddress, backend, signer, stateStore, backendChainID, transactionMonitor)
transactionService, err := transaction.NewService(logger, overlayEthAddress, backend, signer, stateStore, backendChainID, transactionMonitor, fallbackGasLimit)
if err != nil {
return nil, common.Address{}, 0, nil, nil, fmt.Errorf("transaction service: %w", err)
}
Expand Down
15 changes: 12 additions & 3 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ type Options struct {
AutoTLSDomain string
AutoTLSRegistrationEndpoint string
FullNodeMode bool
GasLimitFallback uint64
Logger log.Logger
MinimumGasTipCap uint64
MinimumStorageRadius uint
Expand Down Expand Up @@ -412,6 +413,7 @@ func NewBee(
o.BlockTime,
chainEnabled,
o.MinimumGasTipCap,
o.GasLimitFallback,
)
if err != nil {
return nil, fmt.Errorf("init chain: %w", err)
Expand Down Expand Up @@ -698,6 +700,13 @@ func NewBee(
return nil, fmt.Errorf("lookup erc20 postage address: %w", err)
}

// Compute gas limit for contract transactions: when TrxDebugMode is enabled,
// gas estimation is skipped and DefaultGasLimit is used for all contract calls.
var contractGasLimit uint64
if o.TrxDebugMode {
contractGasLimit = transaction.DefaultGasLimit
}

postageStampContractService = postagecontract.New(
overlayEthAddress,
postageStampContractAddress,
Expand All @@ -707,7 +716,7 @@ func NewBee(
post,
batchStore,
chainEnabled,
o.TrxDebugMode,
contractGasLimit,
)

eventListener = listener.New(b.syncingStopped, logger, chainBackend, postageStampContractAddress, postageStampContractABI, o.BlockTime, postageSyncingStallingTimeout, postageSyncingBackoffTimeout)
Expand Down Expand Up @@ -1088,7 +1097,7 @@ func NewBee(
stakingContractAddress = common.HexToAddress(o.StakingContractAddress)
}

stakingContract := staking.New(overlayEthAddress, stakingContractAddress, abiutil.MustParseABI(chainCfg.StakingABI), bzzTokenAddress, transactionService, common.BytesToHash(nonce), o.TrxDebugMode, uint8(o.ReserveCapacityDoubling))
stakingContract := staking.New(overlayEthAddress, stakingContractAddress, abiutil.MustParseABI(chainCfg.StakingABI), bzzTokenAddress, transactionService, common.BytesToHash(nonce), contractGasLimit, uint8(o.ReserveCapacityDoubling))

if chainEnabled {

Expand Down Expand Up @@ -1179,7 +1188,7 @@ func NewBee(
redistributionContractAddress = common.HexToAddress(o.RedistributionContractAddress)
}

redistributionContract := redistribution.New(swarmAddress, overlayEthAddress, logger, transactionService, redistributionContractAddress, abiutil.MustParseABI(chainCfg.RedistributionABI), o.TrxDebugMode)
redistributionContract := redistribution.New(swarmAddress, overlayEthAddress, logger, transactionService, redistributionContractAddress, abiutil.MustParseABI(chainCfg.RedistributionABI), contractGasLimit)

isFullySynced := func() bool {
reserveThreshold := reserveCapacity * 5 / 10
Expand Down
7 changes: 1 addition & 6 deletions pkg/postage/postagecontract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,12 @@ func New(
postageService postage.Service,
postageStorer postage.Storer,
chainEnabled bool,
setGasLimit bool,
gasLimit uint64,
) Interface {
if !chainEnabled {
return new(noOpPostageContract)
}

var gasLimit uint64
if setGasLimit {
gasLimit = transaction.DefaultGasLimit
}

return &postageContract{
owner: owner,
postageStampContractAddress: postageStampContractAddress,
Expand Down
34 changes: 17 additions & 17 deletions pkg/postage/postagecontract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestCreateBatch(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

_, returnedID, err := contract.CreateBatch(ctx, initialBalance, depth, false, label)
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestCreateBatch(t *testing.T) {
postageMock.New(),
postagestoreMock.New(),
true,
false,
0,
)

_, _, err := contract.CreateBatch(ctx, initialBalance, depth, false, label)
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestCreateBatch(t *testing.T) {
postageMock.New(),
postagestoreMock.New(),
true,
false,
0,
)

_, _, err := contract.CreateBatch(ctx, initialBalance, depth, false, label)
Expand Down Expand Up @@ -249,7 +249,7 @@ func TestCreateBatch(t *testing.T) {
postageMock.New(),
postagestoreMock.New(),
true,
false,
0,
)

_, _, err = contract.CreateBatch(ctx, initialBalance, depth, false, label)
Expand Down Expand Up @@ -360,7 +360,7 @@ func TestTopUpBatch(t *testing.T) {
postageMock,
batchStoreMock,
true,
false,
0,
)

_, err = contract.TopUpBatch(ctx, batch.ID, topupBalance)
Expand Down Expand Up @@ -389,7 +389,7 @@ func TestTopUpBatch(t *testing.T) {
postageMock.New(),
postagestoreMock.New(postagestoreMock.WithGetErr(errNotFound, 0)),
true,
false,
0,
)

_, err := contract.TopUpBatch(ctx, postagetesting.MustNewID(), topupBalance)
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestTopUpBatch(t *testing.T) {
postageMock.New(),
batchStoreMock,
true,
false,
0,
)

_, err := contract.TopUpBatch(ctx, batch.ID, topupBalance)
Expand Down Expand Up @@ -549,7 +549,7 @@ func TestDiluteBatch(t *testing.T) {
postageMock,
batchStoreMock,
true,
false,
0,
)

_, err = contract.DiluteBatch(ctx, batch.ID, newDepth)
Expand Down Expand Up @@ -578,7 +578,7 @@ func TestDiluteBatch(t *testing.T) {
postageMock.New(),
postagestoreMock.New(postagestoreMock.WithGetErr(errNotFound, 0)),
true,
false,
0,
)

_, err := contract.DiluteBatch(ctx, postagetesting.MustNewID(), uint8(17))
Expand All @@ -601,7 +601,7 @@ func TestDiluteBatch(t *testing.T) {
postageMock.New(),
batchStoreMock,
true,
false,
0,
)

_, err := contract.DiluteBatch(ctx, batch.ID, batch.Depth-1)
Expand Down Expand Up @@ -678,7 +678,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -712,7 +712,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -746,7 +746,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -823,7 +823,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -858,7 +858,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -895,7 +895,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down Expand Up @@ -945,7 +945,7 @@ func TestBatchExpirer(t *testing.T) {
postageMock,
postagestoreMock.New(),
true,
false,
0,
)

err = contract.ExpireBatches(ctx)
Expand Down
7 changes: 1 addition & 6 deletions pkg/storageincentives/redistribution/redistribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,8 @@ func New(
txService transaction.Service,
incentivesContractAddress common.Address,
incentivesContractABI abi.ABI,
setGasLimit bool,
gasLimit uint64,
) Contract {
var gasLimit uint64
if setGasLimit {
gasLimit = transaction.DefaultGasLimit
}

return &contract{
overlay: overlay,
owner: owner,
Expand Down
Loading
Loading