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

[feature] #3941, #3612: Remove expressions #4089

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

Arjentix
Copy link
Contributor

@Arjentix Arjentix commented Nov 27, 2023

Description

The main idea was to move all expressions into executor. After a discussion with @mversic we decided not to implement any of them inside default_executor, but to have an example executor to show PoC.

  • All expressions were removed
  • #[model] together with ffi have become useless for data_model because in future clients should link against executor_data_model. So I partly removed them. This might need future investigation

I wii squash all my commits before merge.

Linked issue

Benefits

  • Much less code
  • No stillborn expression system inside data_model and core
  • Types for ISI now can't contain unsupported parameters

Follow up tasks

  • Reconsider ffi for data_model
  • Make block content opaque
  • Write example executor with expressions or even DSL

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

@Arjentix Arjentix added Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST labels Nov 27, 2023
@Arjentix Arjentix self-assigned this Nov 27, 2023
configs/peer/executor.wasm Outdated Show resolved Hide resolved
schema/gen/src/lib.rs Outdated Show resolved Hide resolved
data_model/src/visit.rs Outdated Show resolved Hide resolved
data_model/Cargo.toml Outdated Show resolved Hide resolved
data_model/src/trigger.rs Outdated Show resolved Hide resolved
@Erigara Erigara self-assigned this Nov 28, 2023
data_model/src/isi.rs Outdated Show resolved Hide resolved
Comment on lines 796 to 767
/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`Quantity`] type.
pub fn asset_quantity(quantity: u32, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::Quantity(Burn::new(quantity, asset_id)))
}

/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`BigQuantity`] type.
pub fn asset_big_quantity(quantity: u128, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::BigQuantity(Burn::new(quantity, asset_id)))
}

/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`Fixed`] type.
pub fn asset_fixed(quantity: Fixed, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::Fixed(Burn::new(quantity, asset_id)))
}
Copy link
Contributor

@mversic mversic Nov 28, 2023

Choose a reason for hiding this comment

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

this is how I would prefer doing it:

Suggested change
/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`Quantity`] type.
pub fn asset_quantity(quantity: u32, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::Quantity(Burn::new(quantity, asset_id)))
}
/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`BigQuantity`] type.
pub fn asset_big_quantity(quantity: u128, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::BigQuantity(Burn::new(quantity, asset_id)))
}
/// Constructs a new [`BurnBox`] to burn [`Asset`] of [`Fixed`] type.
pub fn asset_fixed(quantity: Fixed, asset_id: <Asset as Identifiable>::Id) -> Self {
Self::Asset(AssetBurnBox::Fixed(Burn::new(quantity, asset_id)))
}
/// Constructs a new [`BurnBox`] to burn [`Asset`]
pub fn asset(quantity: impl Into<AssetValue>, asset_id: AssetId) -> Self {
match quantity.into() {
AssetType::Quantity(quantity) => Self::Asset(AssetBurnBox::Quantity(Burn::new(quantity, asset_id))),
AssetType::BigQuantity(quantity) => Self::Asset(AssetBurnBox::Quantity(Burn::new(quantity, asset_id))),
AssetType::Fixed(quantity) => Self::Asset(AssetBurnBox::Quantity(Burn::new(quantity, asset_id))),
}
}

I think this makes a better API but I see we might not be able to do it because of AssetValue::Store

data_model/src/isi.rs Outdated Show resolved Hide resolved
data_model/src/isi.rs Outdated Show resolved Hide resolved
client/tests/integration/transfer_asset.rs Outdated Show resolved Hide resolved
configs/peer/genesis.json Show resolved Hide resolved
core/src/smartcontracts/isi/tx.rs Show resolved Hide resolved
data_model/build.rs Outdated Show resolved Hide resolved
data_model/src/query/mod.rs Outdated Show resolved Hide resolved
data_model/src/query/mod.rs Outdated Show resolved Hide resolved
@mversic mversic changed the title [feature] #3941: Remove expressions [feature] #3941, #3612: Remove expressions Dec 6, 2023
@Arjentix Arjentix force-pushed the executor_expressions branch 2 times, most recently from 39703b1 to e1de609 Compare December 12, 2023 08:01
mversic
mversic previously approved these changes Dec 13, 2023
mversic
mversic previously approved these changes Dec 13, 2023
Erigara
Erigara previously approved these changes Dec 14, 2023
Copy link
Contributor

@Erigara Erigara left a comment

Choose a reason for hiding this comment

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

LGTM

client/benches/tps/utils.rs Outdated Show resolved Hide resolved
smart_contract/executor/src/default.rs Show resolved Hide resolved
@Arjentix Arjentix merged commit 248760a into hyperledger:iroha2-dev Dec 14, 2023
13 checks passed
@Arjentix Arjentix deleted the executor_expressions branch December 14, 2023 08:38
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this pull request Jan 9, 2024
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this pull request Jan 22, 2024
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants