Skip to content

Conversation

@Stevengre
Copy link
Contributor

No description provided.

@Stevengre Stevengre changed the title feat: add SPL-specific cheat code module feat(spl): provide spl's account domain model Nov 7, 2025
@Stevengre Stevengre self-assigned this Nov 7, 2025
@Stevengre Stevengre force-pushed the jh/spl-cheatcodes branch 2 times, most recently from deeb8e9 to 11d13ed Compare November 11, 2025 15:01
@Stevengre Stevengre changed the title feat(spl): provide spl's account domain model feat(spl): cheatcodes that model spl's account domain data Nov 13, 2025
@Stevengre Stevengre marked this pull request as ready for review November 13, 2025 04:33
@Stevengre Stevengre marked this pull request as draft November 13, 2025 04:42
@Stevengre Stevengre marked this pull request as ready for review November 13, 2025 04:48
Copy link
Member

Choose a reason for hiding this comment

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

I am struggling a bit to follow the code in the module. What are the typical calls in the SPL source code to access the data inside the RefCell ? Maybe you could add some extra information between the code section?
The info.md does not really provide that information, and it is required to understand why we are capturing these function calls.

Comment on lines +105 to +111
SPLRefCell(
place(
LOCAL,
appendP(PROJS, projectionElemDeref projectionElemField(fieldIdx(1), #hack()) .ProjectionElems)
),
Integer(?SplLamports:Int, 64, false)
)
Copy link
Member

Choose a reason for hiding this comment

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

What is the first parameter of SPLRefCell modeling?
This value here looks like a self-reference: #setLocalValue above writes to place(LOCAL, PROJS + Deref) the value which contains a place(LOCAL, PROJS + Deref + Field(1)).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is used to reference itself for pack to write back.

Comment on lines 167 to 168
<k> #execTerminator(terminator(terminatorKindCall(FUNC, OP:Operand OPS:Operands, DEST, TARGET, UNWIND), _SPAN))
=> #finishSPLRcDeref(OP, DEST, TARGET, FUNC, OP OPS, UNWIND)
Copy link
Member

Choose a reason for hiding this comment

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

Do we expect OPS to be present if the function is ...::deref ? Probably deref will only ever have one argument, or not?

Comment on lines +328 to +330
rule [spl-vec-as-slice-copy]:
<k> #execTerminator(terminator(terminatorKindCall(FUNC, OP:Operand _OPS:Operands, DEST, someBasicBlockIdx(TARGET), _UNWIND), _SPAN))
=> #setLocalValue(DEST, OP) ~> #execBlockIdx(TARGET)
Copy link
Member

Choose a reason for hiding this comment

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

Similar situation here, _OPS is unused and should always just be .Operands if the function is _.as_slice()

@Stevengre Stevengre requested a review from JuanCoRo November 13, 2025 11:36
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.

3 participants