Skip to content
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

Can't execute BPF without loading it first #8971

Closed
garious opened this issue Mar 19, 2020 · 3 comments
Closed

Can't execute BPF without loading it first #8971

garious opened this issue Mar 19, 2020 · 3 comments
Labels
stale [bot only] Added to stale content; results in auto-close after a week.
Milestone

Comments

@garious
Copy link
Contributor

garious commented Mar 19, 2020

Problem

Can't inject simple BPF into transactions. For simple assertions, the compiled code should be well under 1500 bytes. I'd like to write something like this:

let ix0 = Instruction {
    program_id: BPF_LOADER,
    accounts: [1],
    data: to_bpf!(|keyed_accounts| assert!(keyed_accounts[0].lamports == 0))
};
let ix1 = SystemInstruction::transfer(...);
let message = Message::new(&[ix0, ix1]);
client.send_message(&message);

Proposed Solution

Add an instruction to the BPF_LOADER that executes the bytecode in the instruction data.

cc: @jackcmay

@garious garious added this to the The Future! milestone Mar 19, 2020
@jackcmay
Copy link
Contributor

@garious This is possible and will probably come with exceptions, like not being able to call helper functions (traps)

@stale
Copy link

stale bot commented Mar 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Mar 20, 2021
@stale
Copy link

stale bot commented Apr 20, 2021

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Apr 20, 2021
This was referenced Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale [bot only] Added to stale content; results in auto-close after a week.
Projects
None yet
Development

No branches or pull requests

2 participants