diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 1892ffcc8..30827e2b1 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -836,6 +836,6 @@ func (m callMsg) Data() []byte { return m.CallMsg.Data } func (m callMsg) AccessList() types2.AccessList { return m.CallMsg.AccessList } func (m callMsg) IsFree() bool { return false } -func (m callMsg) BlobGas() uint64 { return misc.GetBlobGasUsed(len(m.CallMsg.DataHashes)) } +func (m callMsg) BlobGas() uint64 { return misc.GetBlobGasUsed(len(m.CallMsg.BlobHashes)) } func (m callMsg) MaxFeePerBlobGas() *uint256.Int { return m.CallMsg.MaxFeePerBlobGas } -func (m callMsg) DataHashes() []libcommon.Hash { return m.CallMsg.DataHashes } +func (m callMsg) BlobHashes() []libcommon.Hash { return m.CallMsg.BlobHashes } diff --git a/core/evm.go b/core/evm.go index d7bdc78cd..148e1ac07 100644 --- a/core/evm.go +++ b/core/evm.go @@ -80,7 +80,7 @@ func NewEVMTxContext(msg Message) evmtypes.TxContext { return evmtypes.TxContext{ Origin: msg.From(), GasPrice: msg.GasPrice(), - DataHashes: msg.DataHashes(), + BlobHashes: msg.BlobHashes(), } } diff --git a/core/state_transition.go b/core/state_transition.go index 89669fa84..18c0c567e 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -92,7 +92,7 @@ type Message interface { CheckNonce() bool Data() []byte AccessList() types2.AccessList - DataHashes() []libcommon.Hash + BlobHashes() []libcommon.Hash IsFree() bool } diff --git a/core/types/blob_tx.go b/core/types/blob_tx.go index 9bf05688c..459c16179 100644 --- a/core/types/blob_tx.go +++ b/core/types/blob_tx.go @@ -38,7 +38,7 @@ func (stx BlobTx) copy() *BlobTx { func (stx BlobTx) Type() byte { return BlobTxType } -func (stx BlobTx) GetDataHashes() []libcommon.Hash { +func (stx BlobTx) GetBlobHashes() []libcommon.Hash { return stx.BlobVersionedHashes } @@ -51,7 +51,7 @@ func (stx BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Mes if err != nil { return Message{}, err } - msg.dataHashes = stx.BlobVersionedHashes + msg.blobHashes = stx.BlobVersionedHashes return msg, err } diff --git a/core/types/blob_tx_wrapper.go b/core/types/blob_tx_wrapper.go index 79f56631a..cc0669427 100644 --- a/core/types/blob_tx_wrapper.go +++ b/core/types/blob_tx_wrapper.go @@ -300,7 +300,7 @@ func (txw *BlobTxWrapper) GetFeeCap() *uint256.Int { return txw.Tx.GetFeeCap() } func (txw *BlobTxWrapper) Cost() *uint256.Int { return txw.Tx.GetFeeCap() } -func (txw *BlobTxWrapper) GetDataHashes() []libcommon.Hash { return txw.Tx.GetDataHashes() } +func (txw *BlobTxWrapper) GetBlobHashes() []libcommon.Hash { return txw.Tx.GetBlobHashes() } func (txw *BlobTxWrapper) GetGas() uint64 { return txw.Tx.GetGas() } func (txw *BlobTxWrapper) GetBlobGas() uint64 { return txw.Tx.GetBlobGas() } diff --git a/core/types/legacy_tx.go b/core/types/legacy_tx.go index 3e8b2da10..92c12f2f9 100644 --- a/core/types/legacy_tx.go +++ b/core/types/legacy_tx.go @@ -87,8 +87,8 @@ func (ct CommonTx) IsContractDeploy() bool { return ct.GetTo() == nil } -func (ct *CommonTx) GetDataHashes() []libcommon.Hash { - // Only blob txs have data hashes +func (ct *CommonTx) GetBlobHashes() []libcommon.Hash { + // Only blob txs have blob hashes return []libcommon.Hash{} } diff --git a/core/types/transaction.go b/core/types/transaction.go index 2e7ed8055..61cdedd3f 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -66,7 +66,7 @@ type Transaction interface { GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int GetFeeCap() *uint256.Int Cost() *uint256.Int - GetDataHashes() []libcommon.Hash + GetBlobHashes() []libcommon.Hash GetGas() uint64 GetBlobGas() uint64 GetValue() *uint256.Int @@ -525,7 +525,7 @@ type Message struct { accessList types2.AccessList checkNonce bool isFree bool - dataHashes []libcommon.Hash + blobHashes []libcommon.Hash } func NewMessage(from libcommon.Address, to *libcommon.Address, nonce uint64, amount *uint256.Int, gasLimit uint64, @@ -593,13 +593,13 @@ func (m *Message) ChangeGas(globalGasCap, desiredGas uint64) { m.gasLimit = gas } -func (m Message) BlobGas() uint64 { return fixedgas.BlobGasPerBlob * uint64(len(m.dataHashes)) } +func (m Message) BlobGas() uint64 { return fixedgas.BlobGasPerBlob * uint64(len(m.blobHashes)) } func (m Message) MaxFeePerBlobGas() *uint256.Int { return &m.maxFeePerBlobGas } -func (m Message) DataHashes() []libcommon.Hash { return m.dataHashes } +func (m Message) BlobHashes() []libcommon.Hash { return m.blobHashes } func DecodeSSZ(data []byte, dest codec.Deserializable) error { err := dest.Deserialize(codec.NewDecodingReader(bytes.NewReader(data), uint64(len(data)))) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 6553ec720..c2d460a66 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -125,7 +125,7 @@ func toBlobTxJSON(tx *BlobTx) *txJSON { enc.R = (*hexutil.Big)(tx.R.ToBig()) enc.S = (*hexutil.Big)(tx.S.ToBig()) enc.MaxFeePerBlobGas = (*hexutil.Big)(tx.MaxFeePerBlobGas.ToBig()) - enc.BlobVersionedHashes = tx.GetDataHashes() + enc.BlobVersionedHashes = tx.GetBlobHashes() return &enc } diff --git a/core/vm/eips.go b/core/vm/eips.go index d126b1a62..f1b1fb2bf 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -243,22 +243,22 @@ func enable3860(jt *JumpTable) { jt[CREATE2].dynamicGas = gasCreate2Eip3860 } -// enable4844 applies mini-danksharding (DATAHASH Opcode) -// - Adds an opcode that returns the versioned data hash of the tx at a index. +// enable4844 applies mini-danksharding (BLOBHASH opcode) +// - Adds an opcode that returns the versioned blob hash of the tx at a index. func enable4844(jt *JumpTable) { - jt[DATAHASH] = &operation{ - execute: opDataHash, + jt[BLOBHASH] = &operation{ + execute: opBlobHash, constantGas: GasFastestStep, numPop: 1, numPush: 1, } } -// opDataHash implements DATAHASH opcode -func opDataHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { +// opBlobHash implements the BLOBHASH opcode +func opBlobHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { idx := scope.Stack.Peek() - if idx.LtUint64(uint64(len(interpreter.evm.TxContext().DataHashes))) { - hash := interpreter.evm.TxContext().DataHashes[idx.Uint64()] + if idx.LtUint64(uint64(len(interpreter.evm.TxContext().BlobHashes))) { + hash := interpreter.evm.TxContext().BlobHashes[idx.Uint64()] idx.SetBytes(hash.Bytes()) } else { idx.Clear() diff --git a/core/vm/evmtypes/evmtypes.go b/core/vm/evmtypes/evmtypes.go index 0a3944f08..a94e50278 100644 --- a/core/vm/evmtypes/evmtypes.go +++ b/core/vm/evmtypes/evmtypes.go @@ -42,7 +42,7 @@ type TxContext struct { TxHash common.Hash Origin common.Address // Provides information for ORIGIN GasPrice *uint256.Int // Provides information for GASPRICE - DataHashes []common.Hash // Provides versioned data hashes for DATAHASH + BlobHashes []common.Hash // Provides versioned blob hashes for BLOBHASH } type ( diff --git a/core/vm/opcodes.go b/core/vm/opcodes.go index 72e0a84d1..f01c01170 100644 --- a/core/vm/opcodes.go +++ b/core/vm/opcodes.go @@ -95,16 +95,16 @@ const ( // 0x40 range - block operations. const ( - BLOCKHASH OpCode = 0x40 + iota - COINBASE - TIMESTAMP - NUMBER - DIFFICULTY - GASLIMIT + BLOCKHASH OpCode = 0x40 + COINBASE OpCode = 0x41 + TIMESTAMP OpCode = 0x42 + NUMBER OpCode = 0x43 + DIFFICULTY OpCode = 0x44 + GASLIMIT OpCode = 0x45 CHAINID OpCode = 0x46 SELFBALANCE OpCode = 0x47 BASEFEE OpCode = 0x48 - DATAHASH OpCode = 0x49 + BLOBHASH OpCode = 0x49 ) // 0x50 range - 'storage' and execution. @@ -281,7 +281,7 @@ var opCodeToString = map[OpCode]string{ CHAINID: "CHAINID", SELFBALANCE: "SELFBALANCE", BASEFEE: "BASEFEE", - DATAHASH: "DATAHASH", + BLOBHASH: "BLOBHASH", // 0x50 range - 'storage' and execution. POP: "POP", @@ -436,7 +436,7 @@ var stringToOp = map[string]OpCode{ "CALLDATACOPY": CALLDATACOPY, "CHAINID": CHAINID, "BASEFEE": BASEFEE, - "DATAHASH": DATAHASH, + "BLOBHASH": BLOBHASH, "DELEGATECALL": DELEGATECALL, "STATICCALL": STATICCALL, "CODESIZE": CODESIZE, diff --git a/interfaces.go b/interfaces.go index 219b53237..a9f97e5a8 100644 --- a/interfaces.go +++ b/interfaces.go @@ -127,7 +127,7 @@ type CallMsg struct { FeeCap *uint256.Int // EIP-1559 fee cap per gas. Tip *uint256.Int // EIP-1559 tip per gas. AccessList types2.AccessList // EIP-2930 access list. - DataHashes []libcommon.Hash // EIP-4844 versioned data hashes. + BlobHashes []libcommon.Hash // EIP-4844 versioned blob hashes. } // A ContractCaller provides contract calls, essentially transactions that are executed by diff --git a/turbo/adapter/ethapi/api.go b/turbo/adapter/ethapi/api.go index 707a7f6ed..af9971c51 100644 --- a/turbo/adapter/ethapi/api.go +++ b/turbo/adapter/ethapi/api.go @@ -461,7 +461,7 @@ func newRPCTransaction(tx types.Transaction, blockHash libcommon.Hash, blockNumb // if the transaction has been mined, compute the effective gas price result.GasPrice = computeGasPrice(tx, blockHash, baseFee) result.MaxFeePerBlobGas = (*hexutil.Big)(t.MaxFeePerBlobGas.ToBig()) - result.BlobVersionedHashes = t.GetDataHashes() + result.BlobVersionedHashes = t.GetBlobHashes() } signer := types.LatestSignerForChainID(chainId.ToBig()) var err error diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index 63aee5b80..f699319cc 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -207,7 +207,7 @@ func (s *EngineServer) newPayload(ctx context.Context, req *engine_types.Executi if version >= clparams.DenebVersion { actualBlobHashes := []libcommon.Hash{} for _, tx := range transactions { - actualBlobHashes = append(actualBlobHashes, tx.GetDataHashes()...) + actualBlobHashes = append(actualBlobHashes, tx.GetBlobHashes()...) } if !reflect.DeepEqual(actualBlobHashes, expectedBlobHashes) { s.logger.Warn("[NewPayload] mismatch in blob hashes", diff --git a/turbo/engineapi/engine_server_experimental.go b/turbo/engineapi/engine_server_experimental.go index 3ec09ee67..5dd1ea80e 100644 --- a/turbo/engineapi/engine_server_experimental.go +++ b/turbo/engineapi/engine_server_experimental.go @@ -215,7 +215,7 @@ func (s *EngineServerExperimental) newPayload(ctx context.Context, req *engine_t if version >= clparams.DenebVersion { actualBlobHashes := []libcommon.Hash{} for _, tx := range transactions { - actualBlobHashes = append(actualBlobHashes, tx.GetDataHashes()...) + actualBlobHashes = append(actualBlobHashes, tx.GetBlobHashes()...) } if !reflect.DeepEqual(actualBlobHashes, expectedBlobHashes) { s.logger.Warn("[NewPayload] mismatch in blob hashes", diff --git a/turbo/execution/eth1/block_building.go b/turbo/execution/eth1/block_building.go index 04f46aa7f..f710dc9c9 100644 --- a/turbo/execution/eth1/block_building.go +++ b/turbo/execution/eth1/block_building.go @@ -166,7 +166,7 @@ func (e *EthereumExecutionModule) GetAssembledBlock(ctx context.Context, req *ex if !ok { return nil, fmt.Errorf("expected blob transaction to be type BlobTxWrapper, got: %T", blobTx) } - versionedHashes, commitments, proofs, blobs := blobTx.GetDataHashes(), blobTx.Commitments, blobTx.Proofs, blobTx.Blobs + versionedHashes, commitments, proofs, blobs := blobTx.GetBlobHashes(), blobTx.Commitments, blobTx.Proofs, blobTx.Blobs lenCheck := len(versionedHashes) if lenCheck != len(commitments) || lenCheck != len(proofs) || lenCheck != len(blobs) { return nil, fmt.Errorf("tx %d in block %s has inconsistent commitments (%d) / proofs (%d) / blobs (%d) / "+ diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index ab83ce8f3..4ea9d1cfa 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -765,7 +765,7 @@ func marshalReceipt(receipt *types.Receipt, txn types.Transaction, chainConfig * fields["contractAddress"] = receipt.ContractAddress } // Set derived blob related fields - numBlobs := len(txn.GetDataHashes()) + numBlobs := len(txn.GetBlobHashes()) if numBlobs > 0 { if header.ExcessBlobGas == nil { log.Warn("excess blob gas not set when trying to marshal blob tx")