-
Notifications
You must be signed in to change notification settings - Fork 75
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: update compatibility with fuel-core v0.20 #34
Conversation
@@ -15,7 +15,7 @@ impl MessageData { | |||
/// | |||
/// any data beyond 160 bytes means deposit is meant for a contract. | |||
/// if data is > 161 bytes, then we also need to call process_message on the destination contract. | |||
pub fn parse(msg_idx: u8) -> Self { | |||
pub fn parse(msg_idx: u64) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we change this to u64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was changed because sway methods input_message_data_length
and input_message_data
now receive a u64
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah this is likely because sway doesn't allow for implicit integer casting now? Since I don't think the stdlib changed here. The strange thing to me is that it seems like we should be able to safely upcast ints without any concerns for precision.
cc @IGI-111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we have safe upcasts, though they have to be explicitly called.
I'm not sure if this should be fixed here or on the library side however.
Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
@@ -74,8 +75,10 @@ impl MessageReceiver for Contract { | |||
register_refund(message_data.from, message_data.token, message_data.amount); | |||
}, | |||
Result::Ok(amount) => { | |||
let subId: SubId = ZERO_B256; | |||
let tokenId = sha256((contract_id(), subId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] there is a helper function for this in the stdlib now std::asset_id::construct_default_asset_id
.
https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/asset_id.sw#L15
fuel-core-types = { version = "0.19.1", default-features = false } | ||
fuels = { version = "0.44", features = ["fuel-core-lib"] } | ||
fuel-core-types = { version = "0.20.4", default-features = false } | ||
fuels = { version = "0.45.1", features = ["fuel-core-lib"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version 46 is out
@@ -63,14 +64,16 @@ mod success { | |||
) | |||
.await; | |||
|
|||
println!("receipts: {:#?}", receipts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ought to keep debugging statements out of tests
close: #17