mirror of
https://github.com/logos-messaging/waku-rlnv1-contract.git
synced 2026-01-04 07:13:12 +00:00
feat(WakuRln): zero indexed deployments and updated dependency (#8)
* fix: update submodule * feat(rln): zero indexed deployment
This commit is contained in:
parent
63a7856eb2
commit
e5eefe4891
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -5,6 +5,7 @@
|
|||||||
[submodule "lib/rln-contract"]
|
[submodule "lib/rln-contract"]
|
||||||
path = lib/rln-contract
|
path = lib/rln-contract
|
||||||
url = https://github.com/vacp2p/rln-contract
|
url = https://github.com/vacp2p/rln-contract
|
||||||
|
branch = 35f2182
|
||||||
[submodule "lib/openzeppelin-contracts"]
|
[submodule "lib/openzeppelin-contracts"]
|
||||||
path = lib/openzeppelin-contracts
|
path = lib/openzeppelin-contracts
|
||||||
url = https://github.com/Openzeppelin/openzeppelin-contracts
|
url = https://github.com/Openzeppelin/openzeppelin-contracts
|
||||||
|
|||||||
@ -10,7 +10,10 @@ error NotImplemented();
|
|||||||
contract WakuRln is Ownable, RlnBase {
|
contract WakuRln is Ownable, RlnBase {
|
||||||
uint16 public immutable contractIndex;
|
uint16 public immutable contractIndex;
|
||||||
|
|
||||||
constructor(address _poseidonHasher, uint16 _contractIndex) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {
|
constructor(
|
||||||
|
address _poseidonHasher,
|
||||||
|
uint16 _contractIndex
|
||||||
|
) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {
|
||||||
contractIndex = _contractIndex;
|
contractIndex = _contractIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +22,8 @@ contract WakuRln is Ownable, RlnBase {
|
|||||||
function _register(uint256 idCommitment) internal {
|
function _register(uint256 idCommitment) internal {
|
||||||
_validateRegistration(idCommitment);
|
_validateRegistration(idCommitment);
|
||||||
|
|
||||||
members[idCommitment] = 1;
|
members[idCommitment] = idCommitmentIndex;
|
||||||
|
memberExists[idCommitment] = true;
|
||||||
|
|
||||||
emit MemberRegistered(idCommitment, idCommitmentIndex);
|
emit MemberRegistered(idCommitment, idCommitmentIndex);
|
||||||
idCommitmentIndex += 1;
|
idCommitmentIndex += 1;
|
||||||
@ -27,7 +31,7 @@ contract WakuRln is Ownable, RlnBase {
|
|||||||
|
|
||||||
function register(uint256[] calldata idCommitments) external onlyOwner {
|
function register(uint256[] calldata idCommitments) external onlyOwner {
|
||||||
uint256 len = idCommitments.length;
|
uint256 len = idCommitments.length;
|
||||||
for (uint256 i = 0; i < len;) {
|
for (uint256 i = 0; i < len; ) {
|
||||||
_register(idCommitments[i]);
|
_register(idCommitments[i]);
|
||||||
unchecked {
|
unchecked {
|
||||||
++i;
|
++i;
|
||||||
@ -39,21 +43,28 @@ contract WakuRln is Ownable, RlnBase {
|
|||||||
revert NotImplemented();
|
revert NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {
|
function slash(
|
||||||
|
uint256 idCommitment,
|
||||||
|
address payable receiver,
|
||||||
|
uint256[8] calldata proof
|
||||||
|
) external pure override {
|
||||||
revert NotImplemented();
|
revert NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _validateRegistration(uint256 idCommitment) internal view override {
|
function _validateRegistration(
|
||||||
if (!isValidCommitment(idCommitment)) revert InvalidIdCommitment(idCommitment);
|
uint256 idCommitment
|
||||||
if (members[idCommitment] != 0) revert DuplicateIdCommitment();
|
) internal view override {
|
||||||
|
if (!isValidCommitment(idCommitment))
|
||||||
|
revert InvalidIdCommitment(idCommitment);
|
||||||
|
if (memberExists[idCommitment] == true) revert DuplicateIdCommitment();
|
||||||
if (idCommitmentIndex >= SET_SIZE) revert FullTree();
|
if (idCommitmentIndex >= SET_SIZE) revert FullTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)
|
function _validateSlash(
|
||||||
internal
|
uint256 idCommitment,
|
||||||
pure
|
address payable receiver,
|
||||||
override
|
uint256[8] calldata proof
|
||||||
{
|
) internal pure override {
|
||||||
revert NotImplemented();
|
revert NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"chainId": "11155111",
|
"chainId": "11155111",
|
||||||
"contracts": {
|
"contracts": {
|
||||||
"PoseidonHasher": {
|
"PoseidonHasher": {
|
||||||
"address": "0xcBC443bAE23a0BeF71d7f23588108C9929C582C2",
|
"address": "0x9c1c939aCB5c356c91fF2f27E9FD29C5C95E671b",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
@ -42,7 +42,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"WakuRlnRegistry": {
|
"WakuRlnRegistry": {
|
||||||
"address": "0x8e1F3742B987d8BA376c0CBbD7357fE1F003ED71",
|
"address": "0x0A988fd9CA5BAebDf098b8A73621b2AaDa6492E8",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
@ -289,7 +289,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"WakuRlnStorage_0": {
|
"WakuRlnStorage_0": {
|
||||||
"address": "0xb61a949493847FF51A82d2617FEdAeD5D67cf785",
|
"address": "0x02A29114ECDE0Da4D6DB61eAE73a86486cB88c10",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
@ -487,6 +487,25 @@
|
|||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "memberExists",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
Subproject commit bd8403a74e327707afb70e60f582e2546e487891
|
Subproject commit 35f2182669264e222bb6de6eb58465d81c5719b0
|
||||||
Loading…
x
Reference in New Issue
Block a user