Merge branch 'master' into patch-4

This commit is contained in:
Alvarez 2025-11-27 01:10:38 +01:00 committed by GitHub
commit 35c2950d33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 5 deletions

View file

@ -8,10 +8,15 @@ jobs:
validate-pr: validate-pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check PR Title Format - name: Check PR Title Format
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
script: | script: |
const fs = require('fs');
const path = require('path');
const prTitle = context.payload.pull_request.title; const prTitle = context.payload.pull_request.title;
const titleRegex = /^([\w\s,{}/.]+): .+/; const titleRegex = /^([\w\s,{}/.]+): .+/;
@ -19,5 +24,21 @@ jobs:
core.setFailed(`PR title "${prTitle}" does not match required format: directory, ...: description`); core.setFailed(`PR title "${prTitle}" does not match required format: directory, ...: description`);
return; return;
} }
const match = prTitle.match(titleRegex);
const dirPart = match[1];
const directories = dirPart.split(',').map(d => d.trim());
const missingDirs = [];
for (const dir of directories) {
const fullPath = path.join(process.env.GITHUB_WORKSPACE, dir);
if (!fs.existsSync(fullPath)) {
missingDirs.push(dir);
}
}
if (missingDirs.length > 0) {
core.setFailed(`The following directories in the PR title do not exist: ${missingDirs.join(', ')}`);
return;
}
console.log('✅ PR title format is valid'); console.log('✅ PR title format is valid');

View file

@ -635,7 +635,7 @@ func (w *wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID
// data is not supported for Ledger wallets, so this method will always return // data is not supported for Ledger wallets, so this method will always return
// an error. // an error.
func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) { func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return w.SignText(account, accounts.TextHash(text)) return w.SignText(account, text)
} }
// SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given // SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given

View file

@ -38,7 +38,7 @@ import (
// across signing different data structures. // across signing different data structures.
const syncCommitteeDomain = 7 const syncCommitteeDomain = 7
var knownForks = []string{"GENESIS", "ALTAIR", "BELLATRIX", "CAPELLA", "DENEB"} var knownForks = []string{"GENESIS", "ALTAIR", "BELLATRIX", "CAPELLA", "DENEB", "ELECTRA", "FULU"}
// ClientConfig contains beacon light client configuration. // ClientConfig contains beacon light client configuration.
type ClientConfig struct { type ClientConfig struct {
@ -103,6 +103,9 @@ func (c *ChainConfig) LoadForks(file []byte) error {
epochs["GENESIS"] = 0 epochs["GENESIS"] = 0
for key, value := range config { for key, value := range config {
if value == nil {
continue
}
if strings.HasSuffix(key, "_FORK_VERSION") { if strings.HasSuffix(key, "_FORK_VERSION") {
name := key[:len(key)-len("_FORK_VERSION")] name := key[:len(key)-len("_FORK_VERSION")]
switch version := value.(type) { switch version := value.(type) {

View file

@ -44,6 +44,7 @@ func (m *Memory) Free() {
// To reduce peak allocation, return only smaller memory instances to the pool. // To reduce peak allocation, return only smaller memory instances to the pool.
const maxBufferSize = 16 << 10 const maxBufferSize = 16 << 10
if cap(m.store) <= maxBufferSize { if cap(m.store) <= maxBufferSize {
clear(m.store)
m.store = m.store[:0] m.store = m.store[:0]
m.lastGasCost = 0 m.lastGasCost = 0
memoryPool.Put(m) memoryPool.Put(m)
@ -76,10 +77,14 @@ func (m *Memory) Set32(offset uint64, val *uint256.Int) {
val.PutUint256(m.store[offset:]) val.PutUint256(m.store[offset:])
} }
// Resize resizes the memory to size // Resize grows the memory to the requested size.
func (m *Memory) Resize(size uint64) { func (m *Memory) Resize(size uint64) {
if uint64(m.Len()) < size { if uint64(len(m.store)) < size {
m.store = append(m.store, make([]byte, size-uint64(m.Len()))...) if uint64(cap(m.store)) >= size {
m.store = m.store[:size]
} else {
m.store = append(m.store, make([]byte, size-uint64(len(m.store)))...)
}
} }
} }

View file

@ -83,3 +83,10 @@ func TestMemoryCopy(t *testing.T) {
} }
} }
} }
func BenchmarkResize(b *testing.B) {
memory := NewMemory()
for i := range b.N {
memory.Resize(uint64(i))
}
}