Skip to content

feat: Cleaner gasless implementation #360

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

Merged
merged 17 commits into from
Jun 23, 2025
Merged

feat: Cleaner gasless implementation #360

merged 17 commits into from
Jun 23, 2025

Conversation

GabrielePicco
Copy link
Contributor

@GabrielePicco GabrielePicco commented May 9, 2025

Summary

This PR simplifies the gasless setup by removing the automatic airdrop and introducing a native way to execute transactions without charging the payer.

  • https://github.com/magicblock-labs/magicblock-svm
  • Changed the solana-svm dependency to use a patched version that allows signers without lamports
  • Added a test case in transaction_execute.rs to verify transactions with non-existent fee payers and zero fees
  • Simplified and modified genesis to set lamports per signature from the config (base fees)
  • Set the default lamports per signature to 0

Notes

  • A follow-up PR will completely remove the initial payer SOL/lamports configuration and logic
  • A follow-up PR will address rent

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@bmuddha bmuddha left a comment

Choose a reason for hiding this comment

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

Looks quite neat, too neat to be true even, wonder why we haven't considered this approach before.

@@ -150,7 +150,7 @@ solana-rpc = "2.2"
solana-rpc-client = { version = "2.2" }
solana-rpc-client-api = { version = "2.2" }
solana-sdk = { version = "2.2" }
solana-svm = { version = "2.2", features = [ "dev-context-only-utils" ] }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", rev = "e93eb57", features = [ "dev-context-only-utils" ] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to see the introduced changes to the SVM as well.

Copy link
Contributor Author

@GabrielePicco GabrielePicco May 13, 2025

Choose a reason for hiding this comment

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

<!-- greptile_comment -->

## Greptile Summary

Removed free airdrop functionality and payer configurations across the
MagicBlock validator, transitioning towards a gasless transaction model.

- Removed `payer_init_lamports` field and related configurations from
`configs/ephem-devnet.toml` and `configs/ephem-testnet.toml`,
eliminating automatic account funding
- Simplified fee payer account cloning in
`magicblock-account-cloner/src/remote_account_cloner_worker.rs` by using
standard `do_clone_undelegated_account` method for non-charging
validators
- Removed `Payer` struct and related functionality from
`magicblock-config/src/accounts.rs`, including configuration validation
and environment variable handling
- Modified account initialization logic in
`magicblock-api/src/magic_validator.rs` to support gasless transactions
while maintaining validator identity and faucet account funding



<!-- /greptile_comment -->
@GabrielePicco GabrielePicco merged commit 84fd7b8 into master Jun 23, 2025
4 checks passed
@GabrielePicco GabrielePicco deleted the feat/gasless branch June 23, 2025 06:42
GabrielePicco added a commit that referenced this pull request Jun 23, 2025
@GabrielePicco GabrielePicco restored the feat/gasless branch June 23, 2025 07:31
GabrielePicco added a commit that referenced this pull request Jun 23, 2025
Reverts #360

<!-- greptile_comment -->

## Greptile Summary

This PR reverts a gasless transaction implementation (#360), restoring
traditional fee handling across the codebase.

- Changed `LAMPORTS_PER_SIGNATURE` from 0 back to 5000 in
`magicblock-bank/src/consts.rs`, re-enabling standard transaction fees
- Restored payer account initialization with 1000 SOL in
`configs/ephem-*.toml` files, requiring SOL for transaction fees again
- Added validation in `magicblock-config/src/errors.rs` to prevent
ambiguous account initialization (lamports vs SOL)
- Reverted from custom magicblock-svm fork back to official solana-svm
v2.2 in `Cargo.toml`
- Modified bank and genesis config setup in
`magicblock-bank/src/genesis_utils.rs` to restore fee-based transaction
processing



<!-- /greptile_comment -->
@GabrielePicco GabrielePicco mentioned this pull request Jun 23, 2025
thlorenz added a commit that referenced this pull request Jun 23, 2025
* master:
  Revert "feat: Cleaner gasless implementation" (#405)
  feat: Cleaner gasless implementation (#360)
GabrielePicco added a commit that referenced this pull request Jun 23, 2025
See #360 

<!-- greptile_comment -->

## Greptile Summary

Major architectural changes to implement native gasless transaction
support by removing automatic airdrops and modifying fee handling across
the validator.

- Modified `magicblock-bank/src/consts.rs` to set
`DEFAULT_LAMPORTS_PER_SIGNATURE` to 0 and integrate with patched
solana-svm for zero-fee transactions
- Removed payer initialization and automatic airdrop functionality from
configs and `magicblock-accounts/src/config.rs`
- Updated genesis configuration in
`magicblock-bank/src/genesis_utils.rs` to support configurable
transaction fees
- Modified `Cargo.toml` to use custom magicblock-labs/magicblock-svm
fork at commit e93eb57
- Added support for executing transactions with non-existent fee payers
in `magicblock-bank/tests/transaction_execute.rs`



<!-- /greptile_comment -->

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
thlorenz added a commit that referenced this pull request Jul 2, 2025
* master:
  release: v0.1.7 (#409)
  Feat: simpler gasless implementation (#406)
  perf: run ensure accounts concurrently
  feat: account hydration on background task (#407)
  Revert "feat: Cleaner gasless implementation" (#405)
  feat: Cleaner gasless implementation (#360)
  fix: cleanup slots on non-fresh ledger (#404)
  release: v0.1.5 (#403)
  fix: properly init geyser plugin for rpc and use valid dummy Library (#402)
  release: v0.1.4 (#401)
  fix: remove grpc plugin altogether from geyser manager (#400)
  Patch tests from failing on subscription due to rate limits (#386)
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.

5 participants