Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix from jmh benchmark #2268

Merged
merged 1 commit into from
Mar 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package co.rsk.jmh.web3;

import co.rsk.jmh.web3.plan.LocaWalletlPlan;
import co.rsk.jmh.web3.plan.LocalWalletPlan;
import co.rsk.jmh.web3.plan.TransactionPlan;
import org.openjdk.jmh.annotations.*;
import org.web3j.protocol.core.methods.request.Transaction;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void ethSendTransaction_ContractCall(TransactionPlan plan) throws Benchma
}

@Benchmark
public void ethSign(LocaWalletlPlan plan) throws BenchmarkWeb3Exception {
public void ethSign(LocalWalletPlan plan) throws BenchmarkWeb3Exception {
String address = plan.getEthSignAddress();
String message = plan.getEthSignMessage();
plan.getWeb3Connector().ethSign(address, message);
Expand Down
2 changes: 1 addition & 1 deletion rskj-core/src/jmh/java/co/rsk/jmh/web3/BenchmarkWeb3.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void traceFilterBetweenBlockRange(TracePlan plan) throws BenchmarkWeb3Exc
}

@Benchmark
@Timeout(time = 60)
@Timeout(time = 100)
public void traceFilterBetweenAddresses(TracePlan plan) throws BenchmarkWeb3Exception {
plan.getWeb3Connector().traceFilter(plan.getFromBlock(), plan.getToBlock(), plan.getFromAddresses(), plan.getToAddresses());
}
Expand Down
30 changes: 7 additions & 23 deletions rskj-core/src/jmh/java/co/rsk/jmh/web3/plan/EthCallPlan.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@

package co.rsk.jmh.web3.plan;

import co.rsk.jmh.helpers.BenchmarkHelper;
import co.rsk.jmh.web3.BenchmarkWeb3Exception;
import co.rsk.jmh.web3.e2e.RskModuleWeb3j;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.web3j.protocol.core.methods.response.Transaction;

import java.math.BigInteger;

Expand All @@ -44,29 +41,16 @@ public void setUp(BenchmarkParams params) throws BenchmarkWeb3Exception {
ethCallArguments = buildEthCallArguments();
}

private Transaction setupTransaction() {
Transaction tx = new Transaction();

tx.setFrom(configuration.getString("eth_call.transaction.from"));
tx.setTo(configuration.getString("eth_call.transaction.to"));
tx.setGas(configuration.getString("eth_call.transaction.gas"));
tx.setGasPrice(configuration.getString("eth_call.transaction.gasPrice"));
tx.setValue(configuration.getString("eth_call.transaction.value"));
tx.setInput(configuration.getString("eth_call.transaction.input"));

return tx;
}

private RskModuleWeb3j.EthCallArguments buildEthCallArguments() {
RskModuleWeb3j.EthCallArguments args = new RskModuleWeb3j.EthCallArguments();
Transaction tx = setupTransaction();

args.setFrom(tx.getFrom());
args.setTo(tx.getTo());
args.setGas("0x" + tx.getGas().toString(16));
args.setGasPrice("0x" + tx.getGasPrice().toString(16));
args.setValue("0x" + tx.getValue().toString(16));
args.setData(tx.getInput());
args.setGasLimit(configuration.getString("eth_call.gasLimit"));
args.setFrom(configuration.getString("eth_call.transaction.from"));
args.setTo(configuration.getString("eth_call.transaction.to"));
args.setGas(configuration.getString("eth_call.transaction.gas"));
args.setGasPrice(configuration.getString("eth_call.transaction.gasPrice"));
args.setValue(configuration.getString("eth_call.transaction.value"));
args.setData(configuration.getString("eth_call.transaction.input"));

return args;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.openjdk.jmh.infra.BenchmarkParams;

@State(Scope.Benchmark)
public class LocaWalletlPlan extends BasePlan{
public class LocalWalletPlan extends BasePlan{

public static final String ETH_SIGN_ADDRESS = "ethSign.address";
public static final String ETH_SIGN_MESSAGE = "ethSign.message";
Expand Down
1 change: 1 addition & 0 deletions rskj-core/src/jmh/resources/conf/testnet-3_860_000.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ trace.fromAddresses=0x0000000000000000000000000000000000000000
############################
# eth_call
############################
eth_call.gasLimit=0x4e252e0
eth_call.transaction.blockNumber=0x362193
eth_call.transaction.from=0x4a727d7943b563462c96d40689836600d20b983b
eth_call.transaction.to=0x19f64674d8a5b4e652319f5e239efd3bc969a1fe
Expand Down
Loading