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

feat: add --send to contract invoke and default to only sending transaction if there are writes in the ledger footprint #1518

Merged
merged 9 commits into from
Aug 7, 2024

Conversation

willemneal
Copy link
Member

@willemneal willemneal commented Aug 1, 2024

What

See initial discussion here: #225

Why

Currently users must opt in to not sending a transaction with --is-view. This deprecates --is-view and flips the default to only send if there are writes in the ledger footprint returned by the simulation.

It improves UX because now when making a view call a user must wait for the transaction be complete vs viewing the simulation result.

Close #225

Known limitations

[TODO or N/A]

@willemneal willemneal changed the title feat: add --send to invoke and default to send if there are writes feat: add --send to contract invoke and default to only sending transaction if there are writes in the ledger footprint Aug 1, 2024
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Couple requests inline.

I think the concept is still pending feedback from @janewang and others.

But I've been hoping to see this functionality for a couple years (#225) so I think adding this or something like this is 💯.

FULL_HELP_DOCS.md Outdated Show resolved Hide resolved
FULL_HELP_DOCS.md Outdated Show resolved Hide resolved
cmd/soroban-cli/src/commands/contract/invoke.rs Outdated Show resolved Hide resolved
@willemneal
Copy link
Member Author

willemneal commented Aug 1, 2024

@leighmcculloch should rename to use your issue's names? say slack ❤️

Thanks for the review!

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Took another look, one fix needed, and otherwise just needs events 👏🏻

cmd/soroban-cli/src/commands/contract/invoke.rs Outdated Show resolved Hide resolved
FULL_HELP_DOCS.md Outdated Show resolved Hide resolved
@willemneal willemneal marked this pull request as ready for review August 5, 2024 15:42
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Looks good. One thing missing, an env var for the option, otherwise lgtm.

@leighmcculloch leighmcculloch merged commit d1c6a9d into stellar:main Aug 7, 2024
25 checks passed
@leighmcculloch
Copy link
Member

I think we need a follow up change to this change prior to this change being released. (cc @janewang @fnando).

In this change we didn't take into the account the implication of txs that are read-only (no storage writes, no events), but that require auth. Auth checks are never run, and auth code is not executed.

It's not obvious what the behavior should be.

Simulating and considering the tx as read-only may be appropriate. Or it maybe surprising.

Maybe we at least need a warning outputted that the tx is not being sent because simulation indicated that the tx was read-only.

Or maybe we need to treat any tx with an auth as a read-write. Folks can still force it not to submit with --send=no.

Thoughts anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Bail on submitting if the simulate transaction shows a readonly footprint
3 participants