Skip to content

add optional prepend to preInstructions method builder#2863

Merged
acheroncrypto merged 2 commits into
otter-sec:masterfrom
mithraiclabs:prepend-preinstructions
Mar 24, 2024
Merged

add optional prepend to preInstructions method builder#2863
acheroncrypto merged 2 commits into
otter-sec:masterfrom
mithraiclabs:prepend-preinstructions

Conversation

@Taylor123

Copy link
Copy Markdown
Contributor

With the recent need to calculate compute units by simulating the Transaction it's become desirable to prepend instructions to the preInstructions. Specifically instructions like ComputeBudgetProgram.setComputeUnitPrice and ComputeBudgetProgram.setComputeUnitLimit should be prepended to the preInstructions array after simulating the transaction.

@vercel

vercel Bot commented Mar 21, 2024

Copy link
Copy Markdown

@Taylor123 is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto 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.

Thanks!

With the recent need to calculate compute units by simulating the Transaction it's become desirable to prepend instructions to the preInstructions.

I don't think it would hurt to merge this, but can't we achieve this with tx.instructions.unshift()?

@Taylor123

Copy link
Copy Markdown
Contributor Author

if you're using the MethodBuilder rpc method to send the TX, then mutating the tx from the transaction() method wouldn't work, right?

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Sort of — it would require a bit more setup compared to what we can do with this PR.

Before we merge this, could you also note this change in the CHANGELOG?

@Taylor123

Copy link
Copy Markdown
Contributor Author

@acheroncrypto added

@acheroncrypto acheroncrypto 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.

Thank you!

@acheroncrypto acheroncrypto merged commit 4393d73 into otter-sec:master Mar 24, 2024
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants