mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
fix: cleanup audit fixes (#39)
* fix: cleanup audit fixes * chainID overflow check * explicit support for marshalJSON * nit * nit logging
This commit is contained in:
parent
65942a54f5
commit
77bab9e10f
5 changed files with 37 additions and 7 deletions
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
|
|
@ -130,13 +130,14 @@ jobs:
|
|||
# Move all artifacts to current directory
|
||||
if [ -d "./artifacts" ]; then
|
||||
find ./artifacts -name "*.tar.gz" -exec mv {} . \;
|
||||
find ./artifacts -name "*.tar.gz.asc" -exec mv {} . \;
|
||||
else
|
||||
echo "Warning: No artifacts directory found"
|
||||
fi
|
||||
|
||||
# List available files for debugging
|
||||
echo "Available files:"
|
||||
ls -la *.tar.gz || echo "No tar.gz files found"
|
||||
ls -la *.tar.gz *.tar.gz.asc 2>/dev/null || echo "No archive files found"
|
||||
|
||||
# Get actual archive names
|
||||
GETH_AMD64=$(ls bera-geth-linux-amd64-*.tar.gz 2>/dev/null | grep -v alltools | head -1)
|
||||
|
|
@ -237,7 +238,7 @@ jobs:
|
|||
|
||||
# Create assets array for gh release
|
||||
assets=()
|
||||
for asset in bera-geth-*.tar.gz; do
|
||||
for asset in bera-geth-*.tar.gz bera-geth-*.tar.gz.asc; do
|
||||
if [ -f "$asset" ]; then
|
||||
assets+=("$asset")
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -91,6 +91,11 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
|||
isPrague1 := v.config.IsPrague1(block.Number(), block.Time())
|
||||
var expectedPoLHash common.Hash
|
||||
if isPrague1 {
|
||||
if block.ProposerPubkey() == nil {
|
||||
// TODO: does this need to enforce the proposer pubkey is the exact value we expect?
|
||||
return errors.New("post-prague1 block missing parent proposer pubkey")
|
||||
}
|
||||
|
||||
polTx, err := types.NewPoLTx(
|
||||
v.config.ChainID,
|
||||
v.config.Berachain.Prague1.PoLDistributorAddress,
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) {
|
|||
enc.Commitments = itx.Sidecar.Commitments
|
||||
enc.Proofs = itx.Sidecar.Proofs
|
||||
}
|
||||
|
||||
case *SetCodeTx:
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainID.ToBig())
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
|
|
@ -170,6 +171,22 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) {
|
|||
enc.S = (*hexutil.Big)(itx.S.ToBig())
|
||||
yparity := itx.V.Uint64()
|
||||
enc.YParity = (*hexutil.Uint64)(&yparity)
|
||||
|
||||
case *PoLTx:
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainID)
|
||||
enc.To = tx.To()
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.GasLimit)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.MaxPriorityFeePerGas = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.GasPrice = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.Input = (*hexutil.Bytes)(&itx.Data)
|
||||
v, r, s := itx.rawSignatureValues()
|
||||
enc.V = (*hexutil.Big)(v)
|
||||
enc.R = (*hexutil.Big)(r)
|
||||
enc.S = (*hexutil.Big)(s)
|
||||
yparity := v.Uint64()
|
||||
enc.YParity = (*hexutil.Uint64)(&yparity)
|
||||
}
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
|
@ -513,7 +530,12 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
|||
if dec.ChainID == nil {
|
||||
return errors.New("missing required field 'chainId' in transaction")
|
||||
}
|
||||
itx.ChainID = (*big.Int)(dec.ChainID)
|
||||
var overflow bool
|
||||
chainID, overflow := uint256.FromBig(dec.ChainID.ToInt())
|
||||
if overflow {
|
||||
return errors.New("'chainId' value overflows uint256")
|
||||
}
|
||||
itx.ChainID = chainID.ToBig()
|
||||
if dec.To == nil {
|
||||
return errors.New("missing required field 'to' in transaction")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -777,6 +777,7 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
|
|||
"len(params.Withdrawals)", len(params.Withdrawals),
|
||||
"beaconRoot", beaconRoot,
|
||||
"len(requests)", len(requests),
|
||||
"proposerPubkey", proposerPubkey,
|
||||
"error", err)
|
||||
return api.invalid(err, nil), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,11 +358,7 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
|
|||
var (
|
||||
isOsaka = miner.chainConfig.IsOsaka(env.header.Number, env.header.Time)
|
||||
isCancun = miner.chainConfig.IsCancun(env.header.Number, env.header.Time)
|
||||
gasLimit = env.header.GasLimit
|
||||
)
|
||||
if env.gasPool == nil {
|
||||
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
||||
}
|
||||
for {
|
||||
// Check interruption signal and abort building if it's fired.
|
||||
if interrupt != nil {
|
||||
|
|
@ -497,6 +493,11 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
|
|||
miner.confMu.RUnlock()
|
||||
|
||||
// Berachain: Post-Prague1, add PoL tx to the block according to BRIP-0004.
|
||||
if env.gasPool == nil {
|
||||
// NOTE: this check is moved here from the commitTransactions loop because we are
|
||||
// "committing" a transaction outside of the loop.
|
||||
env.gasPool = new(core.GasPool).AddGas(env.header.GasLimit)
|
||||
}
|
||||
if miner.chainConfig.IsPrague1(env.header.Number, env.header.Time) {
|
||||
tx, err := types.NewPoLTx(
|
||||
miner.chainConfig.ChainID,
|
||||
|
|
|
|||
Loading…
Reference in a new issue