-
Notifications
You must be signed in to change notification settings - Fork 43
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
[WIP] Enable ChainReader to read PDA account state #1003
base: develop
Are you sure you want to change the base?
Conversation
Quality Gate failedFailed conditions |
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.
This all looks great to me! Really readable and straightforward. Not sure if you're done adding functionality for CCIP but this should unblock the interface tests
)) | ||
var reader readBinding | ||
// Create PDA read binding if Seeds config is non-nil | ||
// Note: Empty seeds list is a valid configuration for a PDA so a length check is intentionally skipped |
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.
Would an empty seeds list just be a normal account read?
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 think FindProgramAddress
still outputs a different programID even with empty seeds since it's still applying the bump seed. I think every PDA in the on-chain code uses some sort of seed though. So guess it wouldn't hurt to also validate empty seeds for our current use case but I wanted to keep this open in case something changes in the future.
} | ||
|
||
seedByteArray := make([][]byte, 0, len(b.seeds)) | ||
for _, seed := range b.seeds { |
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.
thanks for reusing some of the chainwriter seeds functionality! makes it a lot easier to understand both
Enable the ChainReader to read PDA account state
Seed
config which can be configured as either directly as aValue
or as aLocation
that is found in the providedparams
ReadDefinition
to include a list ofSeed
configspdaReadBinding
type with custom logic to calculate PDAs using seeds and the bound program IDreadBinding
'sGetAddress
method to intakeparams
to use for seeds when calculating the PDA