Skip to content

Commit 6ccd4ae

Browse files
committed
fix: revert unknown voter when validating
1 parent d9f5823 commit 6ccd4ae

File tree

10 files changed

+1439
-314
lines changed

10 files changed

+1439
-314
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ snapshot :; forge snapshot
2222

2323
format :; forge fmt
2424

25-
deploy-votsengine :; @forge script script/DeployVotsEngine.s.sol:DeployVotsEngine --rpc-url ${SEPOLIA_RPC_URL} --account vutsdefault --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY} -vvvv
25+
deploy-votsengine :; @forge script script/DeployVotsEngine.s.sol:DeployVotsEngine --rpc-url ${SEPOLIA_RPC_URL} --chain sepolia --account vutsdefault --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY} -vvvv
2626

2727
deploy-votsengine-fuji :; @forge script script/DeployVotsEngine.s.sol:DeployVotsEngine --rpc-url ${FUJI_RPC_URL} --account vutsdefault --broadcast --verifier-url ${FUJI_VERIFIER_URL} --etherscan-api-key ${ETHERSCAN_API_KEY} -vvvv
2828

29-
verify-votsengine :;forge verify-contract --etherscan-api-key ${ETHERSCAN_API_KEY} --chain sepolia 0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287 "src/VotsEngine.sol:VotsEngine"
29+
verify-votsengine :; @forge verify-contract --etherscan-api-key ${ETHERSCAN_API_KEY} --chain sepolia --watch 0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287 "src/VotsEngine.sol:VotsEngine" --show-standard-json-input > standard-input2.json
3030

3131
verify-contract:
3232
@echo "Enter contract address:"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ forge build
9191
The VotsEngine contract is currently deployed and live on multiple testnets:
9292

9393
### Sepolia Testnet
94-
**VotsEngine Contract**: `0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287..`
94+
**VotsEngine Contract**: `0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B....`
9595

96-
**NFT Contract**: `0x8f10FA6bDA8bE2Ebd7A905d3D9EF81A360B5aA92.`
96+
**NFT Contract**: `0x9875e21B296370782C3a2F8d6Aaef45C6db2a75F...`
9797

9898
**Network**: Sepolia Testnet
9999
- **Chain ID**: 11155111
100-
- **VotsEngine Block Explorer**: https://sepolia.etherscan.io/address/0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287..
101-
- **NFT Contract Block Explorer**: https://sepolia.etherscan.io/address/0x8f10FA6bDA8bE2Ebd7A905d3D9EF81A360B5aA92.
100+
- **VotsEngine Block Explorer**: https://sepolia.etherscan.io/address/0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B....
101+
- **NFT Contract Block Explorer**: https://sepolia.etherscan.io/address/0x9875e21B296370782C3a2F8d6Aaef45C6db2a75F...
102102

103103
### Fuji Testnet (Avalanche)
104104
**VotsEngine Contract**: `0xed7eA5221041A1982d9d257c9617B1448032838d`
@@ -120,7 +120,7 @@ You can interact with the deployed contract using:
120120

121121
```javascript
122122
// Example using ethers.js with Sepolia
123-
const sepoliaContractAddress = "0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287..";
123+
const sepoliaContractAddress = "0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B....";
124124
const VotsEngineSepoliaClient = new ethers.Contract(sepoliaContractAddress, abi, sepoliaProvider);
125125

126126
// Example using ethers.js with Fuji
@@ -146,7 +146,7 @@ The VotsEngine system requires a **hybrid physical-digital infrastructure**:
146146
### Deploying the System
147147

148148
The VotsEngine is already deployed on multiple testnets:
149-
- **Sepolia**: `0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287..`
149+
- **Sepolia**: `0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B....`
150150
- **Fuji (Avalanche)**: `0xed7eA5221041A1982d9d257c9617B1448032838d`
151151

152152
For local development or custom deployments:
@@ -161,7 +161,7 @@ Or connect to the existing deployments:
161161
```javascript
162162
// Connect to Sepolia deployment
163163
const VotsEngineSepoliaClient = new ethers.Contract(
164-
"0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287..",
164+
"0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B....",
165165
VotsEngineABI,
166166
sepoliaProvider
167167
);

broadcast/DeployVotsEngine.s.sol/11155111/run-1751484111.json

Lines changed: 407 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployVotsEngine.s.sol/11155111/run-1751484281.json

Lines changed: 407 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployVotsEngine.s.sol/11155111/run-1751484545.json

Lines changed: 407 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployVotsEngine.s.sol/11155111/run-latest.json

Lines changed: 154 additions & 154 deletions
Large diffs are not rendered by default.

src/Election.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,12 @@ contract Election is IElection, Ownable {
241241
string memory name,
242242
string memory matricNo,
243243
address pollingUnitAddress
244-
) public pollingUnitOnly(pollingUnitAddress) returns (bool validAddress) {
244+
)
245+
public
246+
pollingUnitOnly(pollingUnitAddress)
247+
noUnknown(matricNo)
248+
returns (bool validAddress)
249+
{
245250
ElectionVoter memory voter = _votersMap[matricNo];
246251
emit ValidateAddressResult(validAddress);
247252
return

standard-input.json

Lines changed: 1 addition & 98 deletions
Large diffs are not rendered by default.

standard-input2.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

transaction.txt

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,104 @@
1-
2-
Script ran successfully.
3-
41
== Return ==
5-
0: contract VotsEngine 0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287
2+
0: contract VotsEngine 0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B
63

74
## Setting up 1 EVM.
85
==========================
96
Simulated On-chain Traces:
107

11-
[209289] → new HelperConfig@0x0B6125c22371CF45e1CCF6748A2E6f3bFF1Edf70
8+
[209289] → new HelperConfig@0xbF68EB26922Ae466f0bC306A0032cb8b9F126e58
129
└─ ← [Return] 712 bytes of code
1310

14-
[3095891] → new CreateElection@0x3d2782408633558f3e8b5a6d64d18441AAE8cED6
11+
[3112315] → new CreateElection@0x6b98b9BAa0eDa68784572A3bdAa609931d0aa09d
1512
├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0)
16-
└─ ← [Return] 15344 bytes of code
13+
└─ ← [Return] 15426 bytes of code
1714

18-
[2266250] → new VotsElectionNft@0x8f10FA6bDA8bE2Ebd7A905d3D9EF81A360B5aA92
15+
[2266250] → new VotsElectionNft@0x9875e21B296370782C3a2F8d6Aaef45C6db2a75F
1916
├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0)
2017
└─ ← [Return] 10976 bytes of code
2118

22-
[2507763] → new VotsEngine@0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287
19+
[2507763] → new VotsEngine@0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B
2320
├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0)
2421
└─ ← [Return] 12405 bytes of code
2522

26-
[1542915] → new VotsEngineFunctionClient@0x650342835765142b7bBafA0f1e503963ae46f773
23+
[1542915] → new VotsEngineFunctionClient@0x0F2973Cdef957253baEBB69d94d6aE7E92BC3918
2724
└─ ← [Return] 7704 bytes of code
2825

29-
[26224] VotsEngine::setFunctionClient(VotsEngineFunctionClient: [0x650342835765142b7bBafA0f1e503963ae46f773])
30-
├─ emit FunctionClientUpdated(oldClient: 0x0000000000000000000000000000000000000000, newClient: VotsEngineFunctionClient: [0x650342835765142b7bBafA0f1e503963ae46f773])
26+
[26224] VotsEngine::setFunctionClient(VotsEngineFunctionClient: [0x0F2973Cdef957253baEBB69d94d6aE7E92BC3918])
27+
├─ emit FunctionClientUpdated(oldClient: 0x0000000000000000000000000000000000000000, newClient: VotsEngineFunctionClient: [0x0F2973Cdef957253baEBB69d94d6aE7E92BC3918])
3128
└─ ← [Return]
3229

33-
[7036] CreateElection::transferOwnership(VotsEngine: [0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287])
34-
├─ emit OwnershipTransferred(previousOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0, newOwner: VotsEngine: [0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287])
30+
[7036] CreateElection::transferOwnership(VotsEngine: [0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B])
31+
├─ emit OwnershipTransferred(previousOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0, newOwner: VotsEngine: [0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B])
3532
└─ ← [Return]
3633

37-
[7474] VotsElectionNft::transferOwnership(VotsEngine: [0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287])
38-
├─ emit OwnershipTransferred(previousOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0, newOwner: VotsEngine: [0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287])
34+
[7474] VotsElectionNft::transferOwnership(VotsEngine: [0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B])
35+
├─ emit OwnershipTransferred(previousOwner: 0x688ce0CCf27a0D0B2b578199ACf3125a1F31f1c0, newOwner: VotsEngine: [0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B])
3936
└─ ← [Stop]
4037

4138

4239
==========================
4340

4441
Chain 11155111
4542

46-
Estimated gas price: 50.826595772 gwei
43+
Estimated gas price: 4.562544858 gwei
4744

48-
Estimated total gas used for script: 14016178
45+
Estimated total gas used for script: 14039302
4946

50-
Estimated amount required: 0.712394613474399416 ETH
47+
Estimated amount required: 0.064054945150009116 ETH
5148

5249
==========================
5350

5451
##### sepolia
55-
✅ [Success] Hash: 0x5985c9c02f2ee52e8a48dfdb27280efcf82c326fdb3872d050e7c667f58e82c6
56-
Block: 8670449
57-
Paid: 0.000727156966777522 ETH (28906 gas * 25.155918037 gwei)
52+
✅ [Success] Hash: 0x8d87c69ec85e3acd70c42482541a3846cfcfeaf3eb0f627751ea4f5185fce943
53+
Block: 8678160
54+
Paid: 0.000104566915245464 ETH (47656 gas * 2.194202519 gwei)
5855

5956

6057
##### sepolia
61-
✅ [Success] Hash: 0xc06a2912e8ec19537a8451815a5128671dce66e480a8965e24e9889412eb499e
62-
Contract Address: 0x8f10FA6bDA8bE2Ebd7A905d3D9EF81A360B5aA92
63-
Block: 8670449
64-
Paid: 0.063122537646178324 ETH (2509252 gas * 25.155918037 gwei)
58+
✅ [Success] Hash: 0x3ed5b2f00c78e874df0967a5ab41ee2d7e1c4549adddaead00f2bb87e2c807ff
59+
Contract Address: 0x0F2973Cdef957253baEBB69d94d6aE7E92BC3918
60+
Block: 8678160
61+
Paid: 0.003776891766967295 ETH (1721305 gas * 2.194202519 gwei)
6562

6663

6764
##### sepolia
68-
✅ [Success] Hash: 0xc37696578b6b8df27b45a86451d3f9ca7d34833c5e9d7c28292561e340cd177d
69-
Block: 8670449
70-
Paid: 0.001198830429971272 ETH (47656 gas * 25.155918037 gwei)
65+
✅ [Success] Hash: 0x20714ebfcc15170ec1b436fd096a2bd553d18b00220192a54fb6dfbd2f0a1ce9
66+
Contract Address: 0x6b98b9BAa0eDa68784572A3bdAa609931d0aa09d
67+
Block: 8678160
68+
Paid: 0.007481043526227221 ETH (3409459 gas * 2.194202519 gwei)
7169

7270

7371
##### sepolia
74-
✅ [Success] Hash: 0x51a96c7336e5002f2358a01ba01bf7f054786f5e5d8c39c9e5017ce8ac432682
75-
Block: 8670449
76-
Paid: 0.000716138674677316 ETH (28468 gas * 25.155918037 gwei)
72+
✅ [Success] Hash: 0x9568c1ad343445aa720d93b6456144304601e9ccf04db1d6d881aad948b04bd8
73+
Block: 8678160
74+
Paid: 0.000062464557310892 ETH (28468 gas * 2.194202519 gwei)
7775

7876

7977
##### sepolia
80-
✅ [Success] Hash: 0xc6323766798e3ead51f3330c79280341841b3e939908125aa1a9d0d1d6ddde75
81-
Contract Address: 0x41A221CF6CD0d4BA6FDf18b6F492fFD048CbA287
82-
Block: 8670449
83-
Paid: 0.069519561823397239 ETH (2763547 gas * 25.155918037 gwei)
78+
✅ [Success] Hash: 0xb09cfa0a3f3790687a8cd21f9aa91fd20d1f3447b544a2c6ef89d3b4d1c0d03b
79+
Contract Address: 0x9875e21B296370782C3a2F8d6Aaef45C6db2a75F
80+
Block: 8678160
81+
Paid: 0.005505807059205788 ETH (2509252 gas * 2.194202519 gwei)
8482

8583

8684
##### sepolia
87-
✅ [Success] Hash: 0x8fcc734c7dbf9319a77cb1e8b397d93857d129c3243dbe7a9b3e0d2aa141f141
88-
Contract Address: 0x650342835765142b7bBafA0f1e503963ae46f773
89-
Block: 8670449
90-
Paid: 0.043301007496678285 ETH (1721305 gas * 25.155918037 gwei)
85+
✅ [Success] Hash: 0x4e9d66f32c95c6a57e99c86d33557c8fc937a8ab79e57852c77a087ce8f8315f
86+
Block: 8678160
87+
Paid: 0.000063425618014214 ETH (28906 gas * 2.194202519 gwei)
9188

9289

9390
##### sepolia
94-
✅ [Success] Hash: 0xd61b9d895e3efd3ea03867784b1600e6cff765f4bd4dce90f3ac51b72288da33
95-
Contract Address: 0x0B6125c22371CF45e1CCF6748A2E6f3bFF1Edf70
96-
Block: 8670449
97-
Paid: 0.007106924184223055 ETH (282515 gas * 25.155918037 gwei)
91+
✅ [Success] Hash: 0xf86daeb402663050a4e6fddc6b696f3fbbe4e1224be6277949700e1f02698dfc
92+
Contract Address: 0xbF68EB26922Ae466f0bC306A0032cb8b9F126e58
93+
Block: 8678160
94+
Paid: 0.000619895124655285 ETH (282515 gas * 2.194202519 gwei)
9895

9996

10097
##### sepolia
101-
✅ [Success] Hash: 0x10360f77c122a0bab187cda3259b0375f22cf9e7b8386bc86dbdcafca219bdb8
102-
Contract Address: 0x3d2782408633558f3e8b5a6d64d18441AAE8cED6
103-
Block: 8670449
104-
Paid: 0.085320295813453383 ETH (3391659 gas * 25.155918037 gwei)
105-
106-
✅ Sequence #1 on sepolia | Total Paid: 0.271012453035356396 ETH (10773308 gas * avg 25.155918037 gwei)
107-
98+
✅ [Success] Hash: 0xd461c025829fbef83c3fba9ea947f1e1eb82571b1de45e8688d268758196dc9e
99+
Contract Address: 0x774E6542baEb7Fc4B9d592b878dC1C6BfB8B3E2B
100+
Block: 8678160
101+
Paid: 0.006063755458344665 ETH (2763535 gas * 2.194202519 gwei)
108102

109-
==========================
103+
✅ Sequence #1 on sepolia | Total Paid: 0.023677850025970824 ETH (10791096 gas * avg 2.194202519 gwei)
104+

0 commit comments

Comments
 (0)