diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c3d2f5ec98ae..cbcd6de66db8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,9 +1,7 @@ name: Docker Image CI on: - push: - -tags: - - v1.2.0 + workflow_dispatch: jobs: @@ -39,7 +37,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} - name: Copy binary out of image - run: mkdir -p build/bin && docker create --name binContainer wyblockchain/kcc:latest && docker cp binContainer:/usr/local/bin/geth build/bin/geth && ls -la build/bin/geth + run: mkdir -p build/bin && docker create --name binContainer kucoincommunitychain/kcc:latest && docker cp binContainer:/usr/local/bin/geth build/bin/geth && ls -la build/bin/geth - uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 118fb9a0404a..801a99fa564e 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -147,6 +147,7 @@ var ( utils.GpoBlocksFlag, utils.GpoPercentileFlag, utils.GpoMaxGasPriceFlag, + utils.GpoMinGasPriceFlag, utils.EWASMInterpreterFlag, utils.EVMInterpreterFlag, configFileFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 54eb0be26a9a..4ae065103bfb 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -192,6 +192,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ utils.GpoBlocksFlag, utils.GpoPercentileFlag, utils.GpoMaxGasPriceFlag, + utils.GpoMinGasPriceFlag, }, }, { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index f5f93c31a362..4cba96f7448a 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -668,6 +668,11 @@ var ( Usage: "Maximum gas price will be recommended by gpo", Value: ethconfig.Defaults.GPO.MaxPrice.Int64(), } + GpoMinGasPriceFlag = cli.Int64Flag{ + Name: "gpo.minprice", + Usage: "Minimum gas price will be recommended by gpo", + Value: ethconfig.Defaults.GPO.MinPrice.Int64(), + } // Metrics flags MetricsEnabledFlag = cli.BoolFlag{ @@ -1238,6 +1243,9 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) { if ctx.GlobalIsSet(GpoMaxGasPriceFlag.Name) { cfg.MaxPrice = big.NewInt(ctx.GlobalInt64(GpoMaxGasPriceFlag.Name)) } + if ctx.GlobalIsSet(GpoMinGasPriceFlag.Name) { + cfg.MinPrice = big.NewInt(ctx.GlobalInt64(GpoMinGasPriceFlag.Name)) + } } func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 1f1403ce4029..f163e38cd26a 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -46,6 +46,7 @@ var FullNodeGPO = gasprice.Config{ Blocks: 20, Percentile: 60, MaxPrice: gasprice.DefaultMaxPrice, + MinPrice: gasprice.DefaultMinPrice, } // LightClientGPO contains default gasprice oracle settings for light client. @@ -53,6 +54,7 @@ var LightClientGPO = gasprice.Config{ Blocks: 2, Percentile: 60, MaxPrice: gasprice.DefaultMaxPrice, + MinPrice: gasprice.DefaultMinPrice, } // Defaults contains default settings for use on the Ethereum main net. diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index 5d8be08e0b78..5c9186e6f1be 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -32,12 +32,14 @@ import ( const sampleNumber = 3 // Number of transactions sampled in a block var DefaultMaxPrice = big.NewInt(500 * params.GWei) +var DefaultMinPrice = big.NewInt(3 * params.GWei) type Config struct { Blocks int Percentile int Default *big.Int `toml:",omitempty"` MaxPrice *big.Int `toml:",omitempty"` + MinPrice *big.Int `toml:",omitempty"` } // OracleBackend includes all necessary background APIs for oracle. @@ -54,6 +56,7 @@ type Oracle struct { lastHead common.Hash lastPrice *big.Int maxPrice *big.Int + minPrice *big.Int cacheLock sync.RWMutex fetchLock sync.Mutex @@ -83,10 +86,16 @@ func NewOracle(backend OracleBackend, params Config) *Oracle { maxPrice = DefaultMaxPrice log.Warn("Sanitizing invalid gasprice oracle price cap", "provided", params.MaxPrice, "updated", maxPrice) } + minPrice := params.MinPrice + if minPrice == nil || minPrice.Int64() <= 0 { + minPrice = DefaultMinPrice + log.Warn("Sanitizing invalid gasprice oracle price floor", "provided", params.MinPrice, "updated", minPrice) + } return &Oracle{ backend: backend, lastPrice: params.Default, maxPrice: maxPrice, + minPrice: minPrice, checkBlocks: blocks, percentile: percent, } @@ -161,6 +170,11 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) { if price.Cmp(gpo.maxPrice) > 0 { price = new(big.Int).Set(gpo.maxPrice) } + + if price.Cmp(gpo.minPrice) < 0 { + price = new(big.Int).Set(gpo.minPrice) + } + gpo.cacheLock.Lock() gpo.lastHead = headHash gpo.lastPrice = price diff --git a/params/version.go b/params/version.go index c7d95acc1967..cb8df3e62743 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 0 // Patch version component of the current release + VersionPatch = 1 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )