Skip to content
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

[9/x][programmable transactions] Added errors #8767

Merged
merged 2 commits into from
Mar 2, 2023

Conversation

tnowacki
Copy link
Contributor

@tnowacki tnowacki commented Mar 1, 2023

Description

Replaced panics with execution errors

Test Plan

👀


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

@tnowacki tnowacki requested review from amnn and bmwill March 1, 2023 22:58
@vercel
Copy link

vercel bot commented Mar 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Comments Updated
explorer ⬜️ Ignored (Inspect) Mar 2, 2023 at 6:19PM (UTC)
explorer-storybook ⬜️ Ignored (Inspect) Mar 2, 2023 at 6:19PM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Mar 2, 2023 at 6:19PM (UTC)

/// Errors if out of bounds, if the argument is borrowed, if it is unavailable (already taken),
/// or if it is an object that cannot be taken by value (shared or immutable)
pub fn take_arg<V: TryFromValue>(
pub fn by_value_arg<V: TryFromValue>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion @amnn!

Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -2357,6 +2376,22 @@ pub struct InvalidSharedByValue {
pub object: ObjectID,
}

#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Hash)]
pub enum CommandArgumentError {
Copy link
Member

Choose a reason for hiding this comment

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

Would benefit from some docs:

  • An overall doc comment reminding folks that these come from programmable transaction commands.
  • A short description of how these errors come about (especially for the Invalid* errors -- what makes those things invalid?)

Copy link
Member

Choose a reason for hiding this comment

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

(Or alternatively, a pointer in the outer doc comment to say that the Display implementation has this information
-- is there any chance we could use thiserror for this to bring these two things together?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooo fancy, will do

- Replaced panics with execution errors
@tnowacki
Copy link
Contributor Author

tnowacki commented Mar 2, 2023

Removed the error for unused input, so should fix #8776

@tnowacki tnowacki merged commit ac4c7e6 into MystenLabs:main Mar 2, 2023
@tnowacki tnowacki deleted the pt-9 branch March 2, 2023 19:04
tnowacki added a commit that referenced this pull request Mar 3, 2023
## Description 

Adds a programmable transaction builder. APIs are there mostly for
migration.

Builds on #8767 

## Test Plan 

Not yet in use 

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants