Merge branch 'manav/upstream_merge_v1.14.13' of https://github.com/maticnetwork/bor into upstream_merge_v1.15.7

This commit is contained in:
Pratik Patil 2025-05-05 12:54:24 +05:30
commit 6f7df946d3
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
13 changed files with 43 additions and 28 deletions

View file

@ -384,7 +384,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
make_latest: false
files: |
packaging/deb/bor-amoy-**.deb
packaging/deb/bor-pbss-amoy-**.deb

View file

@ -110,7 +110,7 @@ jobs:
- name: Test
run: make test
- uses: actions/upload-artifact@v4.4.0
- uses: PaloAltoNetworks/upload-secure-artifact@main
with:
name: unitTest-coverage
path: cover.out
@ -161,7 +161,7 @@ jobs:
- name: test-integration
run: make test-integration
- uses: actions/upload-artifact@v4.4.0
- uses: PaloAltoNetworks/upload-secure-artifact@main
with:
name: integrationTest-coverage
path: cover.out
@ -275,13 +275,17 @@ jobs:
echo "Starting RPC Tests..."
timeout 5m bash bor/integration-tests/rpc_test.sh
- name: Resolve absolute path for logs
id: pathfix
run: |
echo "ABS_LOG_PATH=$(realpath matic-cli/devnet/logs)" >> $GITHUB_ENV
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4.4.0
uses: PaloAltoNetworks/upload-secure-artifact@main
with:
name: logs_${{ github.run_id }}
path: |
matic-cli/devnet/logs
path: ${{ env.ABS_LOG_PATH }}
- name: Package code and chain data
if: always()
@ -292,11 +296,11 @@ jobs:
mkdir -p ${{ github.run_id }}/matic-cli
sudo mv bor ${{ github.run_id }}
sudo mv matic-cli/devnet ${{ github.run_id }}/matic-cli
sudo tar czf code.tar.gz ${{ github.run_id }}
sudo tar --warning=no-file-changed --exclude='.git' -czf code.tar.gz ${{ github.run_id }}
- name: Upload code and chain data
if: always()
uses: actions/upload-artifact@v4.4.0
uses: PaloAltoNetworks/upload-secure-artifact@main
with:
name: code_${{ github.run_id }}
path: code.tar.gz

View file

@ -394,7 +394,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
make_latest: false
files: |
packaging/deb/bor-mainnet-**.deb
packaging/deb/bor-pbss-mainnet-**.deb

View file

@ -122,7 +122,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
make_latest: false
files: |
packaging/deb/bor**.deb
packaging/deb/bor**.deb.checksum

View file

@ -531,6 +531,12 @@ func (w *ledgerDriver) ledgerSignTypedMessage(derivationPath []uint32, domainHas
// APDU length | 1 byte
// Optional APDU data | arbitrary
func (w *ledgerDriver) ledgerExchange(opcode ledgerOpcode, p1 ledgerParam1, p2 ledgerParam2, data []byte) ([]byte, error) {
// max safe length check
const maxDataLength = 128 * 1024 * 1024 // 128 MB
if len(data) > maxDataLength {
return nil, errors.New("data too large")
}
// Construct the message payload, possibly split into multiple chunks
apdu := make([]byte, 2, 7+len(data))

View file

@ -586,7 +586,7 @@ func NewParallelBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis
return bc, nil
}
func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_ types.Receipts, _ []*types.Log, _ uint64, _ *state.StateDB, vtime time.Duration, blockEndErr error) {
func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header, witness *stateless.Witness) (_ types.Receipts, _ []*types.Log, _ uint64, _ *state.StateDB, vtime time.Duration, blockEndErr error) {
// Process the block using processor and parallelProcessor at the same time, take the one which finishes first, cancel the other, and return the result
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -631,14 +631,11 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
if err != nil {
return nil, nil, 0, nil, 0, err
}
// TODO(manav): confirm if not setting logger here affects block-stm or not as it's removed
// from upstream
// parallelStatedb.SetLogger(bc.logger)
processorCount++
go func() {
parallelStatedb.StartPrefetcher("chain", nil)
parallelStatedb.StartPrefetcher("chain", witness)
pstart := time.Now()
res, err := bc.parallelProcessor.Process(block, parallelStatedb, bc.vmConfig, ctx)
blockExecutionParallelTimer.UpdateSince(pstart)
@ -663,7 +660,7 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
processorCount++
go func() {
statedb.StartPrefetcher("chain", nil)
statedb.StartPrefetcher("chain", witness)
pstart := time.Now()
res, err := bc.processor.Process(block, statedb, bc.vmConfig, ctx)
blockExecutionSerialTimer.UpdateSince(pstart)
@ -2355,7 +2352,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
return nil, it.index, err
}
}
statedb.StartPrefetcher("chain", witness)
// Bor: We start the prefetcher in process block function called below
// and not here as we copy state for block-stm in that function. Also,
// we don't want to start duplicate prefetchers per block.
// statedb.StartPrefetcher("chain", witness)
}
activeState = statedb
@ -2384,7 +2384,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
// Process block using the parent state as reference point
pstart := time.Now()
receipts, logs, usedGas, statedb, vtime, err := bc.ProcessBlock(block, parent)
receipts, logs, usedGas, statedb, vtime, err := bc.ProcessBlock(block, parent, witness)
activeState = statedb
if err != nil {

View file

@ -174,7 +174,7 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
if err != nil {
return err
}
receipts, logs, usedGas, statedb, _, err := blockchain.ProcessBlock(block, blockchain.GetBlockByHash(block.ParentHash()).Header())
receipts, logs, usedGas, statedb, _, err := blockchain.ProcessBlock(block, blockchain.GetBlockByHash(block.ParentHash()).Header(), nil)
res := &ProcessResult{
Receipts: receipts,
Logs: logs,

View file

@ -507,11 +507,12 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
// Save pre state for proof generation
// preState := statedb.Copy()
// EIP-2935 / 7709
if config.Bor == nil { // EIP-2935 / 7709
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
blockContext.Random = &common.Hash{} // enable post-merge instruction set
evm := vm.NewEVM(blockContext, statedb, cm.config, vm.Config{})
ProcessParentBlockHash(b.header.ParentHash, evm)
}
// Execute any user modifications to the block.
if gen != nil {

View file

@ -539,7 +539,7 @@ func (g *Genesis) toBlockWithRoot(root common.Hash) *types.Block {
head.BlobGasUsed = new(uint64)
}
}
if conf.IsPrague(num) {
if conf.IsPrague(num) && conf.Bor == nil {
head.RequestsHash = &types.EmptyRequestsHash
}
}

View file

@ -796,7 +796,6 @@ func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tr
s.GetBalance(addr)
}
// TODO(manav): Confirm if we need to record if amount is zero
stateObject = s.mvRecordWritten(stateObject)
MVWrite(s, blockstm.NewSubpathKey(addr, BalancePath))

View file

@ -89,7 +89,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if p.config.IsPrague(block.Number()) || p.config.IsVerkle(block.Number()) {
if (p.config.IsPrague(block.Number()) || p.config.IsVerkle(block.Number())) && p.config.Bor == nil {
ProcessParentBlockHash(block.ParentHash(), evm)
}

View file

@ -221,7 +221,7 @@ func (h *Header) ValidateBlockNumberOptionsPIP15(minBlockNumber *big.Int, maxBlo
return nil
}
// ValidateBlockNumberOptionsPIP15 validates the timestamp range passed as in the options parameter in the conditional transaction (PIP-15)
// ValidateTimestampOptionsPIP15 validates the timestamp range passed as in the options parameter in the conditional transaction (PIP-15)
func (h *Header) ValidateTimestampOptionsPIP15(minTimestamp *uint64, maxTimestamp *uint64) error {
currentBlockTime := h.Time

View file

@ -16,6 +16,8 @@
package trie
import "math"
// Trie keys are dealt with in three distinct encodings:
//
// KEYBYTES encoding contains the actual key and nothing else. This encoding is the
@ -104,6 +106,9 @@ func compactToHex(compact []byte) []byte {
}
func keybytesToHex(str []byte) []byte {
if len(str) > math.MaxInt/2 {
panic("input too large")
}
l := len(str)*2 + 1
var nibbles = make([]byte, l)