On a blockchain with priority ordering, developers can enforce sequencing rules via Application Controlled Scheduling (ACS) and internalize MEV. The underlying principle and mechanisms are detailed here: ACS and MEV Internalization
This repo hosts a program written with the Pinocchio framework that demonstrates how to implement ACS and MEV Internalization in SVM programs. It is written in the Blueshift Pinocchio 101 pattern (even when inconvineient) to maximize familiarity for developers.
The CU cost is (relatively) extremely cheap:
- For ACS it costs < 180 CUs.
- For MEV Internalization, it costs between 300 and 400 CUs.
For more details, refer to the blog post linked above.
To run the tests, you need a full Solana validator environment or at least the
instructions sysvar and system program. For that reason, the tests are designed
for the solana-test-validator
environment that comes bundled with the Solana
CLI.
Thus the Solana CLI is a pre-requisite to reproduce the results.
To reproduce the tests:
- Start the test validator with:
solana-test-validator
Note that this will store the ledger in the current directory.
- Change into the demo directory
cd demo
- Deploy the prebuilt program to the test validator with:
solana program deploy ./mev_internalization_and_acs.so --program-id keypair.json -u http://localhost:8899
You can also rebuild the program from source with cargo build-sbf
and deploy the
new binary.
- Run the tests with:
cargo test
The results can be viewed on the Solana Explorer pointing to local host as the cluster URL. Note that the test validator must be running to view the results.
- Terminate the test validator process