Compare commits

..

11 Commits

Author SHA1 Message Date
zjubfd
ed10dfa6bf Merge pull request #50 from binance-chain/p1.0.4
[R4R]add change log for release v1.0.4
2020-11-23 18:01:10 +08:00
fudongbai
3da36e6a55 add change log for release v1.0.4 2020-11-23 17:57:40 +08:00
zjubfd
c2feabad39 Merge pull request #49 from binance-chain/pr_template
[R4R]Create PULL_REQUEST_TEMPLATE
2020-11-17 17:26:20 +08:00
zjubfd
b0fcc0a663 Create PULL_REQUEST_TEMPLATE 2020-11-17 17:19:00 +08:00
zjubfd
58a91af56c Merge pull request #38 from hyunsikswap/remove-log
Disable noisy log from consensus engine
2020-11-17 16:51:30 +08:00
zjubfd
cca7667dcd Merge pull request #47 from binance-chain/golang1.15.5
[R4R]upgrade to golang1.15.5
2020-11-17 16:47:25 +08:00
zjubfd
1a50838431 Merge pull request #35 from binance-chain/fixedGas
[R4R]use fixed gas price when network is idle
2020-11-17 16:46:30 +08:00
fudongbai
d52d8a5f05 use fixed gas price since bsc network is idle 2020-11-17 16:38:20 +08:00
fudongbai
935c9e3c6a upgrade to golang1.15.5 2020-11-16 13:56:57 +08:00
Hyunsik Lee
cb1afd2b14 Hide some smart contract tracing logs from parlia consensus engine 2020-09-30 02:43:10 +09:00
Hyunsik Lee
7bd1c1f23d Disable noisy log from consensus engine 2020-09-30 02:43:09 +09:00
8 changed files with 84 additions and 27 deletions

View File

@@ -1,5 +1,14 @@
# 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
IMPROVEMENT

View File

@@ -1,7 +1,12 @@
# Build Geth in a stock Go builder container
FROM golang:1.14-alpine as builder
FROM golang:1.15-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
RUN cd /go-ethereum && make geth
@@ -13,4 +18,4 @@ RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
EXPOSE 8545 8546 8547 30303 30303/udp
ENTRYPOINT ["geth"]
ENTRYPOINT ["geth"]

31
PULL_REQUEST_TEMPLATE Normal file
View 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 ...

View File

@@ -680,7 +680,7 @@ func (p *Parlia) Finalize(chain consensus.ChainReader, header *types.Header, sta
}
}
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)
if err != nil {
// 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 {
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)
}
}
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)
}
@@ -999,7 +999,7 @@ func (p *Parlia) initContract(state *state.StateDB, header *types.Header, chain
for _, c := range contracts {
msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(c), data, common.Big0)
// 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)
if err != nil {
return err

View File

@@ -61,8 +61,9 @@ var DefaultConfig = Config{
},
TxPool: core.DefaultTxPoolConfig,
GPO: gasprice.Config{
Blocks: 20,
Percentile: 60,
Blocks: 20,
Percentile: 60,
OracleThreshold: 1000,
},
}

View File

@@ -32,9 +32,10 @@ import (
var maxPrice = big.NewInt(500 * params.GWei)
type Config struct {
Blocks int
Percentile int
Default *big.Int `toml:",omitempty"`
Blocks int
Percentile int
Default *big.Int `toml:",omitempty"`
OracleThreshold int `toml:",omitempty"`
}
// Oracle recommends gas prices based on the content of recent
@@ -46,6 +47,9 @@ type Oracle struct {
cacheLock sync.RWMutex
fetchLock sync.Mutex
defaultPrice *big.Int
sampleTxThreshold int
checkBlocks, maxEmpty, maxBlocks int
percentile int
}
@@ -64,12 +68,14 @@ func NewOracle(backend ethapi.Backend, params Config) *Oracle {
percent = 100
}
return &Oracle{
backend: backend,
lastPrice: params.Default,
checkBlocks: blocks,
maxEmpty: blocks / 2,
maxBlocks: blocks * 5,
percentile: percent,
backend: backend,
lastPrice: params.Default,
defaultPrice: params.Default,
checkBlocks: blocks,
maxEmpty: blocks / 2,
maxBlocks: blocks * 5,
percentile: percent,
sampleTxThreshold: params.OracleThreshold,
}
}
@@ -103,6 +109,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
sent := 0
exp := 0
var blockPrices []*big.Int
var totalTxSamples int
for sent < gpo.checkBlocks && blockNum > 0 {
go gpo.getBlockPrices(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(blockNum))), blockNum, ch)
sent++
@@ -118,6 +125,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
exp--
if res.price != nil {
blockPrices = append(blockPrices, res.price)
totalTxSamples = totalTxSamples + res.number
continue
}
if maxEmpty > 0 {
@@ -132,9 +140,11 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
}
}
price := lastPrice
if len(blockPrices) > 0 {
if len(blockPrices) > 0 && totalTxSamples > gpo.sampleTxThreshold {
sort.Sort(bigIntArray(blockPrices))
price = blockPrices[(len(blockPrices)-1)*gpo.percentile/100]
} else {
price = gpo.defaultPrice
}
if price.Cmp(maxPrice) > 0 {
price = new(big.Int).Set(maxPrice)
@@ -148,8 +158,9 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
}
type getBlockPricesResult struct {
price *big.Int
err error
number int
price *big.Int
err error
}
type transactionsByGasPrice []*types.Transaction
@@ -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) {
block, err := gpo.backend.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
if block == nil {
ch <- getBlockPricesResult{nil, err}
ch <- getBlockPricesResult{0, nil, err}
return
}
@@ -175,11 +186,11 @@ func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, bloc
for _, tx := range txs {
sender, err := types.Sender(signer, tx)
if err == nil && sender != block.Coinbase() {
ch <- getBlockPricesResult{tx.GasPrice(), nil}
ch <- getBlockPricesResult{len(txs), tx.GasPrice(), nil}
return
}
}
ch <- getBlockPricesResult{nil, nil}
ch <- getBlockPricesResult{0, nil, nil}
}
type bigIntArray []*big.Int

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/ethereum/go-ethereum
go 1.13
go 1.15
require (
github.com/Azure/azure-pipeline-go v0.2.2 // indirect

View File

@@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major 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
)