Skip to content

Draft: full diff only#10

Closed
zeapoz wants to merge 36 commits intoupstream-mainfrom
main
Closed

Draft: full diff only#10
zeapoz wants to merge 36 commits intoupstream-mainfrom
main

Conversation

@zeapoz
Copy link
Copy Markdown
Collaborator

@zeapoz zeapoz commented Mar 17, 2026

No description provided.

zeapoz added 29 commits March 3, 2026 13:53
feat: initialize airdrop storage
feat: implement sapling verifier
feat: implement orchard verifier
feat: implement signature verification
chore: bump default event wait time
Comment thread crates/tx_prelude/src/airdrop.rs Outdated
&Address::Internal(InternalAddress::Airdrop),
token_addr,
&message.target,
Amount::from_u64(message.amount * ZAIR_SCALING_FACTOR),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This may wrap, consider using checked_mul or saturating_mul, or at least comment on why this is always safe.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changed to use Amount::from_u128 instead and casting amount before scaling.

@@ -0,0 +1,126 @@
//! Sapling VP related functions.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this file is almost identical to orchard.rs. Is it not possible to de-dup this (trait or generic helper)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is something I would like to do eventually too, but it's not very easy to do in the current state with ZAIR. Postponing this for now.

}

/// Sapling configuration storage keys.
pub mod sapling {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The sapling and orchard modules are nearly identical. Can this not be de-duplicated?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keeping the module prefixes, but added helper function to generate airdrop keys.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

wow, i see airdrop lol..

Comment thread crates/airdrop/src/storage_key.rs Outdated

/// Gets a key for the Sapling verifying key storage.
pub fn verifying_key() -> storage::Key {
storage::Key::from(ADDRESS.to_db_key())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

extract this duplicated code into a helper function.

Comment thread crates/airdrop/src/vp/sapling.rs Outdated
{
// Read verifying key from storage.
let vk_bytes: Vec<u8> = ctx
.read_bytes_post(&sapling_key::verifying_key())?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

claude says all these should be read_bytes_pre, I can't verify this claim though. @mikdk

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, good catch. It definitely used to be read_bytes_pre, wonder when that happened 😄

Comment thread crates/airdrop/src/vp/mod.rs Outdated
claim_data,
}) = action
{
if !verifiers.contains(&target) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

&target -> target

Comment thread crates/airdrop/src/vp/mod.rs Outdated
// Check if airdrop nullifiers have already been used.
check_airdrop_nullifiers(
ctx,
&claim_data,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

&claim_data -> claim_data

Comment thread crates/airdrop/src/storage_key.rs Outdated

/// Sapling configuration storage keys.
pub mod sapling {
use super::*;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clippy doesn't like this.

Comment thread crates/airdrop/src/storage_key.rs Outdated

/// Orchard configuration storage keys.
pub mod orchard {
use super::*;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clippy doesn't like this.

CTX: VpEnv<'ctx> + namada_tx::action::Read<Err = Error>,
{
/// Run the validity predicate
pub fn validate_tx(
Copy link
Copy Markdown

@joske joske Mar 17, 2026

Choose a reason for hiding this comment

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

Clippy wants a # Errors doc section he+e.

@zeapoz zeapoz closed this Mar 17, 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.

3 participants