Skip to content

feat: add no-build option for fee::Args - #1267

Merged
willemneal merged 10 commits into
mainfrom
feat-add-no_build-to-fee-Args
May 9, 2024
Merged

feat: add no-build option for fee::Args#1267
willemneal merged 10 commits into
mainfrom
feat-add-no_build-to-fee-Args

Conversation

@willemneal

@willemneal willemneal commented Mar 20, 2024

Copy link
Copy Markdown
Contributor

Fixes #1265.
Requires: #1173

Commands that build transactions now include the following args to output and exit early:

  • --build-only prints the base64 xdr before simulation
  • --sim-only prints the base64 xdr after simulation

For example,

soroban contract invoke --build-only .. -- hello --world world

prints:
AAAAAMwWyQMtAWO6nW4s+cKMRunx+kiaKfjJwIRNZEEclDvRAAAAZAAIgAEAAAANAAAAAAAAAAAAAAABAAAAAAAAABgAAAAAAAAAAQ3DO777M8sdGtPbMau+cuxAles4UILfUkZXOWTsqKvOAAAABWhlbGxvAAAAAAAAAQAAAA8AAAAFd29ybGQAAAAAAAAAAAAAAA==

soroban contract invoke --sim-only .. -- hello --world world

AAAAAMwWyQMtAWO6nW4s%2BcKMRunx%2BkiaKfjJwIRNZEEclDvRAAD4WAAIgAEAAAANAAAAAAAAAAAAAAABAAAAAAAAABgAAAAAAAAAAQ3DO777M8sdGtPbMau%2BcuxAles4UILfUkZXOWTsqKvOAAAABWhlbGxvAAAAAAAAAQAAAA8AAAAFd29ybGQAAAAAAAAAAAAAAQAAAAAAAAACAAAABgAAAAENwzu%2B%2BzPLHRrT2zGrvnLsQJXrOFCC31JGVzlk7KirzgAAABQAAAABAAAAB3mMSQSdZWZNBqeYQchZLRMLUhSFaxsEJAOkX%2Bel%2B%2BMzAAAAAABcQYMAABsoAAAAAAAAAAAAANeQ

Transaction result

The NetworkRunable trait a result type of TxnResult, either a raw xdr string or a T. This allows returning early.

update is-view

Ensure that is-view doesn't fetch account info as a source account doesn't need to exist for a simulation.

@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch 2 times, most recently from 2c5050f to dc2e10d Compare March 20, 2024 16:42
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch from 3b9ad3b to 398a018 Compare March 20, 2024 17:19

@leighmcculloch leighmcculloch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That was fast! This is great 👏🏻.

Couple questions inline.

The --sim-only might be unnecessary, given that folks could do soroban contract deploy --build-only | soroban tx simulate in the future, and that leans on command composability and keeps the options simpler. Thoughts from others on this? cc @fnando @chadoh

Comment thread cmd/soroban-cli/src/fee.rs
Comment thread cmd/soroban-cli/src/fee.rs Outdated
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch from 398a018 to 5f7a6e7 Compare March 28, 2024 19:53
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch 3 times, most recently from f7008fd to 3f87119 Compare April 2, 2024 22:10
@willemneal
willemneal enabled auto-merge (squash) April 8, 2024 17:00
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch 6 times, most recently from 3b5a34c to f53e8b1 Compare April 16, 2024 17:00
@leighmcculloch

Copy link
Copy Markdown
Member

Will take another look once #1173 is merged, but this looked good when I last reviewed other than the couple minor things which are addressed so I think we'll be able to fast merge this once the other is on its way.

@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch from f53e8b1 to 816e470 Compare April 23, 2024 19:49
@leighmcculloch
leighmcculloch disabled auto-merge May 2, 2024 10:59
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch 2 times, most recently from 71ecb56 to 4d20c27 Compare May 3, 2024 14:23

@leighmcculloch leighmcculloch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Few questions inline. Looks like this isn't far off.

Comment thread cmd/soroban-cli/src/commands/contract/deploy/wasm.rs Outdated
Comment thread cmd/soroban-cli/src/commands/contract/deploy/asset.rs Outdated
Comment thread cmd/soroban-cli/src/fee.rs Outdated
@willemneal
willemneal enabled auto-merge (squash) May 7, 2024 22:17
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch from 83157b3 to 9d7bee9 Compare May 7, 2024 22:19
@willemneal
willemneal force-pushed the feat-add-no_build-to-fee-Args branch from 9d7bee9 to 58daf6c Compare May 8, 2024 20:27

@leighmcculloch leighmcculloch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I pushed a couple changes to the PR in the last 3 commits, and I left comments inline to outline why. Please take a look and let me know if you agree with them.

Comment thread cmd/soroban-cli/src/commands/contract/deploy/asset.rs
Comment thread cmd/soroban-cli/src/commands/txn_result.rs
Comment thread cmd/soroban-cli/src/commands/contract/deploy/asset.rs
@leighmcculloch

Copy link
Copy Markdown
Member

@willemneal If you're good with the changes I pushed, can you resolve the unresolved conversations which are just the notes I left explaining why each change, and once they're all resolved that should trigger GitHub to auto-merge the PR.

If possible don't force push the branch in case we need to make more changes.

@leighmcculloch

Copy link
Copy Markdown
Member

I pushed a bug fix in 457a54b for how sim only works with install. I left a comment in the code about it for more information.

@willemneal
willemneal merged commit 199a88a into main May 9, 2024
@willemneal
willemneal deleted the feat-add-no_build-to-fee-Args branch May 9, 2024 12:31
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.

Separate tx build from simulate/sign/send

2 participants