Include the canonical bump in the order PDA - #90
Conversation
f5de5fc to
87493fb
Compare
87493fb to
bd2e69d
Compare
bd2e69d to
e1f31a5
Compare
Wire `send_transaction_metered` into one representative happy-path test per instruction under measurement, so the before/after CU numbers for this branch come out of the existing tests rather than a bespoke harness. `BeginSettle` only ever ships paired with a `FinalizeSettle`, so its figure is the settlement program's own cost across the whole transaction (SPL-token CPI excluded); `send_metered` wraps `send` to record it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
e1f31a5 to
0ade7a0
Compare
…s-to-account-data-when-possible
…s-to-account-data-when-possible
There was a problem hiding this comment.
The design looks good, I think it's close to merging.
Some notes on the scope (the current one is ok, this is future code):
Buffer accounts are actual token account PDAs, so we can't control the storage inside of them/add a bump. We can add another PR to always rederive the PDA instead if we still want to remove the PDA as a parameter.
We can test this, but I expect this to be overall more expensive (and non-deterministically so), so I fear we're going to keep it.
the single state pda is currently rederived every time it is loaded rather than accepting as an input. Considering that this change would look/shape much differently from the Order PDA changes, it should be included in a separate PR
Completely agree. The security angle is a bit trickier there imho.
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
…f github.com:cowprotocol/solana-programs into kaze/sc-257-move-bumps-to-account-data-when-possible
Description
Include the order's own canonical bump in the order PDA. This allows for the
bumpparameter to be removed fromReclaimOrderandBeginSettle.Motivation
BeginSettle's input, the most complicated instruction in the program at this timeCU impact
Measured with the CU benchmarking helper added on this branch, which reads the settlement program's own compute cost out of the transaction log trace (CPI to SPL Token excluded) and writes it to
target/cu-report.json. Baseline is 03545e4, the commit directly before the functional change, so the only difference is the bump move — the test addresses and the benchmark helper are already pinned in both.create_orderreclaim_orderThe settle rows are the whole
[BeginSettle, FinalizeSettle]transaction, becauseBeginSettleis never submitted alone;FinalizeSettleis untouched by this PR, so the delta isBeginSettle's.Reproduce with:
Out of Scope
The original ticket said to move all storage, but it seems it is most valuable to include only for the order pda at this time. This is because for the other two current PDA types:
How to test
This is mostly refactoring, so most of the tests should work the same as before the change. Confirm the overall methodology