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

seal_gas_left should be Weight(u64), not T::Balance (u128) #801

Closed
atenjin opened this issue Jun 2, 2021 · 3 comments
Closed

seal_gas_left should be Weight(u64), not T::Balance (u128) #801

atenjin opened this issue Jun 2, 2021 · 3 comments
Labels
C-bug Something isn't working good first issue Good for newcomers

Comments

@atenjin
Copy link

atenjin commented Jun 2, 2021

seal_gas_left should be Weight(u64), not T::Balance (u128)

Describe the bug
In ink!, code is:

https://github.com/paritytech/ink/blob/master/crates/env/src/api.rs#L93-L100

the gas_left return T::Balance. But the default Balance is u128.

But in substrate pallet-contracts

https://github.com/paritytech/substrate/blob/master/frame/contracts/src/wasm/runtime.rs#L1070

the ctx.ext.gas_meter().gas_left() will return Weight, it's u64.

Thus if call seal_gas_left in ink!, must meet decode error.

@Robbepop
Copy link
Collaborator

Robbepop commented Jun 2, 2021

Good find!
Since Weight is not customizable in the contracts pallet we should change the return type to plain u64.

@HCastano HCastano added C-bug Something isn't working good first issue Good for newcomers labels Jun 14, 2021
@HCastano HCastano changed the title [bug] seal_gas_left should be Weight(u64), not T::Balance (u128) seal_gas_left should be Weight(u64), not T::Balance (u128) Jun 14, 2021
@HCastano
Copy link
Contributor

@atenjin feel free to open a PR for this!

@cmichi
Copy link
Collaborator

cmichi commented Jul 5, 2021

Closed via #797.

@cmichi cmichi closed this as completed Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants