Skip to content

Commit be727f4

Browse files
authored
BEP-520: Short Block Interval Phase One: 1.5 seconds (#2932)
* BEP-520: Short Block Interval Phase One: 1.5 seconds * consensus/parlia: revert function backOffTime * consensus/parlia: change lorentzEpochLength to 500 * consensus/parlia: add a slash systemtx when delay mining happens * Revert "consensus/parlia: revert function backOffTime" This reverts commit 24bf9d5. * consensus/parlia: revert punish for intentional delay mining * core/systemcontracts: update bytecodes for lorentz * params: not define DefaultLorentzBlobConfigBSC * params: remove Lorentz in BlobScheduleConfig * consensus/parlia: use unit64 to express epochLength and blockInterval * consensus/parlia: remove unnecessary change in distributeIncoming * consensus/parlia: fix snapshot recovery * log: improve debug log * clear: resolve comments
1 parent 09e56d9 commit be727f4

32 files changed

+432
-211
lines changed

cmd/geth/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
227227
}
228228
if ctx.IsSet(utils.OverrideMinBlocksForBlobRequests.Name) {
229229
params.MinBlocksForBlobRequests = ctx.Uint64(utils.OverrideMinBlocksForBlobRequests.Name)
230+
params.MinTimeDurationForBlobRequests = uint64(float64(params.MinBlocksForBlobRequests) * 1.5 /*lorentzBlockInterval*/)
230231
}
231232
if ctx.IsSet(utils.OverrideDefaultExtraReserveForBlobRequests.Name) {
232233
params.DefaultExtraReserveForBlobRequests = ctx.Uint64(utils.OverrideDefaultExtraReserveForBlobRequests.Name)

cmd/jsutils/getchainstatus.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ async function getPerformanceData() {
347347
if (difficulty == 2) {
348348
inturnBlocks += 1
349349
}
350-
let timestamp = eval(eval(header.timestamp).toString(10))
350+
let timestamp = eval(eval(header.milliTimestamp).toString(10))
351351
if (parliaEnabled) {
352352
let justifiedNumber = await provider.send("parlia_getJustifiedNumber", [ethers.toQuantity(i)]);
353353
if (justifiedNumber + 1 == i) {
@@ -363,11 +363,11 @@ async function getPerformanceData() {
363363

364364
let startHeader = await provider.send("eth_getHeaderByNumber", [
365365
ethers.toQuantity(program.startNum)]);
366-
let startTime = eval(eval(startHeader.timestamp).toString(10))
366+
let startTime = eval(eval(startHeader.milliTimestamp).toString(10))
367367
let endHeader = await provider.send("eth_getHeaderByNumber", [
368368
ethers.toQuantity(program.endNum)]);
369-
let endTime = eval(eval(endHeader.timestamp).toString(10))
370-
let timeCost = endTime - startTime
369+
let endTime = eval(eval(endHeader.milliTimestamp).toString(10))
370+
let timeCost = (endTime - startTime)/1000
371371
let avgBlockTime = timeCost/blockCount
372372
let inturnBlocksRatio = inturnBlocks/blockCount
373373
let justifiedBlocksRatio = justifiedBlocks/blockCount

common/bidutil/bidutil.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func BidBetterBefore(parentHeader *types.Header, blockPeriod uint64, delayLeftOv
1717
// BidMustBefore returns the time when the next bid must be received,
1818
// only considering the consensus delay but not bid simulation duration.
1919
func BidMustBefore(parentHeader *types.Header, blockPeriod uint64, delayLeftOver time.Duration) time.Time {
20-
nextHeaderTime := time.Unix(int64(parentHeader.Time+blockPeriod), 0)
20+
nextHeaderTime := time.UnixMilli(int64(parentHeader.MilliTimestamp() + blockPeriod))
2121
nextHeaderTime = nextHeaderTime.Add(-delayLeftOver)
2222
return nextHeaderTime
2323
}

consensus/consensus.go

-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,5 @@ type PoSA interface {
162162
GetFinalizedHeader(chain ChainHeaderReader, header *types.Header) *types.Header
163163
VerifyVote(chain ChainHeaderReader, vote *types.VoteEnvelope) error
164164
IsActiveValidatorAt(chain ChainHeaderReader, header *types.Header, checkVoteKeyFn func(bLSPublicKey *types.BLSPublicKey) bool) bool
165-
BlockInterval() uint64
166165
NextProposalBlock(chain ChainHeaderReader, header *types.Header, proposer common.Address) (uint64, uint64, error)
167166
}

consensus/misc/eip1559/eip1559_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig {
5252
func config() *params.ChainConfig {
5353
config := copyConfig(params.TestChainConfig)
5454
config.Ethash = nil
55-
config.Parlia = &params.ParliaConfig{
56-
Period: 3,
57-
Epoch: 200,
58-
}
55+
config.Parlia = &params.ParliaConfig{}
5956
config.LondonBlock = big.NewInt(5)
6057
return config
6158
}

consensus/misc/eip4844/eip4844.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
8383
func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int {
8484
var frac uint64
8585
switch config.LatestFork(header.Time) {
86-
case forks.Prague:
86+
case forks.Lorentz, forks.Prague:
8787
frac = config.BlobScheduleConfig.Prague.UpdateFraction
8888
case forks.Cancun:
8989
frac = config.BlobScheduleConfig.Cancun.UpdateFraction

consensus/parlia/abi.go

-13
Original file line numberDiff line numberDiff line change
@@ -1501,19 +1501,6 @@ const validatorSetABI = `
15011501
],
15021502
"stateMutability": "view"
15031503
},
1504-
{
1505-
"type": "function",
1506-
"name": "EPOCH",
1507-
"inputs": [],
1508-
"outputs": [
1509-
{
1510-
"name": "",
1511-
"type": "uint256",
1512-
"internalType": "uint256"
1513-
}
1514-
],
1515-
"stateMutability": "view"
1516-
},
15171504
{
15181505
"type": "function",
15191506
"name": "ERROR_FAIL_CHECK_VALIDATORS",

0 commit comments

Comments
 (0)