Skip to content

Commit

Permalink
evm: Add input to eth_call (#2051)
Browse files Browse the repository at this point in the history
* Add `input` to eth_call

* Prefer input over data

* Fix comment

---------

Co-authored-by: Prasanna Loganathar <[email protected]>
  • Loading branch information
shohamc1 and prasannavl authored Jun 12, 2023
1 parent ef6265e commit b6fc510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/ain-grpc/src/call_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub struct CallRequest {
pub value: Option<U256>,
/// Data
pub data: Option<Bytes>,
/// Input
pub input: Option<Bytes>,
/// Nonce
pub nonce: Option<U256>,
/// AccessList
Expand Down
9 changes: 8 additions & 1 deletion lib/ain-grpc/src/rpc/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ impl MetachainRPCServer for MetachainRPCModule {
gas,
value,
data,
input,
..
} = input;
let TxResponse { data, .. } = self
Expand All @@ -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),
Expand Down

0 comments on commit b6fc510

Please sign in to comment.