From b6fc510973ac1fa68b711643da50c2bbf809d39d Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Mon, 12 Jun 2023 23:19:55 +0800 Subject: [PATCH] evm: Add `input` to eth_call (#2051) * Add `input` to eth_call * Prefer input over data * Fix comment --------- Co-authored-by: Prasanna Loganathar --- lib/ain-grpc/src/call_request.rs | 2 ++ lib/ain-grpc/src/rpc/eth.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ain-grpc/src/call_request.rs b/lib/ain-grpc/src/call_request.rs index 85a221d789..459f6c743e 100644 --- a/lib/ain-grpc/src/call_request.rs +++ b/lib/ain-grpc/src/call_request.rs @@ -25,6 +25,8 @@ pub struct CallRequest { pub value: Option, /// Data pub data: Option, + /// Input + pub input: Option, /// Nonce pub nonce: Option, /// AccessList diff --git a/lib/ain-grpc/src/rpc/eth.rs b/lib/ain-grpc/src/rpc/eth.rs index da1d608318..e8f8873065 100644 --- a/lib/ain-grpc/src/rpc/eth.rs +++ b/lib/ain-grpc/src/rpc/eth.rs @@ -258,6 +258,7 @@ impl MetachainRPCServer for MetachainRPCModule { gas, value, data, + input, .. } = input; let TxResponse { data, .. } = self @@ -267,7 +268,13 @@ impl MetachainRPCServer for MetachainRPCModule { from, to, value.unwrap_or_default(), - &data.map(|d| d.0).unwrap_or_default(), + // https://github.com/ethereum/go-ethereum/blob/281e8cd5abaac86ed3f37f98250ff147b3c9fe62/internal/ethapi/transaction_args.go#L67 + // We accept "data" and "input" for backwards-compatibility reasons. + // "input" is the newer name and should be preferred by clients. + // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 + &input + .map(|d| d.0) + .unwrap_or(data.map(|d| d.0).unwrap_or_default()), gas.unwrap_or(U256::from(u64::MAX)).as_u64(), vec![], self.block_number_to_u256(block_number),