Skip to content

Commit

Permalink
fix: use gas options
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Nov 3, 2023
1 parent 03065f4 commit 60dac54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions test/RpcCompatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('RpcCompatibility', () => {
[signer] = await ethers.getSigners();

rpcCompatibilityFactory = await ethers.getContractFactory('TestRpcCompatibility', signer);
rpcCompatibilityContract = await rpcCompatibilityFactory.deploy();
rpcCompatibilityContract = await rpcCompatibilityFactory.deploy(getGasOptions());
await rpcCompatibilityContract.deployTransaction.wait(network.config.confirmations);

transferAmount = getRandomInt(maxTransferAmount);
Expand All @@ -67,7 +67,7 @@ describe('RpcCompatibility', () => {
}

before(async () => {
const receipt = await rpcCompatibilityContract.updateValue(newValue).then((tx) => tx.wait());
const receipt = await rpcCompatibilityContract.updateValue(newValue, getGasOptions()).then((tx) => tx.wait());
blockNumber = hexValue(receipt.blockNumber);
});

Expand Down Expand Up @@ -115,7 +115,7 @@ describe('RpcCompatibility', () => {
tx = await signer.sendTransaction({
to: signer.address,
value: transferAmount,
});
}, getGasOptions());
await tx.wait();
});

Expand Down Expand Up @@ -220,7 +220,7 @@ describe('RpcCompatibility', () => {

it('should support RPC method eth_call', async () => {
const newValue = 200;
await rpcCompatibilityContract.updateValue(newValue).then((tx) => tx.wait());
await rpcCompatibilityContract.updateValue(newValue, getGasOptions()).then((tx) => tx.wait());
const callResult = await provider.send('eth_call', [
{
to: rpcCompatibilityContract.address,
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('RpcCompatibility', () => {
.sendTransaction({
to: signer.address,
value: transferAmount,
})
}, getGasOptions())
.then((tx) => tx.wait());

const newTxCount = await provider.send('eth_getTransactionCount', [signer.address, 'latest']);
Expand All @@ -292,7 +292,7 @@ describe('RpcCompatibility', () => {
const wallet = isHardhat ? Wallet.fromMnemonic(network.config.accounts.mnemonic) : new Wallet(network.config.accounts[0]);

const newValue = 400;
const tx = await signer.populateTransaction(await rpcCompatibilityContract.populateTransaction.updateValue(newValue));
const tx = await signer.populateTransaction(await rpcCompatibilityContract.populateTransaction.updateValue(newValue, getGasOptions()));
const rawTx = await wallet.signTransaction(tx);

const txHash = await provider.send('eth_sendRawTransaction', [rawTx]);
Expand Down Expand Up @@ -329,7 +329,7 @@ describe('RpcCompatibility', () => {
found = true;
});

await rpcCompatibilityContract.updateValueForSubscribe(newValue).then((tx) => tx.wait());
await rpcCompatibilityContract.updateValueForSubscribe(newValue, getGasOptions()).then((tx) => tx.wait());
await waitFor(5, () => {
expect(found).to.be.true;
});
Expand All @@ -343,9 +343,8 @@ describe('RpcCompatibility', () => {
expect(maxPriorityFeePerGas).to.be.a('string');
expect(BigNumber.from(maxPriorityFeePerGas).toNumber()).to.be.at.least(0);

const gasOptions = getGasOptions();
const newValue = 600;
const receipt = await rpcCompatibilityContract.updateValue(newValue, gasOptions).then((tx) => tx.wait());
const receipt = await rpcCompatibilityContract.updateValue(newValue, getGasOptions()).then((tx) => tx.wait());
await checkReceipt(receipt, newValue);
});
}
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const waitFor = async (timeDelay, callback = undefined) => {
};

const getGasOptions = () => {
return network.config.blockGasLimit ? { gasLimit: network.config.blockGasLimit.toString() } : {};
return network.config.gasOptions;
};

const getEVMVersion = () => {
Expand Down

0 comments on commit 60dac54

Please sign in to comment.