Skip to content

feat!: authorized balance decrease/permissionless claims/pinata removal (WARNING! UNSAFE!) - #817

Merged
agureev merged 32 commits into
devfrom
artem/namespace-prep
Sep 4, 2026
Merged

feat!: authorized balance decrease/permissionless claims/pinata removal (WARNING! UNSAFE!)#817
agureev merged 32 commits into
devfrom
artem/namespace-prep

Conversation

@agureev

@agureev agureev commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🎯 Purpose

This PR serves unites three large-scale issues:

  1. Remove pinata logic
  2. Introduce a protocol-wide check only allowing authorized accounts to decrease balance
  3. Remove Claim instructions, making any program that changes its data its owner (if default initially)

The PR also changes up the testnet documentation to reflect how the flow now works. However, it is currently in the 0.1 folder. Let me know if that needs changing.

WARNING!

This PR is not safe. It has an inherent rent condition where any default-owned program ID can be claimed by a malicious program. Depending on the circumstance, it can squat and permanently deny the address, freezing any balance already sitting there.

This was agreed-to as an RC-level PR that would allow namespaced account state.

⚙️ Approach

In 1e7aa1f:

  • Delete the pinata programs
  • Change the funding documentation to use native transfer programs

In c3a366c:

  • Make balance decreases athorization-gated
  • Remove the pinata-based clock program in favor of a native one

In 2811d06:

  • Remove all initialization instructions for programs

In 7d11e7b

  • Make any default-owned program be claimed by any program modifying its data

In 3f3d4a0:

  • Make a tool pinning auth transfer's ID to use in bridge and stake

In 4e2ecb1:

  • Lock debit now chains to auth-transfer through PDA to allow for balance decrease

In 44ab6b1:

  • Similar for staking

In 74a152a:

  • Remove vaults
  • Make accounts directly funded

Rest of the commits are stylistic

🔜 Future Work

Namespaced account state.

📋 PR Completion Checklist

  • Complete PR description
  • Implement the core functionality
  • Add/update tests
  • Add/update documentation and inline comments

@Arjentix Arjentix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Did a very high-level review, but have some comments for now

Comment thread lez/programs/authenticated_transfer/image_id.rs Outdated
Comment thread Justfile Outdated
Comment thread test_fixtures/src/config.rs Outdated
Comment thread test_fixtures/src/config.rs
Comment thread integration_tests/tests/bridge.rs
Comment thread lez/programs/faucet/core/src/lib.rs Outdated
Comment thread lez/programs/faucet/core/src/lib.rs
Comment thread lez/sequencer/core/src/tests/reconstruction.rs
@agureev
agureev force-pushed the artem/namespace-prep branch from 62fee87 to 1a83413 Compare September 2, 2026 12:20
@agureev
agureev marked this pull request as ready for review September 2, 2026 19:23

@moudyellaz moudyellaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, thanks. Left minor comments!

The WARNING says a squatter can "steal whatever balance was initially there", but a_squatter_acquires_a_funded_account_but_still_cannot_spend_it pins the opposite: a debit needs is_authorized, which a squatter cannot forge, so the outcome is a freeze rather than theft. Could you reword to "squat and permanently deny the address, freezing any balance already sitting there"?

Comment thread lez/sequencer/core/src/lib.rs
Comment thread lez/wallet-ffi/wallet_ffi.h
@agureev agureev added the priority:high High priority label Sep 3, 2026

@Arjentix Arjentix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks

Comment thread lez/indexer/core/Cargo.toml
Comment thread lez/programs/authenticated_transfer/image_id.rs Outdated
Comment thread lez/programs/authenticated_transfer/core/build.rs
Comment thread lee/state_machine/core/src/program/mod.rs Outdated
Comment thread lee/state_machine/src/state/tests/implicit_claiming.rs

@schouhy schouhy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm thanks!

