PLEX-583: add cache config to write targeter#1286
Conversation
| } | ||
|
|
||
| var remainingAccounts []solana.AccountMeta | ||
| for _, acc := range t.Config.RemainingAccounts { |
There was a problem hiding this comment.
if len(t.Config.RemainingAccount) > 0 {
...
return
}
There was a problem hiding this comment.
you actually don't need the conditional since you already have the check at the top. if only cache details is provided, this loop is never used. if only the remaining account is provided, the cache details conditional is never used.
| } | ||
|
|
||
| if t.Config.CacheDetails != nil { | ||
| // assume that the receiver is the cache program |
There was a problem hiding this comment.
probably put the whole if block under another func and return it
|
| solana.AccountMeta{ | ||
| PublicKey: cacheProgram, // legacy writer omitted | ||
| IsWritable: false, | ||
| }, |
There was a problem hiding this comment.
it's not clear to me, why do we add three exactly the same accounts to the remaining?
There was a problem hiding this comment.
solana-foundation/anchor#2101 , the Optioanl account will be None if the program id is passed in
| solana.AccountMeta{ | ||
| PublicKey: solana.SystemProgramID, | ||
| IsWritable: false, | ||
| }, |
There was a problem hiding this comment.
SystemProgramID is already included in NewReportInstruction constructor
There was a problem hiding this comment.
The system program was included in the account context originally. I think this is no longer needed so we'll need to update the contract later
There was a problem hiding this comment.
But generally, as is it right now we also have to pass it into the remaining accounts because it's used by the receiver program. You could technically pass the system program from the forwarder report to a receiver on report, but you'd have to know the index ahead of time and whatnot.


Description
Requires Dependencies
Resolves Dependencies