Skip to content

Merkle airdrop pallet#10

Merged
illuzen merged 33 commits intomainfrom
vrom911/merkle-airdrop
May 20, 2025
Merged

Merkle airdrop pallet#10
illuzen merged 33 commits intomainfrom
vrom911/merkle-airdrop

Conversation

@vrom911
Copy link
Copy Markdown
Contributor

@vrom911 vrom911 commented May 13, 2025

Implementation of the merkle-airdrop pallet.

It is tested with the merkle-airdrop-cli tool here: https://github.com/Quantus-Network/resonance-api-client/blob/master/examples/async/examples/merkle-airdrop-README.md

I tested different scenarios, it seems to work for me 🤞🏼

@vrom911 vrom911 self-assigned this May 13, 2025
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The currency mechanism.
type Currency: Currency<Self::AccountId>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this trait is also deprecated. you should use Mutate and Inspect instead.

@vrom911 vrom911 requested a review from illuzen May 13, 2025 20:36
@vrom911 vrom911 requested a review from dastansam May 13, 2025 20:36
Copy link
Copy Markdown
Contributor

@dastansam dastansam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks better. main concerns are need for ValidateUnsigned and airdrop already exists checks

@@ -0,0 +1,685 @@
#![cfg(test)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a rule of thumb, we should try to cover all the Error variants in the unit tests. For example, there is no case for AirdropAlreadyExists here

merkle_root
));

// Check initial balance - it might be Some(0) instead of None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe what you're looking for is ValueQuery? so that we don't have a case where it could be Some(0)

@@ -0,0 +1,73 @@
//! weights for pallet_merkle_airdrop
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you generate this or is it manually written? it seems like the latter

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regenerated now, needed fixes in the benchmarking file.
I was not aware that it should be regenerated, I did now.
Based on the tutorial, I used the template, but I don't know if I should leave it in?

@illuzen
Copy link
Copy Markdown
Contributor

illuzen commented May 16, 2025

I guess this is ready, except for swapping Currency for Fungible?

@dastansam
Copy link
Copy Markdown
Contributor

I guess this is ready, except for swapping Currency for Fungible?

it was already swapped. there are some minor nits and clarifications left

@vrom911
Copy link
Copy Markdown
Contributor Author

vrom911 commented May 16, 2025

@illuzen @dastansam , I believe all the comments are applied now. The only thing I am not sure about is the weights template and if it looks legit 🙏🏼

@vrom911 vrom911 force-pushed the vrom911/merkle-airdrop branch from d0b7b4b to baf9fec Compare May 16, 2025 13:09
@vrom911 vrom911 force-pushed the vrom911/merkle-airdrop branch from 80bd410 to 7c8e8d4 Compare May 16, 2025 13:20
@vrom911 vrom911 requested a review from dastansam May 19, 2025 06:39
Copy link
Copy Markdown
Contributor

@dastansam dastansam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, gj!

@czareko czareko self-requested a review May 20, 2025 02:29
@illuzen illuzen merged commit e4c2fe3 into main May 20, 2025
2 checks passed
@vrom911 vrom911 deleted the vrom911/merkle-airdrop branch May 20, 2025 09:23
dastansam pushed a commit that referenced this pull request Jun 4, 2025
chore: Only more logs - no changes

chore: Less logs

fix: O3 solution

fix: Finalization triggered often

make difficulty actually difficulty

removed unused code, added chain_height to prometheus

add difficulty back

improved logging, clamped difficulty adjustments, raised max_distance, fixed pct calculation, changed block history to 10 and adjustment period to 1

fix: Spec JSON + QUAN token

fixed difficulty reporting to prometheuss

changed license to MIT

fixed 3 tests

cleaned up logs

Update external-miner/src/lib.rs

Co-authored-by: Copilot <[email protected]>

fixed external miner

chore: ChainSpec refresh + rename to Quantus

chore: Resonance as our testnet name

ci: github workflow build, test

rename node

chore: CLI: Resonance Key -> Quantus Key (#13)

Use clippy (#11)

* Apply clippy autofix

* Fix comparison_chain & doc_lazy_continuation

* Fix more warnings

Update README.md

Update README.md

Automated release workflow (#16)

* added create release workflow

* shell script added

* rename

* remove caching

Merkle airdrop pallet (#10)

* Implement initial structure of merkle-airdrop

* Improve structure, add all template modules

* Implement create_airdrop and fix tests and mock

* Implement verify merkle proof, add tests

* Use binary_merkle_tree instead of custom function

* Implement fund function with tests

* implement claim function

* Clean up

* Use poseidon hasher in verify fn

* Try to create merkle root for testing

* Add doc for testing

* Remove rust-toolchain.toml from git tracking

* Remove js script

* Make claim recipient be anyone

* Revert the signer-receiver change, add test fns

* changed hash fn to blake2

* Apply fmt

* Fix tests

* Add validate_unsigned

* Fix link to merkle-airdrop-cli

* Address review comments

* Remove MaxAirdrops

* Add UnsignedClaimPriority in the config

* Add delete airdrop functionality

* Replace deprecated Currency

* Only allow airdrop creators to delete it

* Allow creators to claim remain balance when delete

* Clean up docs

* Remove unsignedValidation, add tests

* Remove unnecessary error

* Generate weights from the nenchmarking

* Use the existing weights template

* Use unsigned acc for claims

---------

Co-authored-by: illuzen <[email protected]>

feat: Tech Collective for Runtime Upgrades (#12)

* feat: Membership configuration

* feat: Founders in genesis config

* feat: First community test

* feat: TxExtension - only members can vote for track 0

* feat: Track 0 for members only without token support validation

* feat: Proposals for track 0 limited to tech collective members

* fix: TxExt rename in node

* feat: Genesis presets - tech collective members

* chore: Tracks params update

* feat: Separate referenda with submit limited

* feat: Separate tracks - ready for test fix

* feat: Membership removed

* feat: First test for TechCollective

* feat: Tests for new collective ready

* feat: All tests fixed and cleaned

* clean: TxExtension

* fix: Review comments + formatting

* chore: MaxRankOfClass - additional comments

Add windows build to release process (#17)

windows takes 30 minutes to release...

remove special case for 0.0.0 - just use it (#18)

Bump poseidon-resonance to 0.4.0 (#20)

* Bump poseidon-resonance to 0.4.0

* Update to 0.5.0

chore: Chain-spec JSON - refreshed (#24)

feat: vest airdrop rewards (#22)

* Replace vesting pallet

* Vest airdrops

* Update runtime

* Resolve comments

* Add insufficient balance check

move rusty-crystals to github (#26)

* move rusty-crystals to github

* poseidon-resonance 0.5.0

CLI Updates  (#27)

* move rusty-crystals to github

* CLI updates

* moved test data to file

* remove redundant comments

* poseidon-resonance 0.5.0

* merge from main

* Update readme for new CLI commands

Replace scheduler in reversible transfers

Make benchmarks compile (#29)

feat: explicit reverser for reversible accounts (#8)

* Add explicit reverser for reversible transfers

* Make reverser get reserved funds, update benchmarks

* Add more tests

updated storage hasher for transfer proofs (#25)

* updated storage hasher for transfer proofs

* minor cleanup

* fixed some tests

* tests compile now

* Pass AccountId for storage hashing (#30)

* tests fixed

---------

Co-authored-by: illuzen <[email protected]>
Co-authored-by: Dastan <[email protected]>

cargo fmt (#31)

applied cargo fmt to codebase

Update ci.yml (#32)

add cargo fmt check

don't cache on linux (#33)

prevents out of disk space errors

Compiling node

Make legacy tests work

Fix compile errors

Run fmt

Mostly passing tests
@n13 n13 mentioned this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants