diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml index e8c40ab0554993e439981904f17235fa163b972a..954b6cb1fcd6c162a17de2869b1446cf6ba32ae3 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml @@ -386,15 +386,15 @@ type legacy_transaction_object = { gas : quantity; gasPrice : quantity; hash : hash; - input : hash; + input : hex; nonce : quantity; to_ : address option; transactionIndex : quantity option; (* It can be null if it's in a pending block. *) value : quantity; v : quantity; - r : hash; - s : hash; + r : hex; + s : hex; } let legacy_transaction_object_from_rlp_item block_hash rlp_item = @@ -427,7 +427,7 @@ let legacy_transaction_object_from_rlp_item block_hash rlp_item = let gas = decode_number_le gas_used in let gas_price = decode_number_le gas_price in let hash = decode_hash hash in - let input = decode_hash input in + let input = decode_hex input in let nonce = decode_number_le nonce in let to_ = if to_ = Bytes.empty then None else Some (decode_address to_) in let index = decode_optional_number_be index in @@ -435,8 +435,8 @@ let legacy_transaction_object_from_rlp_item block_hash rlp_item = (* The signature is taken from the raw transaction, that is encoded in big endian. *) let v = decode_number_be v in - let r = decode_hash r in - let s = decode_hash s in + let r = decode_hex r in + let s = decode_hex s in { blockHash = block_hash; blockNumber = block_number; @@ -525,15 +525,15 @@ let legacy_transaction_object_encoding = (req "gas" quantity_encoding) (req "gasPrice" quantity_encoding) (req "hash" hash_encoding) - (req "input" hash_encoding) + (req "input" hex_encoding) (req "nonce" quantity_encoding) (req "to" (option address_encoding)) (req "transactionIndex" (option quantity_encoding))) (obj4 (req "value" quantity_encoding) (req "v" quantity_encoding) - (req "r" hash_encoding) - (req "s" hash_encoding))) + (req "r" hex_encoding) + (req "s" hex_encoding))) type 'transaction_object block_transactions = | TxHash of hash list diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli index 887610972d2ade8665222d47029fa502fc432b2c..f690345060c41dc53a413b50046f8fed3249c4bc 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli @@ -158,14 +158,14 @@ type legacy_transaction_object = { gas : quantity; gasPrice : quantity; hash : hash; - input : hash; + input : hex; nonce : quantity; to_ : address option; transactionIndex : quantity option; value : quantity; v : quantity; - r : hash; - s : hash; + r : hex; + s : hex; } val legacy_transaction_object_encoding : diff --git a/etherlink/bin_node/lib_dev/encodings/transaction.ml b/etherlink/bin_node/lib_dev/encodings/transaction.ml index 9f0e3102072984bc6a3c8f477c3a228b94ec9c65..d89fa9d95bd15f91f2530cf76965a06fc55f24e1 100644 --- a/etherlink/bin_node/lib_dev/encodings/transaction.ml +++ b/etherlink/bin_node/lib_dev/encodings/transaction.ml @@ -438,12 +438,12 @@ let to_transaction_object : gas = Qty gas_limit; gasPrice = Qty max_fee_per_gas; hash; - input = decode_hash data; + input = decode_hex data; nonce = Qty nonce; to_; transactionIndex = None; value = Qty value; v = Qty v; - r = decode_hash r; - s = decode_hash s; + r = decode_hex r; + s = decode_hex s; } diff --git a/etherlink/bin_node/lib_dev/encodings/transaction_info.ml b/etherlink/bin_node/lib_dev/encodings/transaction_info.ml index daa669b055539ce85dae8c27ff31cfd765192b7b..5f74374a557bd18c2835aacfe7e9064ca1296ffc 100644 --- a/etherlink/bin_node/lib_dev/encodings/transaction_info.ml +++ b/etherlink/bin_node/lib_dev/encodings/transaction_info.ml @@ -21,12 +21,12 @@ type receipt_fields = { type object_fields = { gas : quantity; gas_price : quantity; - input : hash; + input : hex; nonce : quantity; value : quantity; v : quantity; - r : hash; - s : hash; + r : hex; + s : hex; } type t = { @@ -158,9 +158,9 @@ let object_fields_encoding = (obj8 (req "gas" quantity_encoding) (req "gas_price" quantity_encoding) - (req "input" hash_encoding) + (req "input" hex_encoding) (req "nonce" quantity_encoding) (req "value" quantity_encoding) (req "v" quantity_encoding) - (req "r" hash_encoding) - (req "s" hash_encoding)) + (req "r" hex_encoding) + (req "s" hex_encoding)) diff --git a/etherlink/bin_node/lib_dev/encodings/transaction_info.mli b/etherlink/bin_node/lib_dev/encodings/transaction_info.mli index 506b69b033bc6a8682e7daab65a94cbe9bb3b20a..d554268bf28a11057a998230ace309e9fc59c205 100644 --- a/etherlink/bin_node/lib_dev/encodings/transaction_info.mli +++ b/etherlink/bin_node/lib_dev/encodings/transaction_info.mli @@ -21,12 +21,12 @@ type receipt_fields = { type object_fields = { gas : quantity; gas_price : quantity; - input : hash; + input : hex; nonce : quantity; value : quantity; v : quantity; - r : hash; - s : hash; + r : hex; + s : hex; } (** This is the merge of a {!Transaction_receipt.t} and diff --git a/etherlink/bin_node/lib_dev/transaction_object.ml b/etherlink/bin_node/lib_dev/transaction_object.ml index 6b54bcc6d5c08b2e8687deb19927b129c0173606..d08365b87ce39608755cb791c22c0519e9ec8d2f 100644 --- a/etherlink/bin_node/lib_dev/transaction_object.ml +++ b/etherlink/bin_node/lib_dev/transaction_object.ml @@ -246,8 +246,6 @@ type t = | EIP_2930 of EIP_2930.t | EIP_1559 of EIP_1559.t -let unhash (Hash h) = h - let from_store_transaction_object (obj : legacy_transaction_object) = Kernel obj let block_from_legacy block = @@ -309,10 +307,10 @@ let reconstruct_from_eip_2930_transaction (obj : legacy_transaction_object) gas = obj.gas; gas_price = obj.gasPrice; access_list; - input = unhash obj.input; + input = obj.input; v = obj.v; - r = unhash obj.r; - s = unhash obj.s; + r = obj.r; + s = obj.s; } | _ -> error_with "failed to decode EIP-2930 transaction" @@ -358,10 +356,10 @@ let reconstruct_from_eip_1559_transaction (obj : legacy_transaction_object) max_fee_per_gas; max_priority_fee_per_gas; access_list; - input = unhash obj.input; + input = obj.input; v = obj.v; - r = unhash obj.r; - s = unhash obj.s; + r = obj.r; + s = obj.s; } | _ -> (* This should not happen, but we cannot decode the transaction *) diff --git a/etherlink/bin_node/lib_dev/tx_pool.ml b/etherlink/bin_node/lib_dev/tx_pool.ml index ed85f0b4eb46b35516916fc0a216a441f76a58de..75e6a11c0184cde7e172222ed506b1e8bebff334 100644 --- a/etherlink/bin_node/lib_dev/tx_pool.ml +++ b/etherlink/bin_node/lib_dev/tx_pool.ml @@ -452,7 +452,7 @@ let insert_valid_transaction state tx_raw state in let tx_data = - transaction_object.input |> Ethereum_types.hash_to_bytes |> Bytes.of_string + transaction_object.input |> Ethereum_types.hex_to_bytes |> Bytes.of_string in if tx_data_size_limit_reached ~max_number_of_chunks ~tx_data then let*! () = Tx_pool_events.tx_data_size_limit_reached () in