-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(solana)!: enable calling SetConfig without sending the transaction #310
feat(solana)!: enable calling SetConfig without sending the transaction #310
Conversation
🦋 Changeset detectedLatest commit: 0bfcacc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
419ea25
to
3bbdf4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you said, elegant api is the challenge here
d96b908
to
9551439
Compare
var err error | ||
for i, instruction := range c.instructions { | ||
signature, _, err = sendAndConfirmInstructions(ctx, client, auth, | ||
[]solana.Instruction{instruction}, rpc.CommitmentConfirmed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i assumed this wouldn work if we send the whole batch in one go instead of in a loop one at a time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I follow; we're still sending+confirming one instruction at a time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR enables clients to call SetConfig() without sending the instructions to the blockchain. Its purpose is to retrieve the instructions that _would_ be sent -- to, for instance, use this instructions to build an mcms proposal. The instructions are returned in the `TransactionResult` object, in the `RawTransaction` attribute. In order to "activate" this mode, clients must set leave the authority private key as `nil` *and* specify the signer account in the `instructionAuth` parameter. Existing clients (who still want to send the instructions onchain) are also affected as we had to introduce a new parameter to the Configurer constructor (`instructionAuth`). Examples: ```go // send instructions on-chain result, err := NewConfigurer(client, auth, solana.PublicKey{}, chainSelector).SetConfig() assert.True(t, solana.IsSignature(result.Hash)) assert.GreaterOrEqual(t, len(result.RawTransaction.([]solana.Instruction)), 4) ``` ```go // do NOT send instructions on-chain result, err := NewConfigurer(client, auth, solana.PublicKey{}, chainSelector).SetConfig() assert.Equal(t, result.Hash, "") assert.GreaterOrEqual(t, len(result.RawTransaction.([]solana.Instruction)), 4) ``` !BREAKING CHANGE!
…breaking the contract
183448a
to
4a6d4e4
Compare
|
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @smartcontractkit/[email protected] ### Minor Changes - [#297](#297) [`2a4a443`](2a4a443) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - fix: make predecessors parameter optional on NewProposal and NewTimelockProposal - [#310](#310) [`d5d9b16`](d5d9b16) Thanks [@gustavogama-cll](https://github.com/gustavogama-cll)! - feat: enable calling SetConfig without sending the transaction - [#301](#301) [`d8a156c`](d8a156c) Thanks [@akhilchainani](https://github.com/akhilchainani)! - Expose additional functions to help with proposal decoding - [#313](#313) [`4a4a5b5`](4a4a5b5) Thanks [@ecPablo](https://github.com/ecPablo)! - Remove dependency of timelock converter in solana with rpc.Client ### Patch Changes - [#311](#311) [`3808de9`](3808de9) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - Update to latest chainlink-ccip/chains/solana Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
This PR enables clients to call SetConfig() without sending the instructions to the blockchain. Its purpose is to retrieve the instructions that would be sent -- to, for instance, use this instructions to build an mcms proposal. The instructions are returned in the
TransactionResult
object, in theRawData
attribute (which used to be calledRawTransaction
and was renamed to reflect the fact it can hold other arbitrary types).In order to "activate" this mode, clients must set the optional argument
SkipTransaction
. For instance:BREAKING_CHANGE:
RawTransaction
renamed toRawData