Compare commits

..

6 Commits

Author SHA1 Message Date
Ethan
9579134117 chores: update pascal-hardfork contracts repo commit id 2024-09-23 11:54:26 +08:00
Ethan
ca566b4491 chores: update pascal-hardfork contracts repo commit id 2024-09-23 11:45:17 +08:00
Ethan
10c15c997e feat: update bytecode on dev env 2024-09-10 11:51:01 +08:00
Ethan
20147c351e chores: rename some contract name 2024-09-10 11:51:01 +08:00
buddho
5c72898a0b config: fix default value for PascalTime and add OverridePascal (#2693) 2024-09-10 11:51:01 +08:00
Ethan
df4dc499c7 feat: add pascal hardfork 2024-09-10 11:51:01 +08:00
78 changed files with 579 additions and 67 deletions

View File

@@ -1,14 +0,0 @@
# 1.Background
This is to support some projects with customized tokens that they want to integrate into the BSC faucet tool.
## 1.1. How to Integrate Your Token
- Step 1: Submmit a Pull Request to [bsc develop branch](https://github.com/bnb-chain/bsc/tree/develop) with relevant token information: `symbol`, `amount`, `icon`, `addr`. Append these information in [Section 2: Token List](#2token-list)
- Step 2: Wait for approval, we will review the request, and once it is approved, the faucet tool will start to support the customized token and list it on https://www.bnbchain.org/en/testnet-faucet.
- Step 3: Deposit your test token to designated address(0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3) on the BSC testnet.
# 2.Token List
## 2.1.DemoToken
- symbol: DEMO
- amount: 10000000000000000000
- icon: ./demotoken.png
- addr: https://testnet.bscscan.com/address/0xe15c158d768c306dae87b96430a94f884333e55d

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -500,7 +500,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
continue
}
// check #2: check IP and ID(address) to ensure the user didn't request funds too frequently
// check #2: check IP and ID(address) to ensure the user didn't request funds too recently,
f.lock.Lock()
if ipTimeout := f.timeouts[ips[len(ips)-2]]; time.Now().Before(ipTimeout) {

View File

@@ -64,6 +64,7 @@ var (
utils.CachePreimagesFlag,
utils.OverridePassedForkTime,
utils.OverrideBohr,
utils.OverridePascal,
utils.OverrideVerkle,
utils.MultiDataBaseFlag,
}, utils.DatabaseFlags),
@@ -262,6 +263,10 @@ func initGenesis(ctx *cli.Context) error {
v := ctx.Uint64(utils.OverrideBohr.Name)
overrides.OverrideBohr = &v
}
if ctx.IsSet(utils.OverridePascal.Name) {
v := ctx.Uint64(utils.OverridePascal.Name)
overrides.OverridePascal = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
overrides.OverrideVerkle = &v

View File

@@ -195,6 +195,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideBohr.Name)
cfg.Eth.OverrideBohr = &v
}
if ctx.IsSet(utils.OverridePascal.Name) {
v := ctx.Uint64(utils.OverridePascal.Name)
cfg.Eth.OverridePascal = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v

View File

@@ -74,6 +74,7 @@ var (
utils.RialtoHash,
utils.OverridePassedForkTime,
utils.OverrideBohr,
utils.OverridePascal,
utils.OverrideVerkle,
utils.OverrideFullImmutabilityThreshold,
utils.OverrideMinBlocksForBlobRequests,

View File

@@ -310,7 +310,7 @@ var (
}
OverridePassedForkTime = &cli.Uint64Flag{
Name: "override.passedforktime",
Usage: "Manually specify the hard fork timestamp except the last one, overriding the bundled setting",
Usage: "Manually specify the hard fork timestamps which have passed on the mainnet, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideBohr = &cli.Uint64Flag{
@@ -318,6 +318,11 @@ var (
Usage: "Manually specify the Bohr fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverridePascal = &cli.Uint64Flag{
Name: "override.pascal",
Usage: "Manually specify the Pascal fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideVerkle = &cli.Uint64Flag{
Name: "override.verkle",
Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting",

View File

@@ -68,6 +68,7 @@ const (
wiggleTime = uint64(1) // second, Random delay (per signer) to allow concurrent signers
initialBackOffTime = uint64(1) // second
processBackOffTime = uint64(1) // second
systemRewardPercent = 4 // it means 1/2^4 = 1/16 percentage of gas fee incoming will be distributed to system
@@ -1615,15 +1616,12 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
copy(header.Extra[len(header.Extra)-extraSeal:], sig)
if p.shouldWaitForCurrentBlockProcess(chain, header, snap) {
highestVerifiedHeader := chain.GetHighestVerifiedHeader()
// including time for writing and committing blocks
waitProcessEstimate := math.Ceil(float64(highestVerifiedHeader.GasUsed) / float64(100_000_000))
log.Info("Waiting for received in turn block to process", "waitProcessEstimate(Seconds)", waitProcessEstimate)
log.Info("Waiting for received in turn block to process")
select {
case <-stop:
log.Info("Received block process finished, abort block seal")
return
case <-time.After(time.Duration(waitProcessEstimate) * time.Second):
case <-time.After(time.Duration(processBackOffTime) * time.Second):
if chain.CurrentHeader().Number.Uint64() >= header.Number.Uint64() {
log.Info("Process backoff time exhausted, and current header has updated to abort this seal")
return

View File

@@ -218,6 +218,7 @@ func (e *GenesisMismatchError) Error() string {
type ChainOverrides struct {
OverridePassedForkTime *uint64
OverrideBohr *uint64
OverridePascal *uint64
OverrideVerkle *uint64
}
@@ -256,6 +257,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
if overrides != nil && overrides.OverrideBohr != nil {
config.BohrTime = overrides.OverrideBohr
}
if overrides != nil && overrides.OverridePascal != nil {
config.PascalTime = overrides.OverridePascal
}
if overrides != nil && overrides.OverrideVerkle != nil {
config.VerkleTime = overrides.OverrideVerkle
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,168 @@
package pascal
import _ "embed"
// contract codes for Mainnet upgrade
var (
//go:embed mainnet/ValidatorContract
MainnetValidatorContract string
//go:embed mainnet/SlashContract
MainnetSlashContract string
//go:embed mainnet/SystemRewardContract
MainnetSystemRewardContract string
//go:embed mainnet/LightClientContract
MainnetLightClientContract string
//go:embed mainnet/TokenHubContract
MainnetTokenHubContract string
//go:embed mainnet/RelayerIncentivizeContract
MainnetRelayerIncentivizeContract string
//go:embed mainnet/RelayerHubContract
MainnetRelayerHubContract string
//go:embed mainnet/GovHubContract
MainnetGovHubContract string
//go:embed mainnet/TokenManagerContract
MainnetTokenManagerContract string
//go:embed mainnet/CrossChainContract
MainnetCrossChainContract string
//go:embed mainnet/StakingContract
MainnetStakingContract string
//go:embed mainnet/StakeHubContract
MainnetStakeHubContract string
//go:embed mainnet/StakeCreditContract
MainnetStakeCreditContract string
//go:embed mainnet/GovernorContract
MainnetGovernorContract string
//go:embed mainnet/GovTokenContract
MainnetGovTokenContract string
//go:embed mainnet/TimelockContract
MainnetTimelockContract string
//go:embed mainnet/TokenRecoverPortalContract
MainnetTokenRecoverPortalContract string
)
// contract codes for Chapel upgrade
var (
//go:embed chapel/ValidatorContract
ChapelValidatorContract string
//go:embed chapel/SlashContract
ChapelSlashContract string
//go:embed chapel/SystemRewardContract
ChapelSystemRewardContract string
//go:embed chapel/LightClientContract
ChapelLightClientContract string
//go:embed chapel/TokenHubContract
ChapelTokenHubContract string
//go:embed chapel/RelayerIncentivizeContract
ChapelRelayerIncentivizeContract string
//go:embed chapel/RelayerHubContract
ChapelRelayerHubContract string
//go:embed chapel/GovHubContract
ChapelGovHubContract string
//go:embed chapel/TokenManagerContract
ChapelTokenManagerContract string
//go:embed chapel/CrossChainContract
ChapelCrossChainContract string
//go:embed chapel/StakingContract
ChapelStakingContract string
//go:embed chapel/StakeHubContract
ChapelStakeHubContract string
//go:embed chapel/StakeCreditContract
ChapelStakeCreditContract string
//go:embed chapel/GovernorContract
ChapelGovernorContract string
//go:embed chapel/GovTokenContract
ChapelGovTokenContract string
//go:embed chapel/TimelockContract
ChapelTimelockContract string
//go:embed chapel/TokenRecoverPortalContract
ChapelTokenRecoverPortalContract string
)
// contract codes for Rialto upgrade
var (
//go:embed rialto/ValidatorContract
RialtoValidatorContract string
//go:embed rialto/SlashContract
RialtoSlashContract string
//go:embed rialto/SystemRewardContract
RialtoSystemRewardContract string
//go:embed rialto/LightClientContract
RialtoLightClientContract string
//go:embed rialto/TokenHubContract
RialtoTokenHubContract string
//go:embed rialto/RelayerIncentivizeContract
RialtoRelayerIncentivizeContract string
//go:embed rialto/RelayerHubContract
RialtoRelayerHubContract string
//go:embed rialto/GovHubContract
RialtoGovHubContract string
//go:embed rialto/TokenManagerContract
RialtoTokenManagerContract string
//go:embed rialto/CrossChainContract
RialtoCrossChainContract string
//go:embed rialto/StakingContract
RialtoStakingContract string
//go:embed rialto/StakeHubContract
RialtoStakeHubContract string
//go:embed rialto/StakeCreditContract
RialtoStakeCreditContract string
//go:embed rialto/GovernorContract
RialtoGovernorContract string
//go:embed rialto/GovTokenContract
RialtoGovTokenContract string
//go:embed rialto/TimelockContract
RialtoTimelockContract string
//go:embed rialto/TokenRecoverPortalContract
RialtoTokenRecoverPortalContract string
)

View File

@@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/core/systemcontracts/mirror"
"github.com/ethereum/go-ethereum/core/systemcontracts/moran"
"github.com/ethereum/go-ethereum/core/systemcontracts/niels"
"github.com/ethereum/go-ethereum/core/systemcontracts/pascal"
"github.com/ethereum/go-ethereum/core/systemcontracts/planck"
"github.com/ethereum/go-ethereum/core/systemcontracts/plato"
"github.com/ethereum/go-ethereum/core/systemcontracts/ramanujan"
@@ -82,6 +83,8 @@ var (
haberFixUpgrade = make(map[string]*Upgrade)
bohrUpgrade = make(map[string]*Upgrade)
pascalUpgrade = make(map[string]*Upgrade)
)
func init() {
@@ -788,6 +791,279 @@ func init() {
},
},
}
pascalUpgrade[mainNet] = &Upgrade{
UpgradeName: "pascal",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetValidatorContract,
},
{
ContractAddr: common.HexToAddress(SlashContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetSlashContract,
},
{
ContractAddr: common.HexToAddress(SystemRewardContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetSystemRewardContract,
},
{
ContractAddr: common.HexToAddress(LightClientContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetLightClientContract,
},
{
ContractAddr: common.HexToAddress(TokenHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetTokenHubContract,
},
{
ContractAddr: common.HexToAddress(RelayerIncentivizeContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetRelayerIncentivizeContract,
},
{
ContractAddr: common.HexToAddress(RelayerHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetRelayerHubContract,
},
{
ContractAddr: common.HexToAddress(GovHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetGovHubContract,
},
{
ContractAddr: common.HexToAddress(TokenManagerContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetTokenManagerContract,
},
{
ContractAddr: common.HexToAddress(CrossChainContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetCrossChainContract,
},
{
ContractAddr: common.HexToAddress(StakingContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetStakingContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetStakeHubContract,
},
{
ContractAddr: common.HexToAddress(StakeCreditContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetStakeCreditContract,
},
{
ContractAddr: common.HexToAddress(GovernorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetGovernorContract,
},
{
ContractAddr: common.HexToAddress(GovTokenContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetGovTokenContract,
},
{
ContractAddr: common.HexToAddress(TimelockContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetTimelockContract,
},
{
ContractAddr: common.HexToAddress(TokenRecoverPortalContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.MainnetTokenRecoverPortalContract,
},
},
}
pascalUpgrade[chapelNet] = &Upgrade{
UpgradeName: "pascal",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelValidatorContract,
},
{
ContractAddr: common.HexToAddress(SlashContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelSlashContract,
},
{
ContractAddr: common.HexToAddress(SystemRewardContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelSystemRewardContract,
},
{
ContractAddr: common.HexToAddress(LightClientContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelLightClientContract,
},
{
ContractAddr: common.HexToAddress(TokenHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelTokenHubContract,
},
{
ContractAddr: common.HexToAddress(RelayerIncentivizeContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelRelayerIncentivizeContract,
},
{
ContractAddr: common.HexToAddress(RelayerHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelRelayerHubContract,
},
{
ContractAddr: common.HexToAddress(GovHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelGovHubContract,
},
{
ContractAddr: common.HexToAddress(TokenManagerContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelTokenManagerContract,
},
{
ContractAddr: common.HexToAddress(CrossChainContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelCrossChainContract,
},
{
ContractAddr: common.HexToAddress(StakingContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelStakingContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelStakeHubContract,
},
{
ContractAddr: common.HexToAddress(StakeCreditContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelStakeCreditContract,
},
{
ContractAddr: common.HexToAddress(GovernorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelGovernorContract,
},
{
ContractAddr: common.HexToAddress(GovTokenContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelGovTokenContract,
},
{
ContractAddr: common.HexToAddress(TimelockContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelTimelockContract,
},
{
ContractAddr: common.HexToAddress(TokenRecoverPortalContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.ChapelTokenRecoverPortalContract,
},
},
}
pascalUpgrade[rialtoNet] = &Upgrade{
UpgradeName: "pascal",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoValidatorContract,
},
{
ContractAddr: common.HexToAddress(SlashContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoSlashContract,
},
{
ContractAddr: common.HexToAddress(SystemRewardContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoSystemRewardContract,
},
{
ContractAddr: common.HexToAddress(LightClientContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoLightClientContract,
},
{
ContractAddr: common.HexToAddress(TokenHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoTokenHubContract,
},
{
ContractAddr: common.HexToAddress(RelayerIncentivizeContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoRelayerIncentivizeContract,
},
{
ContractAddr: common.HexToAddress(RelayerHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoRelayerHubContract,
},
{
ContractAddr: common.HexToAddress(GovHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoGovHubContract,
},
{
ContractAddr: common.HexToAddress(TokenManagerContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoTokenManagerContract,
},
{
ContractAddr: common.HexToAddress(CrossChainContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoCrossChainContract,
},
{
ContractAddr: common.HexToAddress(StakingContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoStakingContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoStakeHubContract,
},
{
ContractAddr: common.HexToAddress(StakeCreditContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoStakeCreditContract,
},
{
ContractAddr: common.HexToAddress(GovernorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoGovernorContract,
},
{
ContractAddr: common.HexToAddress(GovTokenContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoGovTokenContract,
},
{
ContractAddr: common.HexToAddress(TimelockContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoTimelockContract,
},
{
ContractAddr: common.HexToAddress(TokenRecoverPortalContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/4c03f8222f8ac13e3b6bd424e1235698282bb28d",
Code: pascal.RialtoTokenRecoverPortalContract,
},
},
}
}
func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, statedb vm.StateDB) {
@@ -873,6 +1149,10 @@ func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.I
applySystemContractUpgrade(bohrUpgrade[network], blockNumber, statedb, logger)
}
if config.IsOnPascal(blockNumber, lastBlockTime, blockTime) {
applySystemContractUpgrade(pascalUpgrade[network], blockNumber, statedb, logger)
}
/*
apply other upgrades
*/

View File

@@ -1,7 +1,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
import (

View File

@@ -1,7 +1,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
// gfP2 implements a field of size p² as a quadratic extension of the base field

View File

@@ -1,7 +1,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
// gfP6 implements the field of size p⁶ as a cubic extension of gfP2 where τ³=ξ

View File

@@ -5,7 +5,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
import (

View File

@@ -5,7 +5,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
import (

View File

@@ -5,7 +5,7 @@
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields", Devegili et al.
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
import (

View File

@@ -199,6 +199,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
chainConfig.BohrTime = config.OverrideBohr
overrides.OverrideBohr = config.OverrideBohr
}
if config.OverridePascal != nil {
chainConfig.PascalTime = config.OverridePascal
overrides.OverridePascal = config.OverridePascal
}
if config.OverrideVerkle != nil {
chainConfig.VerkleTime = config.OverrideVerkle
overrides.OverrideVerkle = config.OverrideVerkle

View File

@@ -194,6 +194,9 @@ type Config struct {
// OverrideBohr (TODO: remove after the fork)
OverrideBohr *uint64 `toml:",omitempty"`
// OverridePascal (TODO: remove after the fork)
OverridePascal *uint64 `toml:",omitempty"`
// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

View File

@@ -70,8 +70,9 @@ func (c Config) MarshalTOML() (interface{}, error) {
RPCGasCap uint64
RPCEVMTimeout time.Duration
RPCTxFeeCap float64
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverrideBohr *uint64 `toml:",omitempty"`
OverridePascal *uint64 `toml:",omitempty"`
OverrideVerkle *uint64 `toml:",omitempty"`
BlobExtraReserve uint64
}
@@ -131,6 +132,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.RPCTxFeeCap = c.RPCTxFeeCap
enc.OverridePassedForkTime = c.OverridePassedForkTime
enc.OverrideBohr = c.OverrideBohr
enc.OverridePascal = c.OverridePascal
enc.OverrideVerkle = c.OverrideVerkle
enc.BlobExtraReserve = c.BlobExtraReserve
return &enc, nil
@@ -192,8 +194,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
RPCGasCap *uint64
RPCEVMTimeout *time.Duration
RPCTxFeeCap *float64
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverrideBohr *uint64 `toml:",omitempty"`
OverridePascal *uint64 `toml:",omitempty"`
OverrideVerkle *uint64 `toml:",omitempty"`
BlobExtraReserve *uint64
}
@@ -366,6 +369,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.OverrideBohr != nil {
c.OverrideBohr = dec.OverrideBohr
}
if dec.OverridePascal != nil {
c.OverridePascal = dec.OverridePascal
}
if dec.OverrideVerkle != nil {
c.OverrideVerkle = dec.OverrideVerkle
}

View File

@@ -868,9 +868,9 @@ func (f *BlockFetcher) importHeaders(op *blockOrHeaderInject) {
parent := f.getHeader(header.ParentHash)
if parent == nil {
log.Debug("Unknown parent of propagated header", "peer", peer, "number", header.Number, "hash", hash, "parent", header.ParentHash)
time.Sleep(reQueueBlockTimeout)
// forget block first, then re-queue
f.done <- hash
time.Sleep(reQueueBlockTimeout)
f.requeue <- op
return
}
@@ -909,9 +909,9 @@ func (f *BlockFetcher) importBlocks(op *blockOrHeaderInject) {
parent := f.getBlock(block.ParentHash())
if parent == nil {
log.Debug("Unknown parent of propagated block", "peer", peer, "number", block.Number(), "hash", hash, "parent", block.ParentHash())
time.Sleep(reQueueBlockTimeout)
// forget block first, then re-queue
f.done <- hash
time.Sleep(reQueueBlockTimeout)
f.requeue <- op
return
}

View File

@@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -47,7 +46,7 @@ var ProtocolVersions = []uint{ETH68}
var protocolLengths = map[uint]uint64{ETH68: 17}
// maxMessageSize is the maximum cap on the size of a protocol message.
var maxMessageSize = params.MaxMessageSize
const maxMessageSize = 10 * 1024 * 1024
const (
StatusMsg = 0x00

View File

@@ -248,9 +248,6 @@ func (h *handler) doSync(op *chainSyncOp) error {
// degenerate connectivity, but it should be healthy for the mainnet too to
// more reliably update peers or the local TD state.
if block := h.chain.GetBlock(head.Hash(), head.Number.Uint64()); block != nil {
if h.chain.Config().IsCancun(block.Number(), block.Time()) {
block = block.WithSidecars(h.chain.GetSidecarsByHash(block.Hash()))
}
h.BroadcastBlock(block, false)
}
}

View File

@@ -692,14 +692,6 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
return
}
// check bid size
if bidRuntime.env.size+blockReserveSize > params.MaxMessageSize {
log.Error("BidSimulator: failed to check bid size", "builder", bidRuntime.bid.Builder,
"bidHash", bidRuntime.bid.Hash(), "env.size", bidRuntime.env.size)
err = errors.New("invalid bid size")
return
}
bestBid := b.GetBestBid(parentHash)
if bestBid == nil {
log.Info("[BID RESULT]", "win", "true[first]", "builder", bidRuntime.bid.Builder, "hash", bidRuntime.bid.Hash().TerminalString())
@@ -866,7 +858,6 @@ func (r *BidRuntime) commitTransaction(chain *core.BlockChain, chainConfig *para
}
r.env.tcount++
r.env.size += uint32(tx.Size())
return nil
}

View File

@@ -70,12 +70,6 @@ const (
// the default to wait for the mev miner to finish
waitMEVMinerEndTimeLimit = 50 * time.Millisecond
// Reserve block size for the following 3 components:
// a. System transactions at the end of the block
// b. Seal in the block header
// c. Overhead from RLP encoding
blockReserveSize = 100 * 1024
)
var (
@@ -95,7 +89,6 @@ type environment struct {
signer types.Signer
state *state.StateDB // apply state changes here
tcount int // tx count in cycle
size uint32 // almost accurate block size,
gasPool *core.GasPool // available gas used to pack transactions
coinbase common.Address
@@ -112,7 +105,6 @@ func (env *environment) copy() *environment {
signer: env.signer,
state: env.state.Copy(),
tcount: env.tcount,
size: env.size,
coinbase: env.coinbase,
header: types.CopyHeader(env.header),
receipts: copyReceipts(env.receipts),
@@ -903,13 +895,6 @@ LOOP:
txs.Pop()
continue
}
// If we don't have enough size left for the next transaction, skip it.
if env.size+uint32(tx.Size())+blockReserveSize > params.MaxMessageSize {
log.Trace("Not enough size left for transaction", "hash", ltx.Hash,
"env.size", env.size, "needed", uint32(tx.Size()))
txs.Pop()
continue
}
// Error may be ignored here. The error has already been checked
// during transaction acceptance is the transaction pool.
from, _ := types.Sender(env.signer, tx)
@@ -935,7 +920,6 @@ LOOP:
// Everything ok, collect the logs and shift in the next transaction from the same account
coalescedLogs = append(coalescedLogs, logs...)
env.tcount++
env.size += uint32(tx.Size()) // size of BlobTxSidecar included
txs.Shift()
default:
@@ -1071,9 +1055,6 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, w.chainConfig, vm.Config{})
core.ProcessBeaconBlockRoot(*header.ParentBeaconRoot, vmenv, env.state)
}
env.size = uint32(env.header.Size())
return env, nil
}

View File

@@ -155,6 +155,8 @@ var (
HaberTime: newUint64(1718863500), // 2024-06-20 06:05:00 AM UTC
HaberFixTime: newUint64(1727316120), // 2024-09-26 02:02:00 AM UTC
BohrTime: newUint64(1727317200), // 2024-09-26 02:20:00 AM UTC
// TODO
PascalTime: nil,
Parlia: &ParliaConfig{
Period: 3,
@@ -196,6 +198,8 @@ var (
HaberTime: newUint64(1716962820), // 2024-05-29 06:07:00 AM UTC
HaberFixTime: newUint64(1719986788), // 2024-07-03 06:06:28 AM UTC
BohrTime: newUint64(1724116996), // 2024-08-20 01:23:16 AM UTC
// TODO
PascalTime: nil,
Parlia: &ParliaConfig{
Period: 3,
@@ -238,6 +242,8 @@ var (
HaberTime: newUint64(0),
HaberFixTime: newUint64(0),
BohrTime: newUint64(0),
// TODO
PascalTime: newUint64(0),
Parlia: &ParliaConfig{
Period: 3,
@@ -517,6 +523,7 @@ type ChainConfig struct {
HaberTime *uint64 `json:"haberTime,omitempty"` // Haber switch time (nil = no fork, 0 = already on haber)
HaberFixTime *uint64 `json:"haberFixTime,omitempty"` // HaberFix switch time (nil = no fork, 0 = already on haberFix)
BohrTime *uint64 `json:"bohrTime,omitempty"` // Bohr switch time (nil = no fork, 0 = already on bohr)
PascalTime *uint64 `json:"pascalTime,omitempty"` // Pascal switch time (nil = no fork, 0 = already on pascal)
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
@@ -637,7 +644,12 @@ func (c *ChainConfig) String() string {
BohrTime = big.NewInt(0).SetUint64(*c.BohrTime)
}
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Luban: %v, Plato: %v, Hertz: %v, Hertzfix: %v, ShanghaiTime: %v, KeplerTime: %v, FeynmanTime: %v, FeynmanFixTime: %v, CancunTime: %v, HaberTime: %v, HaberFixTime: %v, BohrTime: %v, Engine: %v}",
var PascalTime *big.Int
if c.PascalTime != nil {
PascalTime = big.NewInt(0).SetUint64(*c.PascalTime)
}
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Luban: %v, Plato: %v, Hertz: %v, Hertzfix: %v, ShanghaiTime: %v, KeplerTime: %v, FeynmanTime: %v, FeynmanFixTime: %v, CancunTime: %v, HaberTime: %v, HaberFixTime: %v, BohrTime: %v, PascalTime: %v, Engine: %v}",
c.ChainID,
c.HomesteadBlock,
c.DAOForkBlock,
@@ -677,6 +689,7 @@ func (c *ChainConfig) String() string {
HaberTime,
HaberFixTime,
BohrTime,
PascalTime,
engine,
)
}
@@ -977,6 +990,20 @@ func (c *ChainConfig) IsOnBohr(currentBlockNumber *big.Int, lastBlockTime uint64
return !c.IsBohr(lastBlockNumber, lastBlockTime) && c.IsBohr(currentBlockNumber, currentBlockTime)
}
// IsPascal returns whether time is either equal to the Pascal fork time or greater.
func (c *ChainConfig) IsPascal(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.PascalTime, time)
}
// IsOnPascal returns whether currentBlockTime is either equal to the Pascal fork time or greater firstly.
func (c *ChainConfig) IsOnPascal(currentBlockNumber *big.Int, lastBlockTime uint64, currentBlockTime uint64) bool {
lastBlockNumber := new(big.Int)
if currentBlockNumber.Cmp(big.NewInt(1)) >= 0 {
lastBlockNumber.Sub(currentBlockNumber, big.NewInt(1))
}
return !c.IsPascal(lastBlockNumber, lastBlockTime) && c.IsPascal(currentBlockNumber, currentBlockTime)
}
// IsPrague returns whether num is either equal to the Prague fork time or greater.
func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.PragueTime, time)
@@ -1043,6 +1070,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "haberTime", timestamp: c.HaberTime},
{name: "haberFixTime", timestamp: c.HaberFixTime},
{name: "bohrTime", timestamp: c.BohrTime},
{name: "pascalTime", timestamp: c.PascalTime},
{name: "pragueTime", timestamp: c.PragueTime, optional: true},
{name: "verkleTime", timestamp: c.VerkleTime, optional: true},
} {
@@ -1199,6 +1227,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.BohrTime, newcfg.BohrTime, headTimestamp) {
return newTimestampCompatError("Bohr fork timestamp", c.BohrTime, newcfg.BohrTime)
}
if isForkTimestampIncompatible(c.PascalTime, newcfg.PascalTime, headTimestamp) {
return newTimestampCompatError("Pascal fork timestamp", c.PascalTime, newcfg.PascalTime)
}
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) {
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime)
}

View File

@@ -29,8 +29,6 @@ const (
GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block.
PayBidTxGasLimit uint64 = 25000 // Gas limit of the PayBidTx in the types.BidArgs.
MaxMessageSize uint32 = 10 * 1024 * 1024 // MaxMessageSize is the maximum cap on the size of a eth protocol message.
MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
ForkIDSize uint64 = 4 // The length of fork id
ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction.