Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add blob tx tests #655

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions .github/workflows/client-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ethereum client test

on:
push:
branches:
- blob-tx-tests

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Repo with submodules'
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0
with:
submodules: true

- name: 'Setup Go'
uses: actions/setup-go@v5
with:
go-version: '1.20.10'

- name: 'Run tests'
run: cd tests && go test -test.v -run="(TestState|TestTransaction|TestRLP)" | grep "FAIL" && exit 1
10 changes: 6 additions & 4 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ type Genesis struct {

// These fields are used for consensus tests. Please don't use them
// in actual genesis blocks.
Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
BaseFee *big.Int `json:"baseFeePerGas"`
Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
BaseFee *big.Int `json:"baseFeePerGas"`
ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844
BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844
}

// GenesisAlloc specifies the initial state that is part of the genesis block.
Expand Down
2 changes: 1 addition & 1 deletion core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func init() {
PrecompiledContractsConsortium[common.BytesToAddress([]byte{105})] = &consortiumValidateFinalityProof{}

PrecompiledContractsConsortiumMiko = copyPrecompiledContract(PrecompiledContractsConsortium)
PrecompiledContractsConsortiumMiko[common.BytesToAddress([]byte{106})] = &consortiumValidateProofOfPossession{}
// PrecompiledContractsConsortiumMiko[common.BytesToAddress([]byte{106})] = &consortiumValidateProofOfPossession{}

PrecompiledContractsBerlin = copyPrecompiledContract(PrecompiledContractsConsortiumMiko)
PrecompiledContractsBerlin[common.BytesToAddress([]byte{5})] = &bigModExp{eip2565: true}
Expand Down
5 changes: 3 additions & 2 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ const (
InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks.
MinimumBaseFee = 1000000000 // Minimum base fee after Venoki.

MaxCodeSize = 24576 // Maximum bytecode to permit for a contract
MaxCodeSizeShanghai = 32768 // Maximum bytecode to permit for a contract after Shanghai
MaxCodeSize = 24576 // Maximum bytecode to permit for a contract
// MaxCodeSizeShanghai = 32768 // Maximum bytecode to permit for a contract after Shanghai
MaxCodeSizeShanghai = 24576 // Maximum bytecode to permit for a contract after Shanghai
MaxInitCodeSize = 2 * MaxCodeSizeShanghai // Maximum initcode to permit in a creation transaction and create instructions

// Precompiled contract gas prices
Expand Down
66 changes: 37 additions & 29 deletions tests/block_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,27 @@ type btBlock struct {
//go:generate gencodec -type btHeader -field-override btHeaderMarshaling -out gen_btheader.go

type btHeader struct {
Bloom types.Bloom
Coinbase common.Address
MixHash common.Hash
Nonce types.BlockNonce
Number *big.Int
Hash common.Hash
ParentHash common.Hash
ReceiptTrie common.Hash
StateRoot common.Hash
TransactionsTrie common.Hash
UncleHash common.Hash
ExtraData []byte
Difficulty *big.Int
GasLimit uint64
GasUsed uint64
Timestamp uint64
BaseFeePerGas *big.Int
Bloom types.Bloom
Coinbase common.Address
MixHash common.Hash
Nonce types.BlockNonce
Number *big.Int
Hash common.Hash
ParentHash common.Hash
ReceiptTrie common.Hash
StateRoot common.Hash
TransactionsTrie common.Hash
UncleHash common.Hash
ExtraData []byte
Difficulty *big.Int
GasLimit uint64
GasUsed uint64
Timestamp uint64
BaseFeePerGas *big.Int
WithdrawalsRoot *common.Hash
BlobGasUsed *uint64
ExcessBlobGas *uint64
ParentBeaconBlockRoot *common.Hash
}

type btHeaderMarshaling struct {
Expand All @@ -96,6 +100,8 @@ type btHeaderMarshaling struct {
GasUsed math.HexOrDecimal64
Timestamp math.HexOrDecimal64
BaseFeePerGas *math.HexOrDecimal256
BlobGasUsed *math.HexOrDecimal64
ExcessBlobGas *math.HexOrDecimal64
}

func (t *BlockTest) Run(snapshotter bool) error {
Expand Down Expand Up @@ -159,18 +165,20 @@ func (t *BlockTest) Run(snapshotter bool) error {

func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
return &core.Genesis{
Config: config,
Nonce: t.json.Genesis.Nonce.Uint64(),
Timestamp: t.json.Genesis.Timestamp,
ParentHash: t.json.Genesis.ParentHash,
ExtraData: t.json.Genesis.ExtraData,
GasLimit: t.json.Genesis.GasLimit,
GasUsed: t.json.Genesis.GasUsed,
Difficulty: t.json.Genesis.Difficulty,
Mixhash: t.json.Genesis.MixHash,
Coinbase: t.json.Genesis.Coinbase,
Alloc: t.json.Pre,
BaseFee: t.json.Genesis.BaseFeePerGas,
Config: config,
Nonce: t.json.Genesis.Nonce.Uint64(),
Timestamp: t.json.Genesis.Timestamp,
ParentHash: t.json.Genesis.ParentHash,
ExtraData: t.json.Genesis.ExtraData,
GasLimit: t.json.Genesis.GasLimit,
GasUsed: t.json.Genesis.GasUsed,
Difficulty: t.json.Genesis.Difficulty,
Mixhash: t.json.Genesis.MixHash,
Coinbase: t.json.Genesis.Coinbase,
Alloc: t.json.Pre,
BaseFee: t.json.Genesis.BaseFeePerGas,
BlobGasUsed: t.json.Genesis.BlobGasUsed,
ExcessBlobGas: t.json.Genesis.ExcessBlobGas,
}
}

Expand Down
92 changes: 58 additions & 34 deletions tests/gen_btheader.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions tests/gen_stenv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions tests/gen_sttransaction.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading