Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed10dfa6bf | ||
|
|
3da36e6a55 | ||
|
|
c2feabad39 | ||
|
|
b0fcc0a663 | ||
|
|
58a91af56c | ||
|
|
cca7667dcd | ||
|
|
1a50838431 | ||
|
|
d52d8a5f05 | ||
|
|
935c9e3c6a | ||
|
|
cb1afd2b14 | ||
|
|
7bd1c1f23d |
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.0.4
|
||||||
|
|
||||||
|
IMPROVEMENT
|
||||||
|
* [\#35](https://github.com/binance-chain/bsc/pull/35) use fixed gas price when network is idle
|
||||||
|
* [\#38](https://github.com/binance-chain/bsc/pull/38) disable noisy log from consensus engine
|
||||||
|
* [\#47](https://github.com/binance-chain/bsc/pull/47) upgrade to golang1.15.5
|
||||||
|
* [\#49](https://github.com/binance-chain/bsc/pull/49) Create pull request template for all developer to follow
|
||||||
|
|
||||||
|
|
||||||
## v1.0.3
|
## v1.0.3
|
||||||
|
|
||||||
IMPROVEMENT
|
IMPROVEMENT
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -1,7 +1,12 @@
|
|||||||
# Build Geth in a stock Go builder container
|
FROM golang:1.15-alpine as builder
|
||||||
FROM golang:1.14-alpine as builder
|
|
||||||
|
|
||||||
RUN apk add --no-cache make gcc musl-dev linux-headers git
|
RUN apk add --no-cache make gcc musl-dev linux-headers git bash
|
||||||
|
|
||||||
|
# Temporarily pull a custom Go bundle
|
||||||
|
ADD https://golang.org/dl/go1.15.5.src.tar.gz /tmp/go.tar.gz
|
||||||
|
RUN (cd /tmp && tar -xf go.tar.gz)
|
||||||
|
RUN (cd /tmp/go/src && ./make.bash)
|
||||||
|
ENV PATH="/tmp/go/bin:${PATH}"
|
||||||
|
|
||||||
ADD . /go-ethereum
|
ADD . /go-ethereum
|
||||||
RUN cd /go-ethereum && make geth
|
RUN cd /go-ethereum && make geth
|
||||||
|
|||||||
31
PULL_REQUEST_TEMPLATE
Normal file
31
PULL_REQUEST_TEMPLATE
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
### Description
|
||||||
|
|
||||||
|
add a description of your changes here...
|
||||||
|
|
||||||
|
### Rationale
|
||||||
|
|
||||||
|
tell us why we need these changes...
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
add an example CLI or API response...
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
Notable changes:
|
||||||
|
* add each change in a bullet point here
|
||||||
|
* ...
|
||||||
|
|
||||||
|
### Preflight checks
|
||||||
|
|
||||||
|
- [ ] build passed (`make build`)
|
||||||
|
- [ ] tests passed (`make test`)
|
||||||
|
- [ ] manual transaction test passed
|
||||||
|
|
||||||
|
### Already reviewed by
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
### Related issues
|
||||||
|
|
||||||
|
... reference related issue #'s here ...
|
||||||
@@ -680,7 +680,7 @@ func (p *Parlia) Finalize(chain consensus.ChainReader, header *types.Header, sta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !signedRecently {
|
if !signedRecently {
|
||||||
log.Info("slash validator", "block hash", header.Hash(), "address", spoiledVal)
|
log.Trace("slash validator", "block hash", header.Hash(), "address", spoiledVal)
|
||||||
err = p.slash(spoiledVal, state, header, cx, txs, receipts, systemTxs, usedGas, false)
|
err = p.slash(spoiledVal, state, header, cx, txs, receipts, systemTxs, usedGas, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// it is possible that slash validator failed because of the slash channel is disabled.
|
// it is possible that slash validator failed because of the slash channel is disabled.
|
||||||
@@ -947,11 +947,11 @@ func (p *Parlia) distributeIncoming(val common.Address, state *state.StateDB, he
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Info("distribute to system reward pool", "block hash", header.Hash(), "amount", rewards)
|
log.Trace("distribute to system reward pool", "block hash", header.Hash(), "amount", rewards)
|
||||||
balance = balance.Sub(balance, rewards)
|
balance = balance.Sub(balance, rewards)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Info("distribute to validator contract", "block hash", header.Hash(), "amount", balance)
|
log.Trace("distribute to validator contract", "block hash", header.Hash(), "amount", balance)
|
||||||
return p.distributeToValidator(balance, val, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
|
return p.distributeToValidator(balance, val, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -999,7 +999,7 @@ func (p *Parlia) initContract(state *state.StateDB, header *types.Header, chain
|
|||||||
for _, c := range contracts {
|
for _, c := range contracts {
|
||||||
msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(c), data, common.Big0)
|
msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(c), data, common.Big0)
|
||||||
// apply message
|
// apply message
|
||||||
log.Info("init contract", "block hash", header.Hash(), "contract", c)
|
log.Trace("init contract", "block hash", header.Hash(), "contract", c)
|
||||||
err = p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
|
err = p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ var DefaultConfig = Config{
|
|||||||
GPO: gasprice.Config{
|
GPO: gasprice.Config{
|
||||||
Blocks: 20,
|
Blocks: 20,
|
||||||
Percentile: 60,
|
Percentile: 60,
|
||||||
|
OracleThreshold: 1000,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ type Config struct {
|
|||||||
Blocks int
|
Blocks int
|
||||||
Percentile int
|
Percentile int
|
||||||
Default *big.Int `toml:",omitempty"`
|
Default *big.Int `toml:",omitempty"`
|
||||||
|
OracleThreshold int `toml:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Oracle recommends gas prices based on the content of recent
|
// Oracle recommends gas prices based on the content of recent
|
||||||
@@ -46,6 +47,9 @@ type Oracle struct {
|
|||||||
cacheLock sync.RWMutex
|
cacheLock sync.RWMutex
|
||||||
fetchLock sync.Mutex
|
fetchLock sync.Mutex
|
||||||
|
|
||||||
|
defaultPrice *big.Int
|
||||||
|
sampleTxThreshold int
|
||||||
|
|
||||||
checkBlocks, maxEmpty, maxBlocks int
|
checkBlocks, maxEmpty, maxBlocks int
|
||||||
percentile int
|
percentile int
|
||||||
}
|
}
|
||||||
@@ -66,10 +70,12 @@ func NewOracle(backend ethapi.Backend, params Config) *Oracle {
|
|||||||
return &Oracle{
|
return &Oracle{
|
||||||
backend: backend,
|
backend: backend,
|
||||||
lastPrice: params.Default,
|
lastPrice: params.Default,
|
||||||
|
defaultPrice: params.Default,
|
||||||
checkBlocks: blocks,
|
checkBlocks: blocks,
|
||||||
maxEmpty: blocks / 2,
|
maxEmpty: blocks / 2,
|
||||||
maxBlocks: blocks * 5,
|
maxBlocks: blocks * 5,
|
||||||
percentile: percent,
|
percentile: percent,
|
||||||
|
sampleTxThreshold: params.OracleThreshold,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +109,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
|||||||
sent := 0
|
sent := 0
|
||||||
exp := 0
|
exp := 0
|
||||||
var blockPrices []*big.Int
|
var blockPrices []*big.Int
|
||||||
|
var totalTxSamples int
|
||||||
for sent < gpo.checkBlocks && blockNum > 0 {
|
for sent < gpo.checkBlocks && blockNum > 0 {
|
||||||
go gpo.getBlockPrices(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(blockNum))), blockNum, ch)
|
go gpo.getBlockPrices(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(blockNum))), blockNum, ch)
|
||||||
sent++
|
sent++
|
||||||
@@ -118,6 +125,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
|||||||
exp--
|
exp--
|
||||||
if res.price != nil {
|
if res.price != nil {
|
||||||
blockPrices = append(blockPrices, res.price)
|
blockPrices = append(blockPrices, res.price)
|
||||||
|
totalTxSamples = totalTxSamples + res.number
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if maxEmpty > 0 {
|
if maxEmpty > 0 {
|
||||||
@@ -132,9 +140,11 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
price := lastPrice
|
price := lastPrice
|
||||||
if len(blockPrices) > 0 {
|
if len(blockPrices) > 0 && totalTxSamples > gpo.sampleTxThreshold {
|
||||||
sort.Sort(bigIntArray(blockPrices))
|
sort.Sort(bigIntArray(blockPrices))
|
||||||
price = blockPrices[(len(blockPrices)-1)*gpo.percentile/100]
|
price = blockPrices[(len(blockPrices)-1)*gpo.percentile/100]
|
||||||
|
} else {
|
||||||
|
price = gpo.defaultPrice
|
||||||
}
|
}
|
||||||
if price.Cmp(maxPrice) > 0 {
|
if price.Cmp(maxPrice) > 0 {
|
||||||
price = new(big.Int).Set(maxPrice)
|
price = new(big.Int).Set(maxPrice)
|
||||||
@@ -148,6 +158,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type getBlockPricesResult struct {
|
type getBlockPricesResult struct {
|
||||||
|
number int
|
||||||
price *big.Int
|
price *big.Int
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
@@ -163,7 +174,7 @@ func (t transactionsByGasPrice) Less(i, j int) bool { return t[i].GasPrice().Cmp
|
|||||||
func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, blockNum uint64, ch chan getBlockPricesResult) {
|
func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, blockNum uint64, ch chan getBlockPricesResult) {
|
||||||
block, err := gpo.backend.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
|
block, err := gpo.backend.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
|
||||||
if block == nil {
|
if block == nil {
|
||||||
ch <- getBlockPricesResult{nil, err}
|
ch <- getBlockPricesResult{0, nil, err}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,11 +186,11 @@ func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, bloc
|
|||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
sender, err := types.Sender(signer, tx)
|
sender, err := types.Sender(signer, tx)
|
||||||
if err == nil && sender != block.Coinbase() {
|
if err == nil && sender != block.Coinbase() {
|
||||||
ch <- getBlockPricesResult{tx.GasPrice(), nil}
|
ch <- getBlockPricesResult{len(txs), tx.GasPrice(), nil}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ch <- getBlockPricesResult{nil, nil}
|
ch <- getBlockPricesResult{0, nil, nil}
|
||||||
}
|
}
|
||||||
|
|
||||||
type bigIntArray []*big.Int
|
type bigIntArray []*big.Int
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/ethereum/go-ethereum
|
module github.com/ethereum/go-ethereum
|
||||||
|
|
||||||
go 1.13
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
|
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 0 // Minor version component of the current release
|
VersionMinor = 0 // Minor version component of the current release
|
||||||
VersionPatch = 3 // Patch version component of the current release
|
VersionPatch = 4 // Patch version component of the current release
|
||||||
VersionMeta = "" // Version metadata to append to the version string
|
VersionMeta = "" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user