From 2e41b95174b4b29e74d5f9be19004f2ebe67b0e7 Mon Sep 17 00:00:00 2001 From: Stefan Stefanov Date: Wed, 18 Oct 2023 17:14:52 +0300 Subject: [PATCH] Fixing comments Signed-off-by: Stefan Stefanov --- contracts/solidity/account/NonExisting.sol | 6 +++--- test/solidity/account/nonExisting.js | 16 ++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/contracts/solidity/account/NonExisting.sol b/contracts/solidity/account/NonExisting.sol index 6729a8768..199e5dec6 100644 --- a/contracts/solidity/account/NonExisting.sol +++ b/contracts/solidity/account/NonExisting.sol @@ -3,19 +3,19 @@ pragma solidity ^0.8.20; contract NonExisting { function callOnNonExistingAccount(address nonExistingAddr) external { - nonExistingAddr.call{value: 0}( + nonExistingAddr.call( abi.encodeWithSignature("doesNotExist()") ); } function delegatecallOnNoneExistingAccount(address nonExistingAddr) external { - (bool success, bytes memory data) = nonExistingAddr.delegatecall( + nonExistingAddr.delegatecall( abi.encodeWithSignature("doesNotExist()") ); } function staticcallOnNoneExistingAccount(address nonExistingAddr) external { - (bool success, bytes memory data) = nonExistingAddr.staticcall( + nonExistingAddr.staticcall( abi.encodeWithSignature("doesNotExist()") ); } diff --git a/test/solidity/account/nonExisting.js b/test/solidity/account/nonExisting.js index 60bd15a47..3951f1a6d 100644 --- a/test/solidity/account/nonExisting.js +++ b/test/solidity/account/nonExisting.js @@ -1,21 +1,19 @@ -const { expect, assert } = require('chai') +const { expect } = require('chai') const { ethers } = require('hardhat') const Constants = require('../../constants') describe('Solidity Account non Existing', function () { - let contract, wallet + let contract, randomAddress before(async function () { - const signers = await ethers.getSigners() - wallet = signers[0] + randomAddress = ethers.Wallet.createRandom().address; const factory = await ethers.getContractFactory(Constants.Contract.NonExisting) contract = await factory.deploy() }) it('should confirm `call` on a non existing account', async function () { try { - const addr = wallet.address << 3; - const tx = await contract.callOnNonExistingAccount(addr) + const tx = await contract.callOnNonExistingAccount(randomAddress) await tx.wait() } catch (err) { expect(err.reason).to.equal("invalid address or ENS name") @@ -24,8 +22,7 @@ describe('Solidity Account non Existing', function () { it('should confirm `delegatecall` on a non existing account', async function () { try { - const addr = wallet.address << 3; - const tx = await contract.delegatecallOnNoneExistingAccount(addr) + const tx = await contract.delegatecallOnNoneExistingAccount(randomAddress) await tx.wait() } catch (err) { expect(err.reason).to.equal("invalid address or ENS name") @@ -34,8 +31,7 @@ describe('Solidity Account non Existing', function () { it('should confirm `staticcall` on a non existing account', async function () { try { - const addr = wallet.address << 3; - const tx = await contract.staticcallOnNoneExistingAccount(addr) + const tx = await contract.staticcallOnNoneExistingAccount(randomAddress) await tx.wait() } catch (err) { expect(err.reason).to.equal("invalid address or ENS name")