-
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
Multisig support for more commands #115
Conversation
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setConfigMultisig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setConfigMultisig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/write.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setConfig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setPayees.ts
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/store/setWriterMultisig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/write.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts
Outdated
Show resolved
Hide resolved
…mment, reverting write offchain config
const rawTx = await this.makeRawTransaction(this.wallet.payer.publicKey) | ||
const tx = await makeTx(rawTx) | ||
logger.loading('Sending tx...') | ||
const txhash = await parseContractErrors(this.provider.send(tx, [this.wallet.payer]), this.idl) |
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.
@RodrigoAD any comments here before applying it to all commands?
@@ -7,3 +11,34 @@ export const divideIntoChunks = (arr: Array<any> | Buffer, chunkSize: number): a | |||
} | |||
return chunks | |||
} | |||
|
|||
export const parseContractErrors = async (sendTx: Promise<String>, idl: Idl): Promise<string> => { |
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.
Don't wrap the execution, wrap the function. Same as here (https://github.com/smartcontractkit/chainlink-solana/blob/develop/gauntlet/packages/gauntlet-serum-multisig/src/commands/multisig.ts#L99)
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.
Adding it to SolanaCommand, since it is a method and requires some configuration from this.provider.
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.
Just needs a bit of cleaning
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setPayees.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setPayees.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setPayees.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ownership/acceptOwnership.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ownership/acceptOwnership.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/store/setWriter.ts
Outdated
Show resolved
Hide resolved
logger.info(`Execution TX hash: ${tx.toString()}`) | ||
return tx | ||
// get the command's starting word to map it to the respective IDL(ocr2, store etc) | ||
const { idl } = getContract(command.id.split(':')[0], '') |
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 is not good. This could be addressed when we change this.
For the moment, leave it as it was
For the moment let's load the contract and program here too. Open an issue please to circle back here. You can use program.idl then
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.
The issue here if I remove this, is that errors will not be translated properly for multisig commands, leading to confusion for users.
Maybe open an issue for this as well? Tackling it along with the other by keeping some program/idl state on SolanaCommand could be possible.
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.
Yes, open an issue please. I'd say that the same issue can solve both problems
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 have some more comments, we can sync offline
@@ -69,21 +68,48 @@ export default class SetConfig extends SolanaCommand { | |||
|
|||
logger.log('Config information:', input) | |||
await prompt(`Continue setting config on ${state.toString()}?`) |
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 prompt is in many commands. It shouldn't be at tx creation time, but on execution. Please change it in every command that appears like that
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.
Changing them. The only drawback is that users will not be prompted while using multisig, that's why I had left them.
gauntlet/packages/gauntlet-serum-multisig/src/commands/multisig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/setConfig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-serum-multisig/src/commands/multisig.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ownership/acceptOwnership.ts
Outdated
Show resolved
Hide resolved
...let/packages/gauntlet-solana-contracts/src/commands/contracts/ownership/transferOwnership.ts
Outdated
Show resolved
Hide resolved
gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/store/setValidatorConfig.ts
Outdated
Show resolved
Hide resolved
@@ -57,22 +57,51 @@ export default class SetWriter extends SolanaCommand { | |||
|
|||
console.log(`Setting store writer on Store (${storeState.toString()}) and Feed (${feedState.toString()})`) |
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.
Move this to execution as well
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.
Moved, but had to recalculate some of the variables. We might need shared state/variables to be shared across execute/makeRawTransaction or some other way to tackle it.
Might be related to #127, to add more shared state.
c516f42
to
e61ee2b
Compare
No description provided.