-
Notifications
You must be signed in to change notification settings - Fork 11
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
Anonymity mining claims pallet update #303
Conversation
…s_circom.rs` accordingly. Standalone node broke for some reason
…msVerifier::force_set_parameters`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One big thing is to convert this pallet back to without an instancing. Let me know your thoughts, if you think we should have multiple versions of these pallets then that's certainly a worthwhile discussion.
circom_from_raw(wasm_buffer) | ||
} | ||
|
||
pub fn generate_proof<const N: usize>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you break proving out into a separate file and put a feature flag on the mod
? Best to keep code that can't go in the runtime separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire folder circom-proving
is already meant to not be used in the runtime. It is only meant for testing. Technically speaking, we can get rid of the verify_proof
function in this file, since it is identical to that in primitives/verifying/circom.rs
.
Ok((proof, full_assignment)) | ||
} | ||
|
||
/// Verifies a given RLN proof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs / comments need more closer review please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also worth attributing where we got the code from in a citation on the top (add a license header and cite relevant entities w/ links)
/// The map of trees to the maximum number of anchor edges they can have | ||
#[pallet::storage] | ||
#[pallet::getter(fn max_edges)] | ||
pub type MaxEdges<T: Config<I>, I: 'static = ()> = StorageValue<_, u32, ValueQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently doesn't match the comment. Is this meant to be a map? Also since it's rewards pallet we should probably map ResourceID -> u32
to indicate the size of the bridge that a resource ID in question has.
pub type LinkableTreeHasEdge<T: Config<I>, I: 'static = ()> = | ||
StorageMap<_, Blake2_128Concat, (T::TreeId, T::ChainId), bool, ValueQuery>; | ||
#[pallet::getter(fn registered_resource_ids)] | ||
pub type RegisteredResourceIds<T: Config<I>, I: 'static = ()> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory the anonymity claims could be built on a chain with a SignatureBridge
which does register resource IDs. We could and maybe should support a post-registration hook on that pallet which we can use to hook in here so we don't have to double register things all the time.
|
||
/// The next spent tree root index | ||
#[pallet::storage] | ||
#[pallet::getter(fn next_spent_root_index)] | ||
pub(super) type NextSpentRootIndex<T: Config<I>, I: 'static = ()> = | ||
StorageValue<_, T::RootIndex, ValueQuery>; | ||
StorageMap<_, Blake2_128Concat, ResourceId, T::RootIndex, ValueQuery>; | ||
|
||
// Map of treeId -> root index -> root value for unspent roots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update comments to account for ResourceId update.
// Add nullifier on VAnchor | ||
for nullifier in &proof_data.input_nullifiers { | ||
T::VAnchor::add_nullifier_hash(Self::ap_vanchor_tree_id(), *nullifier)?; | ||
/// Ensure valid unspent roots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need better function docs, will help speed up review process to understand the expectation of each function.
TokenWrapper: pallet_token_wrapper::{Pallet, Call, Storage, Event<T>}, | ||
KeyStorage: pallet_key_storage::{Pallet, Call, Storage, Event<T>, Config<T>}, | ||
AnonymityMiningClaims: pallet_anonymity_mining_claims::{Pallet, Call, Storage, Event<T>, Config<T>} | ||
AnonymityMiningClaims: pallet_anonymity_mining_claims::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't make this pallet instance-able. That allows us to have multiple versions of the same pallet in the runtime, which does seem a bit overkill. The way to do this is to remove all <I>
and instance trait extensions. Things like:
<T, I>
-><T>
<T, I = ()>
-><T>
<T: Config<I>, I: 'static = ()>
-><T: Config>
Do book time with me if you want to pair and I can help you learn to do this quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a non-instanceable pallet take in an instanceable pallet in its Config
trait? Because we take in a VAnchor
type that represents the APVAnchor
and pallet_vanchor
is instanceable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume so, maybe @1xstj can chime in too.
|
||
#[pallet::storage] | ||
#[pallet::getter(fn parameters)] | ||
/// Details of the module's parameters for different vanchor configurations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments need updating
Worth trying but should be possible. Just have to pass in a single instance
to the non instance pallet.
…On Sat, Mar 11, 2023 at 8:36 AM Akilesh Tangella ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pallets/anonymity-mining-claims/src/mock.rs
<#303 (comment)>
:
> TokenWrapper: pallet_token_wrapper::{Pallet, Call, Storage, Event<T>},
KeyStorage: pallet_key_storage::{Pallet, Call, Storage, Event<T>, Config<T>},
- AnonymityMiningClaims: pallet_anonymity_mining_claims::{Pallet, Call, Storage, Event<T>, Config<T>}
+ AnonymityMiningClaims: pallet_anonymity_mining_claims::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>}
Can a non-instanceable pallet take in an instanceable pallet in its Config
trait. Because we take in a VAnchor type that represents the APVAnchor
and pallet_vanchor is instanceable?
—
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADELLF3ZG46NGUDJS3J5TGTW3SLXFANCNFSM6AAAAAAVW3E6TM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
6372e4c
to
23cae3c
Compare
@drewstone I'm in favor of merging this. There was a bit trouble getting the benchmarks done, but at least the claims pallet verifier is working. I want @semaraugusto to move onto some other tasks. WDYT? |
Sounds fine to me. Please make tasks to track benchmarking separately so we can add to future sprints. @saiakilesh. |
Will do |
Summary of changes
Changes introduced in this pull request:
Updates anonimity-mining-claims pallet.
Reference issue to close (if applicable)
Closes #299