Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d19bf65
chore(all): use upstream protocol params
qdm12 May 15, 2025
82ad666
Merge branch 'master' into qdm12/upstream-params
qdm12 May 23, 2025
fa27e71
Fix copyright headers
qdm12 May 23, 2025
60e975e
Merge branch 'master' into qdm12/upstream-params
qdm12 May 23, 2025
dd701c0
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 5, 2025
b4bbbca
resolve further import errors
JonathanOppenheimer Aug 5, 2025
ab05cef
simplify errors further
JonathanOppenheimer Aug 5, 2025
7782f35
align evm repo blockchain_test.go configs
JonathanOppenheimer Aug 5, 2025
1751e2e
remove re-duplicated test
JonathanOppenheimer Aug 5, 2025
7b8a921
don't use ethparams for types
JonathanOppenheimer Aug 5, 2025
b15a02c
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 11, 2025
1576b56
fix ethparams
JonathanOppenheimer Aug 11, 2025
abc0e36
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 12, 2025
0595063
Simplify atomic mempool tx signaling (#1116)
StephenButtolph Aug 13, 2025
2c4805d
Refactor atomic tx gas price calculations (#1118)
StephenButtolph Aug 13, 2025
6066156
Atomic vm tests (#1112)
ceyonur Aug 14, 2025
359dc44
fix: license header file (#1122)
alarso16 Aug 14, 2025
d0929a8
chore: more license fixes (#1123)
alarso16 Aug 15, 2025
63bf72b
prepare for v0.15.4 (#1124)
ceyonur Aug 18, 2025
65fbc57
Vm test helpers (#1125)
ceyonur Aug 18, 2025
7410bfe
ci: Enable extra linters (#1117)
alarso16 Aug 19, 2025
ff947d8
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 19, 2025
00b808b
lint
JonathanOppenheimer Aug 19, 2025
d5a3fa5
getting it right
JonathanOppenheimer Aug 19, 2025
dc8cbd7
lint
JonathanOppenheimer Aug 19, 2025
af251e1
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 21, 2025
03d2992
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 25, 2025
15e7f18
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 25, 2025
ebd4858
lint
JonathanOppenheimer Aug 25, 2025
694c7c6
Merge branch 'master' into qdm12/upstream-params
JonathanOppenheimer Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions consensus/misc/eip4844/eip4844.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import (
"fmt"
"math/big"

"github.com/ava-labs/coreth/params"
"github.com/ava-labs/libevm/core/types"
ethparams "github.com/ava-labs/libevm/params"
)

var (
minBlobGasPrice = big.NewInt(params.BlobTxMinBlobGasprice)
blobGaspriceUpdateFraction = big.NewInt(params.BlobTxBlobGaspriceUpdateFraction)
minBlobGasPrice = big.NewInt(ethparams.BlobTxMinBlobGasprice)
blobGaspriceUpdateFraction = big.NewInt(ethparams.BlobTxBlobGaspriceUpdateFraction)
)

// VerifyEIP4844Header verifies the presence of the excessBlobGas field and that
Expand All @@ -53,11 +53,11 @@ func VerifyEIP4844Header(parent, header *types.Header) error {
return errors.New("header is missing blobGasUsed")
}
// Verify that the blob gas used remains within reasonable limits.
if *header.BlobGasUsed > params.MaxBlobGasPerBlock {
return fmt.Errorf("blob gas used %d exceeds maximum allowance %d", *header.BlobGasUsed, params.MaxBlobGasPerBlock)
if *header.BlobGasUsed > ethparams.MaxBlobGasPerBlock {
return fmt.Errorf("blob gas used %d exceeds maximum allowance %d", *header.BlobGasUsed, ethparams.MaxBlobGasPerBlock)
}
if *header.BlobGasUsed%params.BlobTxBlobGasPerBlob != 0 {
return fmt.Errorf("blob gas used %d not a multiple of blob gas per blob %d", header.BlobGasUsed, params.BlobTxBlobGasPerBlob)
if *header.BlobGasUsed%ethparams.BlobTxBlobGasPerBlob != 0 {
return fmt.Errorf("blob gas used %d not a multiple of blob gas per blob %d", header.BlobGasUsed, ethparams.BlobTxBlobGasPerBlob)
}
// Verify the excessBlobGas is correct based on the parent header
var (
Expand All @@ -80,10 +80,10 @@ func VerifyEIP4844Header(parent, header *types.Header) error {
// blobs on top of the excess blob gas.
func CalcExcessBlobGas(parentExcessBlobGas uint64, parentBlobGasUsed uint64) uint64 {
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
if excessBlobGas < params.BlobTxTargetBlobGasPerBlock {
if excessBlobGas < ethparams.BlobTxTargetBlobGasPerBlock {
return 0
}
return excessBlobGas - params.BlobTxTargetBlobGasPerBlock
return excessBlobGas - ethparams.BlobTxTargetBlobGasPerBlock
}

// CalcBlobFee calculates the blobfee from the header's excess blob gas field.
Expand Down
20 changes: 10 additions & 10 deletions consensus/misc/eip4844/eip4844_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"math/big"
"testing"

"github.com/ava-labs/coreth/params"
ethparams "github.com/ava-labs/libevm/params"
)

func TestCalcExcessBlobGas(t *testing.T) {
Expand All @@ -45,23 +45,23 @@ func TestCalcExcessBlobGas(t *testing.T) {
// slots are below - or equal - to the target.
{0, 0, 0},
{0, 1, 0},
{0, params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, 0},
{0, ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob, 0},

// If the target blob gas is exceeded, the excessBlobGas should increase
// by however much it was overshot
{0, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob},
{1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob + 1},
{1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 2, 2*params.BlobTxBlobGasPerBlob + 1},
{0, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) + 1, ethparams.BlobTxBlobGasPerBlob},
{1, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) + 1, ethparams.BlobTxBlobGasPerBlob + 1},
{1, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) + 2, 2*ethparams.BlobTxBlobGasPerBlob + 1},

// The excess blob gas should decrease by however much the target was
// under-shot, capped at zero.
{params.BlobTxTargetBlobGasPerBlock, params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, params.BlobTxTargetBlobGasPerBlock},
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, params.BlobTxTargetBlobGasPerBlock - params.BlobTxBlobGasPerBlob},
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 2, params.BlobTxTargetBlobGasPerBlock - (2 * params.BlobTxBlobGasPerBlob)},
{params.BlobTxBlobGasPerBlob - 1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, 0},
{ethparams.BlobTxTargetBlobGasPerBlock, ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob, ethparams.BlobTxTargetBlobGasPerBlock},
{ethparams.BlobTxTargetBlobGasPerBlock, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) - 1, ethparams.BlobTxTargetBlobGasPerBlock - ethparams.BlobTxBlobGasPerBlob},
{ethparams.BlobTxTargetBlobGasPerBlock, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) - 2, ethparams.BlobTxTargetBlobGasPerBlock - (2 * ethparams.BlobTxBlobGasPerBlob)},
{ethparams.BlobTxBlobGasPerBlob - 1, (ethparams.BlobTxTargetBlobGasPerBlock / ethparams.BlobTxBlobGasPerBlob) - 1, 0},
}
for i, tt := range tests {
result := CalcExcessBlobGas(tt.excess, tt.blobs*params.BlobTxBlobGasPerBlob)
result := CalcExcessBlobGas(tt.excess, tt.blobs*ethparams.BlobTxBlobGasPerBlob)
if result != tt.want {
t.Errorf("test %d: excess blob gas mismatch: have %v, want %v", i, result, tt.want)
}
Expand Down
11 changes: 6 additions & 5 deletions core/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/ava-labs/libevm/core/vm"
"github.com/ava-labs/libevm/crypto"
"github.com/ava-labs/libevm/ethdb"
ethparams "github.com/ava-labs/libevm/params"
)

func BenchmarkInsertChain_empty_memdb(b *testing.B) {
Expand Down Expand Up @@ -126,26 +127,26 @@ func init() {
// and fills the blocks with many small transactions.
func genTxRing(naccounts int) func(int, *BlockGen) {
from := 0
fee := big.NewInt(0).SetUint64(params.TxGas * 225000000000)
fee := big.NewInt(0).SetUint64(ethparams.TxGas * 225000000000)
amount := big.NewInt(0).Set(benchRootFunds)
return func(i int, gen *BlockGen) {
block := gen.PrevBlock(i - 1)
gas := block.GasLimit()
signer := gen.Signer()
for {
gas -= params.TxGas
if gas < params.TxGas {
gas -= ethparams.TxGas
if gas < ethparams.TxGas {
break
}
to := (from + 1) % naccounts
burn := new(big.Int).SetUint64(params.TxGas)
burn := new(big.Int).SetUint64(ethparams.TxGas)
burn.Mul(burn, gen.header.BaseFee)
tx, err := types.SignNewTx(ringKeys[from], signer,
&types.LegacyTx{
Nonce: gen.TxNonce(ringAddrs[from]),
To: &ringAddrs[to],
Value: amount.Sub(amount, fee),
Gas: params.TxGas,
Gas: ethparams.TxGas,
GasPrice: big.NewInt(225000000000),
})
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/ava-labs/coreth/plugin/evm/upgrade/ap0"
"github.com/ava-labs/libevm/core/state"
"github.com/ava-labs/libevm/core/types"
ethparams "github.com/ava-labs/libevm/params"
"github.com/ava-labs/libevm/trie"
)

Expand Down Expand Up @@ -98,8 +99,8 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {

// Check blob gas usage.
if header.BlobGasUsed != nil {
if want := *header.BlobGasUsed / params.BlobTxBlobGasPerBlob; uint64(blobs) != want { // div because the header is surely good vs the body might be bloated
return fmt.Errorf("blob gas used mismatch (header %v, calculated %v)", *header.BlobGasUsed, blobs*params.BlobTxBlobGasPerBlob)
if want := *header.BlobGasUsed / ethparams.BlobTxBlobGasPerBlob; uint64(blobs) != want { // div because the header is surely good vs the body might be bloated
return fmt.Errorf("blob gas used mismatch (header %v, calculated %v)", *header.BlobGasUsed, blobs*ethparams.BlobTxBlobGasPerBlob)
}
} else {
if blobs > 0 {
Expand Down Expand Up @@ -149,10 +150,10 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
// the gas allowance.
func CalcGasLimit(parentGasUsed, parentGasLimit, gasFloor, gasCeil uint64) uint64 {
// contrib = (parentGasUsed * 3 / 2) / 1024
contrib := (parentGasUsed + parentGasUsed/2) / ap0.GasLimitBoundDivisor
contrib := (parentGasUsed + parentGasUsed/2) / ethparams.GasLimitBoundDivisor

// decay = parentGasLimit / 1024 -1
decay := parentGasLimit/ap0.GasLimitBoundDivisor - 1
decay := parentGasLimit/ethparams.GasLimitBoundDivisor - 1

/*
strategy: gasLimit of block-to-mine is set based on parent's
Expand Down
Loading
Loading