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

Deferred_calls #335

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

Deferred_calls #335

wants to merge 26 commits into from

Conversation

modship
Copy link
Member

@modship modship commented Jul 25, 2024

No description provided.

Copy link
Contributor

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

Besides the two comments I made, don't we want to implement these for wasmv1 ABIs too?

.get_interface()
.deferred_call_quote(asc_slot, max_gas as u64)?;
if !available {
price = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

If !available, why don't we abi_bail!() instead?

Copy link
Member

Choose a reason for hiding this comment

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

because it's a quote, not a reservation attempt

src/tests/mod.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated
@@ -11,6 +11,7 @@ chrono = { version = "=0.4", features = ["clock"], default-features = false }
displaydoc = "0.2"
function_name = "0.3"
loupe = "0.1"
#massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs.git", rev = "426fd325a55dfcc4033920bed2de075a7e7ad4b7" }
Copy link
Member

Choose a reason for hiding this comment

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

what happened here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

(Err(_), _) => abi_bail!("negative validity end period"),
(_, Err(_)) => abi_bail!("invalid validity end thread"),
};
if max_gas.is_negative() {
Copy link
Member

Choose a reason for hiding this comment

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

best practice: better do a try_into u64 directly since below we convert using "as u64"

Copy link
Member Author

Choose a reason for hiding this comment

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

done

(Err(_), _) => abi_bail!("negative validity end period"),
(_, Err(_)) => abi_bail!("invalid validity end thread"),
};
if max_gas.is_negative() {
Copy link
Member

Choose a reason for hiding this comment

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

try_into u64

Copy link
Member Author

Choose a reason for hiding this comment

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

done

if max_gas.is_negative() {
abi_bail!("negative max gas");
}
if raw_coins.is_negative() {
Copy link
Member

Choose a reason for hiding this comment

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

try into u64

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Comment on lines +274 to +277
abi_costs.insert(String::from("assembly_script_get_deferred_call_quote"), 11);
abi_costs.insert(String::from("assembly_script_deferred_call_register"), 11);
abi_costs.insert(String::from("assembly_script_deferred_call_exists"), 11);
abi_costs.insert(String::from("assembly_script_deferred_call_cancel"), 11);
Copy link
Member

Choose a reason for hiding this comment

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

TODO calibrate

Copy link
Member

@damip damip left a comment

Choose a reason for hiding this comment

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

Very good start!
TODOs:

  • solve all comments
  • calibrate gas
  • add the WASMV1 version

@modship modship marked this pull request as ready for review August 28, 2024 13:37
@modship modship requested a review from damip August 28, 2024 13:37
@modship modship marked this pull request as draft August 28, 2024 14:12
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.

4 participants