mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
EIP-4844: fix wiring of maxFeePerBlobGas (#7981)
Previously maxFeePerBlobGas was lost in the `BlobTx` -> `Message` conversion. Also added initial support of [EL EIPTests](https://github.com/ethereum/tests/tree/develop/EIPTests).
This commit is contained in:
parent
ae76df1b8a
commit
9b3f3bd118
@ -51,6 +51,7 @@ func (stx BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Mes
|
||||
if err != nil {
|
||||
return Message{}, err
|
||||
}
|
||||
msg.maxFeePerBlobGas = *stx.MaxFeePerBlobGas
|
||||
msg.blobHashes = stx.BlobVersionedHashes
|
||||
return msg, err
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -49,7 +49,7 @@ require (
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
|
||||
github.com/hashicorp/golang-lru/arc/v2 v2.0.4
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.4
|
||||
github.com/holiman/uint256 v1.2.2
|
||||
github.com/holiman/uint256 v1.2.3
|
||||
github.com/huandu/xstrings v1.4.0
|
||||
github.com/huin/goupnp v1.2.0
|
||||
github.com/jackpal/go-nat-pmp v1.0.2
|
||||
|
4
go.sum
4
go.sum
@ -429,8 +429,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.4 h1:7GHuZcgid37q8o5i3QI9KMT4nCWQQ3Kx3Ov
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.4/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||
github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
|
||||
github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk=
|
||||
github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
|
||||
github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o=
|
||||
github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=
|
||||
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
|
||||
|
@ -58,3 +58,26 @@ func TestBlockchain(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestBlockchainEIP(t *testing.T) {
|
||||
defer log.Root().SetHandler(log.Root().GetHandler())
|
||||
log.Root().SetHandler(log.LvlFilterHandler(log.LvlError, log.StderrHandler))
|
||||
|
||||
bt := new(testMatcher)
|
||||
|
||||
// EOF is not supported yet
|
||||
bt.skipLoad(`^StateTests/stEOF/`)
|
||||
|
||||
// TODO(yperbasis): fix me
|
||||
bt.skipLoad(`^StateTests/stEIP4844-blobtransactions/`)
|
||||
bt.skipLoad(`^StateTests/stExample/`)
|
||||
|
||||
// TODO(yperbasis): re-enable checkStateRoot
|
||||
checkStateRoot := false
|
||||
|
||||
bt.walk(t, blockEipTestDir, func(t *testing.T, name string, test *BlockTest) {
|
||||
if err := bt.checkFailure(t, test.Run(t, checkStateRoot)); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import (
|
||||
var (
|
||||
baseDir = filepath.Join(".", "testdata")
|
||||
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
||||
blockEipTestDir = filepath.Join(baseDir, "EIPTests", "BlockchainTests")
|
||||
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
|
||||
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
|
||||
rlpTestDir = filepath.Join(baseDir, "RLPTests")
|
||||
|
@ -68,7 +68,7 @@ func (t *StateTest) UnmarshalJSON(in []byte) error {
|
||||
type stJSON struct {
|
||||
Env stEnv `json:"env"`
|
||||
Pre types.GenesisAlloc `json:"pre"`
|
||||
Tx stTransactionMarshaling `json:"transaction"`
|
||||
Tx stTransaction `json:"transaction"`
|
||||
Out hexutility.Bytes `json:"out"`
|
||||
Post map[string][]stPostState `json:"post"`
|
||||
}
|
||||
@ -85,7 +85,7 @@ type stPostState struct {
|
||||
}
|
||||
}
|
||||
|
||||
type stTransactionMarshaling struct {
|
||||
type stTransaction struct {
|
||||
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
|
||||
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
|
||||
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
|
||||
@ -96,6 +96,7 @@ type stTransactionMarshaling struct {
|
||||
Data []string `json:"data"`
|
||||
Value []string `json:"value"`
|
||||
AccessLists []*types2.AccessList `json:"accessLists,omitempty"`
|
||||
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
||||
}
|
||||
|
||||
//go:generate gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go
|
||||
@ -375,7 +376,7 @@ func vmTestBlockHash(n uint64) libcommon.Hash {
|
||||
return libcommon.BytesToHash(crypto.Keccak256([]byte(big.NewInt(int64(n)).String())))
|
||||
}
|
||||
|
||||
func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (core.Message, error) {
|
||||
func toMessage(tx stTransaction, ps stPostState, baseFee *big.Int) (core.Message, error) {
|
||||
// Derive sender from private key if present.
|
||||
var from libcommon.Address
|
||||
if len(tx.PrivateKey) > 0 {
|
||||
@ -458,6 +459,11 @@ func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (co
|
||||
gpi := big.Int(*gasPrice)
|
||||
gasPriceInt := uint256.NewInt(gpi.Uint64())
|
||||
|
||||
var blobFeeCap *big.Int
|
||||
if tx.BlobGasFeeCap != nil {
|
||||
blobFeeCap = (*big.Int)(tx.BlobGasFeeCap)
|
||||
}
|
||||
|
||||
// TODO the conversion to int64 then uint64 then new int isn't working!
|
||||
msg := types.NewMessage(
|
||||
from,
|
||||
@ -466,13 +472,13 @@ func toMessage(tx stTransactionMarshaling, ps stPostState, baseFee *big.Int) (co
|
||||
value,
|
||||
uint64(gasLimit),
|
||||
gasPriceInt,
|
||||
uint256.NewInt(feeCap.Uint64()),
|
||||
uint256.NewInt(tipCap.Uint64()),
|
||||
uint256.MustFromBig(&feeCap),
|
||||
uint256.MustFromBig(&tipCap),
|
||||
data,
|
||||
accessList,
|
||||
false, /* checkNonce */
|
||||
false, /* isFree */
|
||||
uint256.NewInt(tipCap.Uint64()),
|
||||
uint256.MustFromBig(blobFeeCap),
|
||||
)
|
||||
|
||||
return msg, nil
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 06e276776bc87817c38f6efb492bf6f4527fa904
|
||||
Subproject commit 9b6382b122140b5479a4ff6152ccf1459440ddff
|
Loading…
Reference in New Issue
Block a user