# Conflicts:
#	Cargo.toml
#	Justfile
#	artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin
#	artifacts/lez/programs/amm.bin
#	artifacts/lez/programs/associated_token_account.bin
#	artifacts/lez/programs/authenticated_transfer.bin
#	artifacts/lez/programs/bridge.bin
#	artifacts/lez/programs/bridge_lock.bin
#	artifacts/lez/programs/clock.bin
#	artifacts/lez/programs/cross_zone_inbox.bin
#	artifacts/lez/programs/cross_zone_outbox.bin
#	artifacts/lez/programs/faucet.bin
#	artifacts/lez/programs/pinata.bin
#	artifacts/lez/programs/pinata_token.bin
#	artifacts/lez/programs/ping_receiver.bin
#	artifacts/lez/programs/ping_sender.bin
#	artifacts/lez/programs/sequencer_stake.bin
#	artifacts/lez/programs/token.bin
#	artifacts/lez/programs/vault.bin
#	artifacts/lez/programs/wrapped_token.bin
#	integration_tests/tests/auth_transfer/public.rs
#	integration_tests/tests/keys.rs
#	integration_tests/tests/program_deployment.rs
#	integration_tests/tests/tps.rs
#	integration_tests/tests/vault.rs
#	integration_tests/tests/wallet_ffi.rs
#	lee/privacy_preserving_circuit/src/execution_state.rs
#	lee/state_machine/core/src/program/mod.rs
#	lee/state_machine/src/state/tests/chained_calls.rs
#	lee/state_machine/src/validated_state_diff/mod.rs
#	lee/state_machine/test_methods/guest/src/bin/malicious_authorization_changer.rs
#	lee/state_machine/test_methods/guest/src/bin/malicious_injector.rs
#	lee/state_machine/test_methods/guest/src/bin/non_delegating_forwarder.rs
#	lee/state_machine/test_methods/guest/src/bin/private_pda_delegator.rs
#	lee/state_machine/test_methods/guest/src/bin/selective_pda_delegator.rs
#	lee/state_machine/test_methods/guest/src/bin/simple_transfer_proxy.rs
#	lez/indexer/core/src/block_store.rs
#	lez/programs/Cargo.toml
#	lez/programs/associated_token_account/src/create.rs
#	lez/programs/bridge/src/main.rs
#	lez/programs/faucet/src/main.rs
#	lez/programs/pinata_token/src/main.rs
#	lez/programs/sequencer_stake/src/main.rs
#	lez/programs/src/lib.rs
#	lez/programs/vault/src/main.rs
#	lez/sequencer/core/src/lib.rs
#	test_fixtures/fixtures/prebuilt_sequencer_db.dump
#	test_programs/guest/src/bin/authority_proxy.rs
#	test_programs/guest/src/bin/faucet_chain_caller.rs
# Conflicts:
#	artifacts/lez/programs/pinata.bin
#	artifacts/lez/programs/pinata_token.bin
#	artifacts/lez/programs/vault.bin
#	examples/program_deployment/methods/guest/src/bin/hello_world.rs
#	examples/program_deployment/methods/guest/src/bin/hello_world_with_authorization.rs
#	examples/program_deployment/methods/guest/src/bin/hello_world_with_move_function.rs
#	examples/program_deployment/methods/guest/src/bin/simple_tail_call.rs
#	examples/program_deployment/methods/guest/src/bin/tail_call_with_pda.rs
#	lee/privacy_preserving_circuit/src/execution_state.rs
#	lee/state_machine/core/src/program/mod.rs
#	lee/state_machine/core/src/program/tests.rs
#	lee/state_machine/src/lib.rs
#	lee/state_machine/src/privacy_preserving_transaction/circuit/mod.rs
#	lee/state_machine/src/program/tests.rs
#	lee/state_machine/src/state/tests/circuit.rs
#	lee/state_machine/src/state/tests/claiming.rs
#	lee/state_machine/src/state/tests/mod.rs
#	lee/state_machine/src/state/tests/privacy_preserving.rs
#	lee/state_machine/src/validated_state_diff/mod.rs
#	lee/state_machine/test_methods/guest/src/bin/asserts_specific_account_authorized.rs
#	lee/state_machine/test_methods/guest/src/bin/auth_asserting_noop.rs
#	lee/state_machine/test_methods/guest/src/bin/burner.rs
#	lee/state_machine/test_methods/guest/src/bin/chain_caller.rs
#	lee/state_machine/test_methods/guest/src/bin/changer_claimer.rs
#	lee/state_machine/test_methods/guest/src/bin/data_changer.rs
#	lee/state_machine/test_methods/guest/src/bin/dropped_account.rs
#	lee/state_machine/test_methods/guest/src/bin/event_emitter.rs
#	lee/state_machine/test_methods/guest/src/bin/extra_output.rs
#	lee/state_machine/test_methods/guest/src/bin/flash_swap_callback.rs
#	lee/state_machine/test_methods/guest/src/bin/flash_swap_initiator.rs
#	lee/state_machine/test_methods/guest/src/bin/initialize_then_fund.rs
#	lee/state_machine/test_methods/guest/src/bin/injects_undeclared_pre_state.rs
#	lee/state_machine/test_methods/guest/src/bin/malicious_caller_program_id.rs
#	lee/state_machine/test_methods/guest/src/bin/malicious_self_program_id.rs
#	lee/state_machine/test_methods/guest/src/bin/minter.rs
#	lee/state_machine/test_methods/guest/src/bin/missing_output.rs
#	lee/state_machine/test_methods/guest/src/bin/modified_transfer.rs
#	lee/state_machine/test_methods/guest/src/bin/non_delegating_forwarder.rs
#	lee/state_machine/test_methods/guest/src/bin/nonce_changer.rs
#	lee/state_machine/test_methods/guest/src/bin/noop.rs
#	lee/state_machine/test_methods/guest/src/bin/pda_claimer.rs
#	lee/state_machine/test_methods/guest/src/bin/pda_spend_proxy.rs
#	lee/state_machine/test_methods/guest/src/bin/private_pda_delegator.rs
#	lee/state_machine/test_methods/guest/src/bin/program_owner_changer.rs
#	lee/state_machine/test_methods/guest/src/bin/references_undeclared_account.rs
#	lee/state_machine/test_methods/guest/src/bin/selective_pda_delegator.rs
#	lee/state_machine/test_methods/guest/src/bin/simple_balance_transfer.rs
#	lee/state_machine/test_methods/guest/src/bin/simple_transfer_proxy.rs
#	lee/state_machine/test_methods/guest/src/bin/two_pda_claimer.rs
#	lee/state_machine/test_methods/guest/src/bin/validity_window.rs
#	lee/state_machine/test_methods/guest/src/bin/validity_window_chain_caller.rs
#	lez/programs/amm/src/add.rs
#	lez/programs/amm/src/new_definition.rs
#	lez/programs/amm/src/remove.rs
#	lez/programs/amm/src/swap.rs
#	lez/programs/amm/src/tests.rs
#	lez/programs/associated_token_account/src/burn.rs
#	lez/programs/associated_token_account/src/create.rs
#	lez/programs/associated_token_account/src/transfer.rs
#	lez/programs/authenticated_transfer/src/main.rs
#	lez/programs/bridge/src/main.rs
#	lez/programs/bridge_lock/src/main.rs
#	lez/programs/clock/src/main.rs
#	lez/programs/cross_zone_inbox/src/main.rs
#	lez/programs/cross_zone_outbox/src/main.rs
#	lez/programs/faucet/src/main.rs
#	lez/programs/fee/src/main.rs
#	lez/programs/pinata/src/main.rs
#	lez/programs/pinata_token/src/main.rs
#	lez/programs/ping_receiver/src/main.rs
#	lez/programs/ping_sender/src/main.rs
#	lez/programs/sequencer_stake/src/main.rs
#	lez/programs/token/src/burn.rs
#	lez/programs/token/src/initialize.rs
#	lez/programs/token/src/mint.rs
#	lez/programs/token/src/new_definition.rs
#	lez/programs/token/src/print_nft.rs
#	lez/programs/token/src/tests.rs
#	lez/programs/token/src/transfer.rs
#	lez/programs/vault/src/main.rs
#	lez/programs/wrapped_token/src/main.rs
#	test_programs/guest/src/bin/authority_proxy.rs
#	test_programs/guest/src/bin/chain_caller.rs
#	test_programs/guest/src/bin/claimer.rs
#	test_programs/guest/src/bin/clock_chain_caller.rs
#	test_programs/guest/src/bin/data_writer.rs
#	test_programs/guest/src/bin/faucet_chain_caller.rs
#	test_programs/guest/src/bin/pda_spend_proxy.rs
#	test_programs/guest/src/bin/pinata_cooldown.rs
#	test_programs/guest/src/bin/simple_balance_transfer.rs
#	test_programs/guest/src/bin/time_locked_transfer.rs
# Conflicts:
#	integration_tests/tests/wallet_ffi.rs
#	lez/wallet-ffi/src/transfer.rs
#	lez/wallet-ffi/wallet_ffi.h
@agureev
agureev merged commit 41378d7 into dev Sep 4, 2026
46 of 47 checks passed
@agureev agureev mentioned this pull request Sep 8, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:high High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants