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

test: extend the coverage of account nonce discrepancies tests #703

Merged
merged 21 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cd74568
test: first 4 tests
anastasiya-kovaliova Feb 27, 2024
2361992
add more tests for nonce discrepancies
anastasiya-kovaliova Mar 1, 2024
2b850df
add more contract functions
anastasiya-kovaliova Mar 11, 2024
c48e496
- added additional tests for checking the nonce
nickeynikolovv Mar 13, 2024
ff7b22b
- removed unneeded console.logs, polished some tests
nickeynikolovv Mar 13, 2024
6c4a873
removed .only from the describe
nickeynikolovv Mar 14, 2024
74649fc
- applied gitignore json removal
nickeynikolovv Mar 25, 2024
1697084
- removed unneeded json files
nickeynikolovv Mar 25, 2024
9555c4f
Revert "- removed unneeded json files"
nickeynikolovv Mar 25, 2024
951616b
- removed unneeded internalCalee json
nickeynikolovv Mar 25, 2024
1cde0ca
Added contracts-abi json files for the contracts
nickeynikolovv Mar 26, 2024
7c49202
Renamed sefdestruct to selfDestructSample function in Sample contract
nickeynikolovv Mar 26, 2024
66a6a61
-removed unneeded console.logs
nickeynikolovv May 9, 2024
34105ff
removed unneeded tokenAddress override
nickeynikolovv May 9, 2024
57eac84
Merge branch 'main' into test_677-account-nonce-discrepancies-additio…
natanasow Feb 4, 2025
e8b3d8c
chore: pull main
natanasow Feb 4, 2025
75b54dd
chore: format contract
natanasow Feb 4, 2025
dcfa01c
chore: remove unused constants
natanasow Feb 4, 2025
5154a0b
Merge branch 'main' into test_677-account-nonce-discrepancies-additio…
natanasow Feb 4, 2025
f49d8be
chore: rename some tests
natanasow Feb 5, 2025
6671124
Merge branch 'main' into test_677-account-nonce-discrepancies-additio…
natanasow Feb 5, 2025
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
@@ -1,4 +1,36 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "DeployedContractAddress",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_salt",
"type": "uint256"
}
],
"name": "deployViaCreate2",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "externalFunction",
Expand All @@ -25,6 +57,24 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "_contract",
"type": "address"
},
{
"internalType": "address payable",
"name": "_receiver",
"type": "address"
}
],
"name": "internalTransfer",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "revertWithRevertReason",
Expand Down Expand Up @@ -63,5 +113,18 @@
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "sampleAddress",
"type": "address"
}
],
"name": "selfdestructSample",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"inputs": [],
"name": "selfDestructSample",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
26 changes: 23 additions & 3 deletions contracts/discrepancies/nonce/InternalCallee.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

contract Sample {}
contract Sample {
function selfDestructSample() external {
selfdestruct(payable(msg.sender));
}
}

contract InternalCallee {
uint calledTimes = 0;
Expand All @@ -11,12 +15,10 @@ contract InternalCallee {
}

function externalFunction() external returns (uint) {
// mutate state to maintain non-view function status
return ++calledTimes;
}

function revertWithRevertReason() public returns (bool) {
// mutate state to maintain non-view function status
++calledTimes;
revert("RevertReason");
}
Expand All @@ -28,4 +30,22 @@ contract InternalCallee {
function selfDestruct(address payable _addr) external {
selfdestruct(_addr);
}

function selfdestructSample(address payable sampleAddress) external {
Sample(sampleAddress).selfDestructSample();
}

function internalTransfer(address payable _contract, address payable _receiver) payable external {
(bool success,) = _contract.call(abi.encodeWithSignature("transferTo(address)", _receiver));
require(success, "Function call failed");
}

event DeployedContractAddress(address);

function deployViaCreate2(uint256 _salt) external returns (address) {
Sample temp = new Sample{salt : bytes32(_salt)}();
emit DeployedContractAddress(address(temp));

return address(temp);
}
}
Loading
Loading