Skip to content

Commit aa6868b

Browse files
chore: remove deprecated swap-endpoint and swap-deployment-gas-price (#5048)
1 parent 8eb41d5 commit aa6868b

File tree

9 files changed

+25
-51
lines changed

9 files changed

+25
-51
lines changed

cmd/bee/cmd/cmd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ const (
4949
optionNamePaymentEarly = "payment-early-percent"
5050
optionNameResolverEndpoints = "resolver-options"
5151
optionNameBootnodeMode = "bootnode-mode"
52-
optionNameSwapEndpoint = "swap-endpoint" // deprecated: use rpc endpoint instead
5352
optionNameBlockchainRpcEndpoint = "blockchain-rpc-endpoint"
5453
optionNameSwapFactoryAddress = "swap-factory-address"
5554
optionNameSwapInitialDeposit = "swap-initial-deposit"
5655
optionNameSwapEnable = "swap-enable"
5756
optionNameChequebookEnable = "chequebook-enable"
58-
optionNameSwapDeploymentGasPrice = "swap-deployment-gas-price"
5957
optionNameFullNode = "full-node"
6058
optionNamePostageContractAddress = "postage-stamp-address"
6159
optionNamePostageContractStartBlock = "postage-stamp-start-block"
@@ -261,7 +259,6 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
261259
cmd.Flags().Int64(optionNamePaymentEarly, 50, "percentage below the peers payment threshold when we initiate settlement")
262260
cmd.Flags().StringSlice(optionNameResolverEndpoints, []string{}, "ENS compatible API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url")
263261
cmd.Flags().Bool(optionNameBootnodeMode, false, "cause the node to always accept incoming connections")
264-
cmd.Flags().String(optionNameSwapEndpoint, "", "swap blockchain endpoint") // deprecated: use rpc endpoint instead
265262
cmd.Flags().String(optionNameBlockchainRpcEndpoint, "", "rpc blockchain endpoint")
266263
cmd.Flags().String(optionNameSwapFactoryAddress, "", "swap factory addresses")
267264
cmd.Flags().String(optionNameSwapInitialDeposit, "0", "initial deposit if deploying a new chequebook")
@@ -274,7 +271,6 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
274271
cmd.Flags().String(optionNameRedistributionAddress, "", "redistribution contract address")
275272
cmd.Flags().String(optionNameStakingAddress, "", "staking contract address")
276273
cmd.Flags().Uint64(optionNameBlockTime, 5, "chain block time")
277-
cmd.Flags().String(optionNameSwapDeploymentGasPrice, "", "gas price in wei to use for deployment and funding")
278274
cmd.Flags().Duration(optionWarmUpTime, time.Minute*5, "time to warmup the node before some major protocols can be kicked off")
279275
cmd.Flags().Bool(optionNameMainNet, true, "triggers connect to main net bootnodes.")
280276
cmd.Flags().Bool(optionNameRetrievalCaching, true, "enable forwarded content caching")

cmd/bee/cmd/deploy.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ func (c *command) initDeployCmd() error {
3434
dataDir := c.config.GetString(optionNameDataDir)
3535
factoryAddress := c.config.GetString(optionNameSwapFactoryAddress)
3636
swapInitialDeposit := c.config.GetString(optionNameSwapInitialDeposit)
37-
swapEndpoint := c.config.GetString(optionNameSwapEndpoint)
3837
blockchainRpcEndpoint := c.config.GetString(optionNameBlockchainRpcEndpoint)
39-
deployGasPrice := c.config.GetString(optionNameSwapDeploymentGasPrice)
40-
if swapEndpoint != "" {
41-
blockchainRpcEndpoint = swapEndpoint
42-
}
4338
stateStore, _, err := node.InitStateStore(logger, dataDir, 1000)
4439
if err != nil {
4540
return err
@@ -94,7 +89,6 @@ func (c *command) initDeployCmd() error {
9489
transactionService,
9590
chequebookFactory,
9691
swapInitialDeposit,
97-
deployGasPrice,
9892
erc20Service,
9993
)
10094
if err != nil {

cmd/bee/cmd/start.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
273273
return nil, errors.New("static nodes can only be configured on bootnodes")
274274
}
275275

276-
swapEndpoint := c.config.GetString(optionNameSwapEndpoint)
277-
blockchainRpcEndpoint := c.config.GetString(optionNameBlockchainRpcEndpoint)
278-
if swapEndpoint != "" {
279-
blockchainRpcEndpoint = swapEndpoint
280-
}
281-
282276
var neighborhoodSuggester string
283277
if networkID == chaincfg.Mainnet.NetworkID {
284278
neighborhoodSuggester = c.config.GetString(optionNameNeighborhoodSuggester)
@@ -307,7 +301,7 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
307301
PaymentEarly: c.config.GetInt64(optionNamePaymentEarly),
308302
ResolverConnectionCfgs: resolverCfgs,
309303
BootnodeMode: bootNode,
310-
BlockchainRpcEndpoint: blockchainRpcEndpoint,
304+
BlockchainRpcEndpoint: c.config.GetString(optionNameBlockchainRpcEndpoint),
311305
SwapFactoryAddress: c.config.GetString(optionNameSwapFactoryAddress),
312306
SwapInitialDeposit: c.config.GetString(optionNameSwapInitialDeposit),
313307
SwapEnable: c.config.GetBool(optionNameSwapEnable),
@@ -319,7 +313,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
319313
RedistributionContractAddress: c.config.GetString(optionNameRedistributionAddress),
320314
StakingContractAddress: c.config.GetString(optionNameStakingAddress),
321315
BlockTime: networkConfig.blockTime,
322-
DeployGasPrice: c.config.GetString(optionNameSwapDeploymentGasPrice),
323316
WarmupTime: c.config.GetDuration(optionWarmUpTime),
324317
ChainID: networkConfig.chainID,
325318
RetrievalCaching: c.config.GetBool(optionNameRetrievalCaching),

packaging/bee.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ password-file: "/var/lib/bee/password"
8686
# static-nodes: []
8787
## enable storage incentives feature
8888
# storage-incentives-enable: true
89-
## gas price in wei to use for deployment and funding
90-
# swap-deployment-gas-price: ""
9189
## enable swap
9290
# swap-enable: false
93-
## swap blockchain endpoint
94-
# swap-endpoint: ""
9591
## swap factory addresses
9692
# swap-factory-address: ""
9793
## initial deposit if deploying a new chequebook

packaging/homebrew-amd64/bee.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ password-file: "/usr/local/var/lib/swarm-bee/password"
8686
# static-nodes: []
8787
## enable storage incentives feature
8888
# storage-incentives-enable: true
89-
## gas price in wei to use for deployment and funding
90-
# swap-deployment-gas-price: ""
9189
## enable swap
9290
# swap-enable: false
93-
## swap blockchain endpoint
94-
# swap-endpoint: ""
9591
## swap factory addresses
9692
# swap-factory-address: ""
9793
## initial deposit if deploying a new chequebook

packaging/homebrew-arm64/bee.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ password-file: "/opt/homebrew/var/lib/swarm-bee/password"
8686
# static-nodes: []
8787
## enable storage incentives feature
8888
# storage-incentives-enable: true
89-
## gas price in wei to use for deployment and funding
90-
# swap-deployment-gas-price: ""
9189
## enable swap
9290
# swap-enable: false
93-
## swap blockchain endpoint
94-
# swap-endpoint: ""
9591
## swap factory addresses
9692
# swap-factory-address: ""
9793
## initial deposit if deploying a new chequebook

packaging/scoop/bee.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ password-file: "./password"
8686
# static-nodes: []
8787
## enable storage incentives feature
8888
# storage-incentives-enable: true
89-
## gas price in wei to use for deployment and funding
90-
# swap-deployment-gas-price: ""
9189
## enable swap
9290
# swap-enable: false
93-
## swap blockchain endpoint
94-
# swap-endpoint: ""
9591
## swap factory addresses
9692
# swap-factory-address: ""
9793
## initial deposit if deploying a new chequebook

pkg/node/chain.go

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/ethersphere/bee/v2/pkg/log"
2424
"github.com/ethersphere/bee/v2/pkg/p2p/libp2p"
2525
"github.com/ethersphere/bee/v2/pkg/postage/postagecontract"
26-
"github.com/ethersphere/bee/v2/pkg/sctx"
2726
"github.com/ethersphere/bee/v2/pkg/settlement"
2827
"github.com/ethersphere/bee/v2/pkg/settlement/swap"
2928
"github.com/ethersphere/bee/v2/pkg/settlement/swap/chequebook"
@@ -69,7 +68,7 @@ func InitChain(
6968
var versionString string
7069
err = rpcClient.CallContext(ctx, &versionString, "web3_clientVersion")
7170
if err != nil {
72-
logger.Info("could not connect to backend; in a swap-enabled network a working blockchain node (for xdai network in production, sepolia in testnet) is required; check your node or specify another node using --swap-endpoint.", "backend_endpoint", endpoint)
71+
logger.Info("could not connect to backend; in a swap-enabled network a working blockchain node (for xdai network in production, sepolia in testnet) is required; check your node or specify another node using --blockchain-rpc-endpoint.", "backend_endpoint", endpoint)
7372
return nil, common.Address{}, 0, nil, nil, fmt.Errorf("blockchain client get version: %w", err)
7473
}
7574

@@ -134,7 +133,6 @@ func InitChequebookService(
134133
transactionService transaction.Service,
135134
chequebookFactory chequebook.Factory,
136135
initialDeposit string,
137-
deployGasPrice string,
138136
erc20Service erc20.Service,
139137
) (chequebook.Service, error) {
140138
chequeSigner := chequebook.NewChequeSigner(signer, chainID)
@@ -144,14 +142,6 @@ func InitChequebookService(
144142
return nil, fmt.Errorf("initial swap deposit \"%s\" cannot be parsed", initialDeposit)
145143
}
146144

147-
if deployGasPrice != "" {
148-
gasPrice, ok := new(big.Int).SetString(deployGasPrice, 10)
149-
if !ok {
150-
return nil, fmt.Errorf("deploy gas price \"%s\" cannot be parsed", deployGasPrice)
151-
}
152-
ctx = sctx.SetGasPrice(ctx, gasPrice)
153-
}
154-
155145
chequebookService, err := chequebook.Init(
156146
ctx,
157147
chequebookFactory,
@@ -214,7 +204,6 @@ func InitSwap(
214204
chainID int64,
215205
transactionService transaction.Service,
216206
) (*swap.Service, priceoracle.Service, error) {
217-
218207
var currentPriceOracleAddress common.Address
219208
if priceOracleAddress == "" {
220209
chainCfg, found := config.GetByChainID(chainID)
@@ -260,7 +249,6 @@ func InitSwap(
260249
}
261250

262251
func GetTxHash(stateStore storage.StateStorer, logger log.Logger, trxString string) ([]byte, error) {
263-
264252
if trxString != "" {
265253
txHashTrimmed := strings.TrimPrefix(trxString, "0x")
266254
if len(txHashTrimmed) != 64 {
@@ -288,7 +276,6 @@ func GetTxHash(stateStore storage.StateStorer, logger log.Logger, trxString stri
288276
}
289277

290278
func GetTxNextBlock(ctx context.Context, logger log.Logger, backend transaction.Backend, monitor transaction.Monitor, duration time.Duration, trx []byte, blockHash string) ([]byte, error) {
291-
292279
if blockHash != "" {
293280
blockHashTrimmed := strings.TrimPrefix(blockHash, "0x")
294281
if len(blockHashTrimmed) != 64 {
@@ -321,27 +308,35 @@ type noOpChequebookService struct{}
321308
func (m *noOpChequebookService) Deposit(context.Context, *big.Int) (hash common.Hash, err error) {
322309
return hash, postagecontract.ErrChainDisabled
323310
}
311+
324312
func (m *noOpChequebookService) Withdraw(context.Context, *big.Int) (hash common.Hash, err error) {
325313
return hash, postagecontract.ErrChainDisabled
326314
}
315+
327316
func (m *noOpChequebookService) WaitForDeposit(context.Context, common.Hash) error {
328317
return postagecontract.ErrChainDisabled
329318
}
319+
330320
func (m *noOpChequebookService) Balance(context.Context) (*big.Int, error) {
331321
return nil, postagecontract.ErrChainDisabled
332322
}
323+
333324
func (m *noOpChequebookService) AvailableBalance(context.Context) (*big.Int, error) {
334325
return nil, postagecontract.ErrChainDisabled
335326
}
327+
336328
func (m *noOpChequebookService) Address() common.Address {
337329
return common.Address{}
338330
}
331+
339332
func (m *noOpChequebookService) Issue(context.Context, common.Address, *big.Int, chequebook.SendChequeFunc) (*big.Int, error) {
340333
return nil, postagecontract.ErrChainDisabled
341334
}
335+
342336
func (m *noOpChequebookService) LastCheque(common.Address) (*chequebook.SignedCheque, error) {
343337
return nil, postagecontract.ErrChainDisabled
344338
}
339+
345340
func (m *noOpChequebookService) LastCheques() (map[common.Address]*chequebook.SignedCheque, error) {
346341
return nil, postagecontract.ErrChainDisabled
347342
}
@@ -358,49 +353,63 @@ func (m noOpChainBackend) Metrics() []prometheus.Collector {
358353
func (m noOpChainBackend) CodeAt(context.Context, common.Address, *big.Int) ([]byte, error) {
359354
return common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_6_5), nil
360355
}
356+
361357
func (m noOpChainBackend) CallContract(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error) {
362358
return nil, errors.New("disabled chain backend")
363359
}
360+
364361
func (m noOpChainBackend) HeaderByNumber(context.Context, *big.Int) (*types.Header, error) {
365362
h := new(types.Header)
366363
h.Time = uint64(time.Now().Unix())
367364
return h, nil
368365
}
366+
369367
func (m noOpChainBackend) PendingNonceAt(context.Context, common.Address) (uint64, error) {
370368
panic("chain no op: PendingNonceAt")
371369
}
370+
372371
func (m noOpChainBackend) SuggestGasPrice(context.Context) (*big.Int, error) {
373372
panic("chain no op: SuggestGasPrice")
374373
}
374+
375375
func (m noOpChainBackend) SuggestGasTipCap(context.Context) (*big.Int, error) {
376376
panic("chain no op: SuggestGasPrice")
377377
}
378+
378379
func (m noOpChainBackend) EstimateGas(context.Context, ethereum.CallMsg) (uint64, error) {
379380
panic("chain no op: EstimateGas")
380381
}
382+
381383
func (m noOpChainBackend) SendTransaction(context.Context, *types.Transaction) error {
382384
panic("chain no op: SendTransaction")
383385
}
386+
384387
func (m noOpChainBackend) TransactionReceipt(context.Context, common.Hash) (*types.Receipt, error) {
385388
r := new(types.Receipt)
386389
r.BlockNumber = big.NewInt(1)
387390
return r, nil
388391
}
392+
389393
func (m noOpChainBackend) TransactionByHash(context.Context, common.Hash) (tx *types.Transaction, isPending bool, err error) {
390394
panic("chain no op: TransactionByHash")
391395
}
396+
392397
func (m noOpChainBackend) BlockNumber(context.Context) (uint64, error) {
393398
return 4, nil
394399
}
400+
395401
func (m noOpChainBackend) BalanceAt(context.Context, common.Address, *big.Int) (*big.Int, error) {
396402
return nil, postagecontract.ErrChainDisabled
397403
}
404+
398405
func (m noOpChainBackend) NonceAt(context.Context, common.Address, *big.Int) (uint64, error) {
399406
panic("chain no op: NonceAt")
400407
}
408+
401409
func (m noOpChainBackend) FilterLogs(context.Context, ethereum.FilterQuery) ([]types.Log, error) {
402410
panic("chain no op: FilterLogs")
403411
}
412+
404413
func (m noOpChainBackend) ChainID(context.Context) (*big.Int, error) {
405414
return big.NewInt(m.chainID), nil
406415
}

pkg/node/node.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ type Options struct {
158158
PriceOracleAddress string
159159
RedistributionContractAddress string
160160
BlockTime time.Duration
161-
DeployGasPrice string
162161
WarmupTime time.Duration
163162
ChainID int64
164163
Resync bool
@@ -258,7 +257,7 @@ func NewBee(
258257
if o.ReserveCapacityDoubling < 0 || o.ReserveCapacityDoubling > maxAllowedDoubling {
259258
return nil, fmt.Errorf("config reserve capacity doubling has to be between default: 0 and maximum: %d", maxAllowedDoubling)
260259
}
261-
var shallowReceiptTolerance = maxAllowedDoubling - o.ReserveCapacityDoubling
260+
shallowReceiptTolerance := maxAllowedDoubling - o.ReserveCapacityDoubling
262261

263262
reserveCapacity := (1 << o.ReserveCapacityDoubling) * storer.DefaultReserveCapacity
264263

@@ -523,7 +522,6 @@ func NewBee(
523522
transactionService,
524523
chequebookFactory,
525524
o.SwapInitialDeposit,
526-
o.DeployGasPrice,
527525
erc20Service,
528526
)
529527
if err != nil {

0 commit comments

Comments
 (0)