Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/api-evm/source/actions/eth-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
@tagged("instance", "rpc")
private readonly evm!: Contracts.Evm.Instance;

@inject(Identifiers.Cryptography.Configuration)
protected readonly configuration!: Contracts.Crypto.Configuration;

Check warning on line 20 in packages/api-evm/source/actions/eth-call.ts

View check run for this annotation

Codecov / codecov/patch

packages/api-evm/source/actions/eth-call.ts#L18-L20

Added lines #L18 - L20 were not covered by tests
public readonly name: string = "eth_call";

public readonly schema = {
Expand Down Expand Up @@ -46,11 +49,22 @@
public async handle(parameters: [TxData, Contracts.Crypto.BlockTag]): Promise<any> {
const [data] = parameters;

const {
block: { maxGasLimit },
} = this.configuration.getMilestone();

// Cap gas limit to block gas limit
let gasLimit = BigInt(maxGasLimit);
if (data.gas) {
const userGasLimit = BigInt(data.gas);
gasLimit = userGasLimit < gasLimit ? userGasLimit : gasLimit;
}

Check warning on line 62 in packages/api-evm/source/actions/eth-call.ts

View check run for this annotation

Codecov / codecov/patch

packages/api-evm/source/actions/eth-call.ts#L52-L62

Added lines #L52 - L62 were not covered by tests
const { success, output } = await this.evm.view({
// default to zero address
data: Buffer.from(ethers.getBytes(data.data)),
from: data.from ?? "0x" + "0".repeat(40),
gasLimit: data.gas ? BigInt(data.gas) : undefined,
gasLimit,

Check warning on line 67 in packages/api-evm/source/actions/eth-call.ts

View check run for this annotation

Codecov / codecov/patch

packages/api-evm/source/actions/eth-call.ts#L67

Added line #L67 was not covered by tests
specId: Contracts.Evm.SpecId.LATEST,
to: data.to,
});
Expand Down
1 change: 0 additions & 1 deletion packages/evm-consensus/source/services/rounds-iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class AsyncValidatorRoundsIterator implements AsyncIterable<Contracts.Evm
const result = await this.evm.view({
data: Buffer.from(data, "hex"),
from: deployerAddress,
gasLimit: 100_000_000n,
specId: evmSpec,
to: consensusContractAddress,
});
Expand Down
1 change: 0 additions & 1 deletion packages/evm-consensus/source/services/votes-iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class AsyncVotesIterator implements AsyncIterable<Contracts.Evm.Vote> {
const result = await this.evm.view({
data: Buffer.from(data, "hex"),
from: deployerAddress,
gasLimit: 100_000_000n,
specId: evmSpec,
to: consensusContractAddress,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@
block_env.difficulty = U256::ZERO;
})
.modify_tx_chained(|tx_env: &mut TxEnv| {
tx_env.gas_limit = ctx.gas_limit.unwrap_or_else(|| 15_000_000);
tx_env.gas_limit = ctx.gas_limit.unwrap_or_else(|| u64::MAX);

Check warning on line 996 in packages/evm/bindings/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

packages/evm/bindings/src/lib.rs#L996

Added line #L996 was not covered by tests
tx_env.gas_price = ctx.gas_price;
tx_env.gas_priority_fee = None;
tx_env.caller = ctx.from;
Expand Down
Loading