mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 08:53:46 +00:00
CI: test: use bor in matic-cli
This commit is contained in:
commit
ca5fbadd70
13 changed files with 113 additions and 27 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -143,7 +143,9 @@ jobs:
|
||||||
bash docker-heimdall-start-all.sh
|
bash docker-heimdall-start-all.sh
|
||||||
bash docker-bor-setup.sh
|
bash docker-bor-setup.sh
|
||||||
bash docker-bor-start-all.sh
|
bash docker-bor-start-all.sh
|
||||||
|
cd code/
|
||||||
timeout 2m bash bor/integration-tests/bor_health.sh
|
timeout 2m bash bor/integration-tests/bor_health.sh
|
||||||
|
cd -
|
||||||
bash ganache-deployment-bor.sh
|
bash ganache-deployment-bor.sh
|
||||||
bash ganache-deployment-sync.sh
|
bash ganache-deployment-sync.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,24 @@
|
||||||
"londonBlock": 22640000,
|
"londonBlock": 22640000,
|
||||||
"bor": {
|
"bor": {
|
||||||
"jaipurBlock": 22770000,
|
"jaipurBlock": 22770000,
|
||||||
|
"delhiBlock": 29638656,
|
||||||
"period": {
|
"period": {
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"producerDelay": {
|
"producerDelay": {
|
||||||
"0": 6
|
"0": 6,
|
||||||
|
"29638656": 4
|
||||||
},
|
},
|
||||||
"sprint": {
|
"sprint": {
|
||||||
"0": 64
|
"0": 64,
|
||||||
|
"29638656": 16
|
||||||
},
|
},
|
||||||
"backupMultiplier": {
|
"backupMultiplier": {
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||||
|
|
|
||||||
|
|
@ -1504,7 +1504,7 @@ func setPeerRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||||
|
|
||||||
if peerRequiredBlocks == "" {
|
if peerRequiredBlocks == "" {
|
||||||
if ctx.GlobalIsSet(LegacyWhitelistFlag.Name) {
|
if ctx.GlobalIsSet(LegacyWhitelistFlag.Name) {
|
||||||
log.Warn("The flag --rpc is deprecated and will be removed, please use --peer.requiredblocks")
|
log.Warn("The flag --whitelist is deprecated and will be removed, please use --eth.requiredblocks")
|
||||||
peerRequiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name)
|
peerRequiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name)
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -416,10 +416,20 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty
|
||||||
return nil, fmt.Errorf("filter not found")
|
return nil, fmt.Errorf("filter not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
borConfig := api.chainConfig.Bor
|
||||||
|
|
||||||
var filter *Filter
|
var filter *Filter
|
||||||
|
|
||||||
|
var borLogsFilter *BorBlockLogsFilter
|
||||||
|
|
||||||
if f.crit.BlockHash != nil {
|
if f.crit.BlockHash != nil {
|
||||||
// Block filter requested, construct a single-shot filter
|
// Block filter requested, construct a single-shot filter
|
||||||
filter = NewBlockFilter(api.backend, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics)
|
filter = NewBlockFilter(api.backend, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics)
|
||||||
|
|
||||||
|
// Block bor filter
|
||||||
|
if api.borLogs {
|
||||||
|
borLogsFilter = NewBorBlockLogsFilter(api.backend, borConfig, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Convert the RPC block numbers into internal representations
|
// Convert the RPC block numbers into internal representations
|
||||||
begin := rpc.LatestBlockNumber.Int64()
|
begin := rpc.LatestBlockNumber.Int64()
|
||||||
|
|
@ -432,12 +442,27 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty
|
||||||
}
|
}
|
||||||
// Construct the range filter
|
// Construct the range filter
|
||||||
filter = NewRangeFilter(api.backend, begin, end, f.crit.Addresses, f.crit.Topics)
|
filter = NewRangeFilter(api.backend, begin, end, f.crit.Addresses, f.crit.Topics)
|
||||||
|
|
||||||
|
if api.borLogs {
|
||||||
|
borLogsFilter = NewBorBlockLogsRangeFilter(api.backend, borConfig, begin, end, f.crit.Addresses, f.crit.Topics)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Run the filter and return all the logs
|
// Run the filter and return all the logs
|
||||||
logs, err := filter.Logs(ctx)
|
logs, err := filter.Logs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if borLogsFilter != nil {
|
||||||
|
// Run the filter and return all the logs
|
||||||
|
borBlockLogs, err := borLogsFilter.Logs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnLogs(types.MergeBorLogs(logs, borBlockLogs)), nil
|
||||||
|
}
|
||||||
|
|
||||||
return returnLogs(logs), nil
|
return returnLogs(logs), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
|
||||||
// return downloader.SnapSync, td
|
// return downloader.SnapSync, td
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// Nope, we're really full syncing
|
// // Nope, we're really full syncing
|
||||||
// head := cs.handler.chain.CurrentBlock()
|
// head := cs.handler.chain.CurrentBlock()
|
||||||
// td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
|
// td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
|
||||||
// return downloader.FullSync, td
|
// return downloader.FullSync, td
|
||||||
|
|
|
||||||
12
integration-tests/bor_health.sh
Normal file
12
integration-tests/bor_health.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
peers=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'")
|
||||||
|
block-$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'")
|
||||||
|
|
||||||
|
if [[ -n "$peers" ]] && [[ -n "$block" ]] then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
@ -30,19 +30,24 @@ var mumbaiTestnet = &Chain{
|
||||||
LondonBlock: big.NewInt(22640000),
|
LondonBlock: big.NewInt(22640000),
|
||||||
Bor: ¶ms.BorConfig{
|
Bor: ¶ms.BorConfig{
|
||||||
JaipurBlock: big.NewInt(22770000),
|
JaipurBlock: big.NewInt(22770000),
|
||||||
|
DelhiBlock: big.NewInt(29638656),
|
||||||
Period: map[string]uint64{
|
Period: map[string]uint64{
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5,
|
"25275000": 5,
|
||||||
|
"29638656": 2,
|
||||||
},
|
},
|
||||||
ProducerDelay: map[string]uint64{
|
ProducerDelay: map[string]uint64{
|
||||||
"0": 6,
|
"0": 6,
|
||||||
|
"29638656": 4,
|
||||||
},
|
},
|
||||||
Sprint: map[string]uint64{
|
Sprint: map[string]uint64{
|
||||||
"0": 64,
|
"0": 64,
|
||||||
|
"29638656": 16,
|
||||||
},
|
},
|
||||||
BackupMultiplier: map[string]uint64{
|
BackupMultiplier: map[string]uint64{
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5,
|
"25275000": 5,
|
||||||
|
"29638656": 2,
|
||||||
},
|
},
|
||||||
ValidatorContract: "0x0000000000000000000000000000000000001000",
|
ValidatorContract: "0x0000000000000000000000000000000000001000",
|
||||||
StateReceiverContract: "0x0000000000000000000000000000000000001001",
|
StateReceiverContract: "0x0000000000000000000000000000000000001001",
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,21 @@
|
||||||
"bor": {
|
"bor": {
|
||||||
"period": {
|
"period": {
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"producerDelay": {
|
"producerDelay": {
|
||||||
"0": 6
|
"0": 6,
|
||||||
|
"29638656": 4
|
||||||
},
|
},
|
||||||
"sprint": {
|
"sprint": {
|
||||||
"0": 64
|
"0": 64,
|
||||||
|
"29638656": 16
|
||||||
},
|
},
|
||||||
"backupMultiplier": {
|
"backupMultiplier": {
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||||
|
|
@ -43,7 +47,8 @@
|
||||||
"burntContract": {
|
"burntContract": {
|
||||||
"22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38"
|
"22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38"
|
||||||
},
|
},
|
||||||
"jaipurBlock": 22770000
|
"jaipurBlock": 22770000,
|
||||||
|
"delhiBlock": 29638656
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,21 @@
|
||||||
"bor":{
|
"bor":{
|
||||||
"period":{
|
"period":{
|
||||||
"0":2,
|
"0":2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"producerDelay":{
|
"producerDelay":{
|
||||||
"0": 6
|
"0": 6,
|
||||||
|
"29638656": 4
|
||||||
},
|
},
|
||||||
"sprint":{
|
"sprint":{
|
||||||
"0": 64
|
"0": 64,
|
||||||
|
"29638656": 16
|
||||||
},
|
},
|
||||||
"backupMultiplier":{
|
"backupMultiplier":{
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5
|
"25275000": 5,
|
||||||
|
"29638656": 2
|
||||||
},
|
},
|
||||||
"validatorContract":"0x0000000000000000000000000000000000001000",
|
"validatorContract":"0x0000000000000000000000000000000000001000",
|
||||||
"stateReceiverContract":"0x0000000000000000000000000000000000001001",
|
"stateReceiverContract":"0x0000000000000000000000000000000000001001",
|
||||||
|
|
@ -45,7 +49,8 @@
|
||||||
"burntContract":{
|
"burntContract":{
|
||||||
"22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38"
|
"22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38"
|
||||||
},
|
},
|
||||||
"jaipurBlock":22770000
|
"jaipurBlock":22770000,
|
||||||
|
"delhiBlock": 29638656
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonce":"0x0",
|
"nonce":"0x0",
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ func (c *Command) MarkDown() string {
|
||||||
// Help implements the cli.Command interface
|
// Help implements the cli.Command interface
|
||||||
func (c *Command) Help() string {
|
func (c *Command) Help() string {
|
||||||
return `Usage: bor [options]
|
return `Usage: bor [options]
|
||||||
|
|
||||||
Run the Bor server.
|
Run the Bor server.
|
||||||
` + c.Flags().Help()
|
` + c.Flags().Help()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1615,6 +1615,26 @@ type PublicTransactionPoolAPI struct {
|
||||||
signer types.Signer
|
signer types.Signer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns block transactions along with state-sync transaction if present
|
||||||
|
// nolint: unparam
|
||||||
|
func (api *PublicTransactionPoolAPI) getAllBlockTransactions(ctx context.Context, block *types.Block) (types.Transactions, bool) {
|
||||||
|
txs := block.Transactions()
|
||||||
|
|
||||||
|
stateSyncPresent := false
|
||||||
|
|
||||||
|
borReceipt := rawdb.ReadBorReceipt(api.b.ChainDb(), block.Hash(), block.NumberU64())
|
||||||
|
if borReceipt != nil {
|
||||||
|
txHash := types.GetDerivedBorTxHash(types.BorReceiptKey(block.Number().Uint64(), block.Hash()))
|
||||||
|
if txHash != (common.Hash{}) {
|
||||||
|
borTx, _, _, _, _ := api.b.GetBorBlockTransactionWithBlockHash(ctx, txHash, block.Hash())
|
||||||
|
txs = append(txs, borTx)
|
||||||
|
stateSyncPresent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return txs, stateSyncPresent
|
||||||
|
}
|
||||||
|
|
||||||
// NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
|
// NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
|
||||||
func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI {
|
func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI {
|
||||||
// The signer used by the API should always be the 'latest' known one because we expect
|
// The signer used by the API should always be the 'latest' known one because we expect
|
||||||
|
|
@ -1626,7 +1646,8 @@ func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransa
|
||||||
// GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
|
// GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
|
||||||
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
|
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
|
||||||
if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
|
if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
|
||||||
n := hexutil.Uint(len(block.Transactions()))
|
txs, _ := s.getAllBlockTransactions(ctx, block)
|
||||||
|
n := hexutil.Uint(len(txs))
|
||||||
return &n
|
return &n
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -1635,7 +1656,8 @@ func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.
|
||||||
// GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
|
// GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
|
||||||
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
|
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
|
||||||
if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
|
if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
|
||||||
n := hexutil.Uint(len(block.Transactions()))
|
txs, _ := s.getAllBlockTransactions(ctx, block)
|
||||||
|
n := hexutil.Uint(len(txs))
|
||||||
return &n
|
return &n
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -350,19 +350,24 @@ var (
|
||||||
LondonBlock: big.NewInt(22640000),
|
LondonBlock: big.NewInt(22640000),
|
||||||
Bor: &BorConfig{
|
Bor: &BorConfig{
|
||||||
JaipurBlock: big.NewInt(22770000),
|
JaipurBlock: big.NewInt(22770000),
|
||||||
|
DelhiBlock: big.NewInt(29638656),
|
||||||
Period: map[string]uint64{
|
Period: map[string]uint64{
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5,
|
"25275000": 5,
|
||||||
|
"29638656": 2,
|
||||||
},
|
},
|
||||||
ProducerDelay: map[string]uint64{
|
ProducerDelay: map[string]uint64{
|
||||||
"0": 6,
|
"0": 6,
|
||||||
|
"29638656": 4,
|
||||||
},
|
},
|
||||||
Sprint: map[string]uint64{
|
Sprint: map[string]uint64{
|
||||||
"0": 64,
|
"0": 64,
|
||||||
|
"29638656": 16,
|
||||||
},
|
},
|
||||||
BackupMultiplier: map[string]uint64{
|
BackupMultiplier: map[string]uint64{
|
||||||
"0": 2,
|
"0": 2,
|
||||||
"25275000": 5,
|
"25275000": 5,
|
||||||
|
"29638656": 2,
|
||||||
},
|
},
|
||||||
ValidatorContract: "0x0000000000000000000000000000000000001000",
|
ValidatorContract: "0x0000000000000000000000000000000000001000",
|
||||||
StateReceiverContract: "0x0000000000000000000000000000000000001001",
|
StateReceiverContract: "0x0000000000000000000000000000000000001001",
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VersionMajor = 0 // Major version component of the current release
|
VersionMajor = 0 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor version component of the current release
|
VersionMinor = 3 // Minor version component of the current release
|
||||||
VersionPatch = 1 // Patch version component of the current release
|
VersionPatch = 1 // Patch version component of the current release
|
||||||
VersionMeta = "beta" // Version metadata to append to the version string
|
VersionMeta = "mumbai" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version holds the textual version string.
|
// Version holds the textual version string.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue