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

refactor!: rename wasm to smart contract #4810

Closed
wants to merge 1 commit into from

Conversation

mversic
Copy link
Contributor

@mversic mversic commented Jul 8, 2024

Description

The fact that we work with wasm smart contracts is a sort of implementation detail.
Let's not specify implementation details in the API.

Linked issue

Closes #{issue_number}

Benefits

If we change from wasm to some other VM, we will have a reduced effect on the API.
If we don't it is implied that we use wasm, so no harm done there

Checklist

  • I've read CONTRIBUTING.md
  • I've used the standard signed-off commit format (or will squash just before merging)
  • All applicable CI checks pass (or I promised to make them pass later)
  • (optional) I've written unit tests for the code changes
  • I replied to all comments after code review, marking all implemented changes with thumbs up

@github-actions github-actions bot added the api-changes Changes in the API for client libraries label Jul 8, 2024
nxsaken
nxsaken previously approved these changes Jul 8, 2024
nxsaken
nxsaken previously approved these changes Jul 8, 2024
nxsaken
nxsaken previously approved these changes Jul 9, 2024
nxsaken
nxsaken previously approved these changes Jul 9, 2024
@s8sato s8sato self-assigned this Jul 10, 2024
Comment on lines 461 to +462
Executable::Instructions(instructions) => tx_builder.with_instructions(instructions),
Executable::Wasm(wasm) => tx_builder.with_wasm(wasm),
Executable::SmartContract(smart_contract) => {
Copy link
Contributor

@s8sato s8sato Jul 10, 2024

Choose a reason for hiding this comment

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

Imo what corresponds to smartcontracts is triggers in Iroha, and the executable part of a trigger (and a transaction) can be Wasm or ISIs. So I don't think "smartcontract" is a good candidate to rename "wasm"

Copy link
Contributor

Choose a reason for hiding this comment

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

While working on #4850, I noticed that Iroha has both triggers and smart contracts, at least we have two separate macros for defining the entry point. Not sure what the difference is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so smart contracts only have an owner, but triggers also specify the trigger id, owner and event. What happens when a trigger wasm is executed as a smart contract, and vice versa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While working on #4850, I noticed that Iroha has both triggers and smart contracts, at least we have two separate macros for defining the entry point. Not sure what the difference is.

how I see it.

  1. Transaction::executable is either a Vec<Instruction> or SmartContract
    You can execute an executable with client.submit. This executes the instructions or the smart contract immediately on submition
  2. Action::executable is either a Vec<Instruction> or SmartContract
    You have to first register a trigger and then invoke it with InstructionBox::Execute. The trigger can consist of Vec<InstructinoBox> or a be a smart contract

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so smart contracts only have an owner, but triggers also specify the trigger id, owner and event

no, smart contracts don't have an owner. The transaction they are part of has an owner

Copy link
Contributor

@nxsaken nxsaken Jul 17, 2024

Choose a reason for hiding this comment

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

I mean a smart contract entrypoint has an owner param, while a trigger entrypoint has that plus additional params

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
@mversic
Copy link
Contributor Author

mversic commented Jul 17, 2024

@s8sato has a good point. I'm closing this

@mversic mversic closed this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-changes Changes in the API for client libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants