Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Record inner instruction stack height #28430

Merged

Conversation

jstarry
Copy link
Contributor

@jstarry jstarry commented Oct 17, 2022

Problem

The inner instruction stack height isn't recorded after transaction processing so clients can't determine if an inner instruction was invoked by another inner instruction.

Summary of Changes

Builds on #28427

  • Record stack_height in a new InnerInstruction protobuf message type for each inner instruction
  • Add a new stack_height field to instruction data types returned by the RPC API

Related to #27736

@jstarry jstarry added the v1.14 label Oct 17, 2022
@jstarry jstarry force-pushed the feat/inner-instruction-stack-height branch from 546b579 to 476b0f0 Compare October 17, 2022 17:58
@jstarry jstarry removed the v1.14 label Oct 17, 2022
@jstarry jstarry requested a review from Lichtso October 17, 2022 17:59
@Lichtso
Copy link
Contributor

Lichtso commented Oct 17, 2022

We can't change CompiledInstruction and thus have to add a wrapper InnerInstruction, or what is it for?

@jstarry jstarry force-pushed the feat/inner-instruction-stack-height branch from 476b0f0 to 08616e8 Compare October 18, 2022 08:37
@jstarry
Copy link
Contributor Author

jstarry commented Oct 18, 2022

We can't change CompiledInstruction and thus have to add a wrapper InnerInstruction, or what is it for?

Yes, exactly. Can't change CompiledInstruction in the sdk since it's used for transaction serialization. InnerInstruction is just a wrapper type.. it doesn't have to be specific to inner instructions but it's not necessary to record the stack height for transaction level instructions.

// Invocation stack height of an inner instruction.
// Available since Solana v1.14.6
// Set to `None` for txs executed on earlier versions.
optional uint32 stack_height = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

uint32 is that really necessary, the runtime itself only used 8 bits for the stack height.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Smallest size in protobuf is u32

@jstarry jstarry force-pushed the feat/inner-instruction-stack-height branch from 80f9937 to d043a95 Compare October 24, 2022 02:22
Lichtso
Lichtso previously approved these changes Oct 24, 2022
@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Oct 24, 2022
@mergify mergify bot removed the automerge Merge this Pull Request automatically once CI passes label Oct 24, 2022
@mergify
Copy link
Contributor

mergify bot commented Oct 24, 2022

automerge label removed due to a CI failure

@jstarry jstarry force-pushed the feat/inner-instruction-stack-height branch from d043a95 to a64e016 Compare October 25, 2022 04:04
@mergify mergify bot dismissed Lichtso’s stale review October 25, 2022 04:04

Pull request has been modified.

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Oct 25, 2022
@mergify mergify bot removed the automerge Merge this Pull Request automatically once CI passes label Oct 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Oct 25, 2022

automerge label removed due to a CI failure

@jstarry jstarry force-pushed the feat/inner-instruction-stack-height branch from a64e016 to e2a9e43 Compare October 25, 2022 15:43
@jstarry jstarry merged commit 2d8665d into solana-labs:master Oct 26, 2022
@austbot
Copy link

austbot commented Nov 7, 2022

@jstarry thank you for this !

@jstarry jstarry deleted the feat/inner-instruction-stack-height branch November 9, 2022 04:25
gnapoli23 pushed a commit to gnapoli23/solana that referenced this pull request Dec 16, 2022
* Record inner instruction stack height

* fix sbf tests

* feedback
steveluscher added a commit to solana-labs/solana-web3.js that referenced this pull request Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants