From fffeff046dc16135afce1841c42384fac77bdc5f Mon Sep 17 00:00:00 2001 From: Pranay Valson Date: Wed, 7 May 2025 12:51:24 -0700 Subject: [PATCH 1/4] prevent EBE blob gas reconciliation failure Signed-off-by: Pranay Valson --- core/blockchain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index ac9d3714ef9..a88a130fa02 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -149,9 +149,9 @@ func ExecuteBlockEphemerally( return nil, fmt.Errorf("gas used by execution: %d, in header: %d", *usedGas, header.GasUsed) } - if header.BlobGasUsed != nil && *usedBlobGas != *header.BlobGasUsed { - return nil, fmt.Errorf("blob gas used by execution: %d, in header: %d", *usedBlobGas, *header.BlobGasUsed) - } + // if header.BlobGasUsed != nil && *usedBlobGas != *header.BlobGasUsed { + // return nil, fmt.Errorf("blob gas used by execution: %d, in header: %d", *usedBlobGas, *header.BlobGasUsed) + // } var bloom types.Bloom if !vmConfig.NoReceipts { From e08de6e80d8aca9a89f2d341bdebf7c64a89f1e3 Mon Sep 17 00:00:00 2001 From: Pranay Valson Date: Wed, 7 May 2025 13:13:50 -0700 Subject: [PATCH 2/4] reduce docker image build time by selection building for amd64 Signed-off-by: Pranay Valson --- .github/workflows/docker-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 69380599ceb..2097a68154e 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -2,8 +2,8 @@ name: docker-pr on: pull_request: - branches: - - "covalent" + branches: + - "covalent" jobs: deploy-test: @@ -22,4 +22,4 @@ jobs: # continue-on-error: true - name: Build & Publish the Docker image run: | - docker buildx create --name builder --use --platform=linux/amd64,linux/arm64 && docker buildx build --file ./Dockerfile-evm --platform=linux/amd64,linux/arm64 . -t us-docker.pkg.dev/covalent-project/network/evm-server:latest --push \ No newline at end of file + docker buildx create --name builder --use --platform=linux/amd64 && docker buildx build --file ./Dockerfile-evm --platform=linux/amd64 . -t us-docker.pkg.dev/covalent-project/network/evm-server:latest --push From 43722e97103189a7a27c3397b7f8aad55f7a0939 Mon Sep 17 00:00:00 2001 From: Pranay Valson Date: Wed, 7 May 2025 13:17:29 -0700 Subject: [PATCH 3/4] push EBE patch version Signed-off-by: Pranay Valson --- cmd/evm/internal/t8ntool/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/evm/internal/t8ntool/version.go b/cmd/evm/internal/t8ntool/version.go index 92f191bee0a..4a24dd2bd29 100644 --- a/cmd/evm/internal/t8ntool/version.go +++ b/cmd/evm/internal/t8ntool/version.go @@ -9,7 +9,7 @@ import ( const ( EvmServerVersionMajor = 1 EvmServerVersionMinor = 3 - EvmServerVersionPatch = 2 + EvmServerVersionPatch = 3 clientIdentifier = "evm-server" // Client identifier to advertise over the network ) From 998afe47ad21e823d078c3716b6ad07715862b5b Mon Sep 17 00:00:00 2001 From: Pranay Valson Date: Wed, 7 May 2025 18:04:58 -0700 Subject: [PATCH 4/4] adapt set code type and authorization transactions for block-result Signed-off-by: Pranay Valson --- cmd/evm/internal/t8ntool/execution.go | 3 + cmd/evm/internal/t8ntool/types.go | 84 +++++++++++++++++++++------ core/types/block.go | 1 + erigon-lib/types/txn.go | 1 + 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 9ae4095554c..58bf416fce8 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -64,6 +64,7 @@ type stEnv struct { BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"` ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"` ParentBeaconRoot *libcommon.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + RequestsHash *libcommon.Hash `json:"requestsHash" rlp:"optional"` } type stEnvMarshaling struct { @@ -79,6 +80,7 @@ type stEnvMarshaling struct { BlobGasUsed *math.HexOrDecimal64 ExcessBlobGas *math.HexOrDecimal64 ParentBeaconRoot *libcommon.Address + RequestsHash *libcommon.Address } func (stEnv *stEnv) loadFromReplica(replica *BlockReplica) { @@ -88,6 +90,7 @@ func (stEnv *stEnv) loadFromReplica(replica *BlockReplica) { stEnv.Number = replica.Header.Number.Uint64() stEnv.Timestamp = replica.Header.Time stEnv.BlockHashes = make(map[math.HexOrDecimal64]libcommon.Hash) + stEnv.RequestsHash = replica.Header.RequestsHash for _, blockhash := range replica.State.BlockhashRead { stEnv.BlockHashes[math.HexOrDecimal64(blockhash.BlockNumber)] = blockhash.BlockHash } diff --git a/cmd/evm/internal/t8ntool/types.go b/cmd/evm/internal/t8ntool/types.go index 79b141640a1..f886dc67a9b 100644 --- a/cmd/evm/internal/t8ntool/types.go +++ b/cmd/evm/internal/t8ntool/types.go @@ -33,6 +33,7 @@ type BlockReplica struct { State *StateSpecimen `json:"State"` Withdrawals []*Withdrawal BlobTxSidecars []*BlobTxSidecar + RequestsHash *libcommon.Hash } type Withdrawal struct { @@ -98,27 +99,30 @@ type Header struct { BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"` ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"` ParentBeaconRoot *libcommon.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + RequestsHash *libcommon.Hash `json:"requestsHash" rlp:"optional"` } type Transaction struct { - Type byte `json:"type"` - AccessList types.AccessList `json:"accessList"` - ChainId *BigInt `json:"chainId"` - AccountNonce uint64 `json:"nonce"` - Price *BigInt `json:"gasPrice"` - GasLimit uint64 `json:"gas"` - GasTipCap *BigInt `json:"gasTipCap"` - GasFeeCap *BigInt `json:"gasFeeCap"` - Sender *libcommon.Address `json:"from"` - Recipient *libcommon.Address `json:"to" rlp:"nil"` // nil means contract creation - Amount *BigInt `json:"value"` - Payload []byte `json:"input"` - V *BigInt `json:"v"` - R *BigInt `json:"r"` - S *BigInt `json:"s"` - BlobFeeCap *BigInt `json:"blobFeeCap" rlp:"optional"` - BlobHashes []libcommon.Hash `json:"blobHashes" rlp:"optional"` - BlobGas uint64 `json:"blobGas" rlp:"optional"` + Type byte `json:"type"` + AccessList types.AccessList `json:"accessList"` + ChainId *BigInt `json:"chainId"` + AccountNonce uint64 `json:"nonce"` + Price *BigInt `json:"gasPrice"` + GasLimit uint64 `json:"gas"` + GasTipCap *BigInt `json:"gasTipCap"` + GasFeeCap *BigInt `json:"gasFeeCap"` + Sender *libcommon.Address `json:"from"` + Recipient *libcommon.Address `json:"to" rlp:"nil"` // nil means contract creation + Amount *BigInt `json:"value"` + Payload []byte `json:"input"` + V *BigInt `json:"v"` + R *BigInt `json:"r"` + S *BigInt `json:"s"` + BlobFeeCap *BigInt `json:"blobFeeCap" rlp:"optional"` + BlobHashes []libcommon.Hash `json:"blobHashes" rlp:"optional"` + BlobGas uint64 `json:"blobGas" rlp:"optional"` + Data []byte `rlp:"optional"` + AuthList []types2.Authorization `rlp:"optional"` } type Logs struct { @@ -193,6 +197,7 @@ func adaptHeader(header *types2.Header) (*Header, error) { BlobGasUsed: header.BlobGasUsed, ExcessBlobGas: header.ExcessBlobGas, ParentBeaconRoot: header.ParentBeaconBlockRoot, + RequestsHash: header.RequestsHash, }, nil } @@ -206,6 +211,7 @@ func copyMissingHashesFromReplica(header *Header, inputReplica *BlockReplica) { header.BlobGasUsed = inputReplica.Header.BlobGasUsed header.ExcessBlobGas = inputReplica.Header.ExcessBlobGas header.ParentBeaconRoot = inputReplica.Header.ParentBeaconRoot + header.RequestsHash = inputReplica.Header.RequestsHash } func (tx *Transaction) adaptTransaction() (types2.Transaction, error) { @@ -344,6 +350,48 @@ func (tx *Transaction) adaptTransaction() (types2.Transaction, error) { setSignatureValues(&blobTx.DynamicFeeTransaction.CommonTx, tx.V, tx.R, tx.S) return &blobTx, nil + case types.SetCodeTxType: + var tip *uint256.Int + var feeCap *uint256.Int + if tx.GasTipCap != nil { + tip, overflow = uint256.FromBig((*big.Int)(tx.GasTipCap.Int)) + if overflow { + return nil, fmt.Errorf("GasTipCap field caused an overflow (uint256)") + } + } + + if tx.GasFeeCap != nil { + feeCap, overflow = uint256.FromBig((*big.Int)(tx.GasFeeCap.Int)) + if overflow { + return nil, fmt.Errorf("GasTipCap field caused an overflow (uint256)") + } + } + + dynamicFeeTx := types2.DynamicFeeTransaction{ + CommonTx: types2.CommonTx{ + Nonce: uint64(tx.AccountNonce), + To: tx.Recipient, + Value: value, + Gas: uint64(tx.GasLimit), + Data: tx.Payload, + }, + ChainID: chainId, + Tip: tip, + FeeCap: feeCap, + AccessList: tx.AccessList, + } + + setCodeTx := types2.SetCodeTransaction{ + DynamicFeeTransaction: dynamicFeeTx, + Authorizations: tx.AuthList, + } + + if tx.Sender != nil { + setCodeTx.DynamicFeeTransaction.CommonTx.SetFrom(*tx.Sender) + } + setSignatureValues(&setCodeTx.DynamicFeeTransaction.CommonTx, tx.V, tx.R, tx.S) + return &setCodeTx, nil + default: return nil, nil diff --git a/core/types/block.go b/core/types/block.go index 2b0c7b1c036..b02208b94b2 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -104,6 +104,7 @@ type Header struct { ExcessBlobGas *uint64 `json:"excessBlobGas"` ParentBeaconBlockRoot *libcommon.Hash `json:"parentBeaconBlockRoot"` // EIP-4788 + RequestsHash *libcommon.Hash `json:"requestsHash"` // EIP-4844 // The verkle proof is ignored in legacy headers Verkle bool diff --git a/erigon-lib/types/txn.go b/erigon-lib/types/txn.go index ead79109254..385d158f2f7 100644 --- a/erigon-lib/types/txn.go +++ b/erigon-lib/types/txn.go @@ -115,6 +115,7 @@ const ( AccessListTxType byte = 1 // EIP-2930 DynamicFeeTxType byte = 2 // EIP-1559 BlobTxType byte = 3 // EIP-4844 + SetCodeTxType byte = 4 // EIP-7702 ) var ErrParseTxn = fmt.Errorf("%w transaction", rlp.ErrParse)