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

feat: update compatibility with fuel-core v0.20 #34

Merged
merged 5 commits into from
Aug 16, 2023
Merged

Conversation

luizstacio
Copy link
Member

@luizstacio luizstacio commented Aug 15, 2023

close: #17

@luizstacio luizstacio changed the title wip: update fuel-core v0.20 feat: update compatibility with fuel-core v0.20 Aug 16, 2023
@luizstacio luizstacio marked this pull request as ready for review August 16, 2023 19:39
@@ -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 {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

Copy link

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));
Copy link
Member

@Voxelot Voxelot Aug 16, 2023

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

@luizstacio luizstacio merged commit ed75c50 into main Aug 16, 2023
1 check passed
@luizstacio luizstacio deleted the ls/feat/17 branch August 16, 2023 21:16
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"] }
Copy link
Contributor

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);
Copy link
Contributor

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

Voxelot added a commit that referenced this pull request Aug 29, 2023
- Addresses comments from @Braqzen on
#34
- Converts rust and sway to use a global workspace for the whole repo

---------

Co-authored-by: Luiz Estácio | stacio.eth <luizstacio@gmail.com>
Co-authored-by: Braqzen <103777923+Braqzen@users.noreply.github.com>
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.

Upgrade fuel-bridge to work with version 0.20
4 participants