Git Product home page Git Product logo

Comments (6)

smiasojed avatar smiasojed commented on May 24, 2024 1

The code responsible for the function always returning 0:

	fn convert(weight: Weight) -> BalanceOf<T> {
		<NextFeeMultiplier<T>>::get().saturating_mul_int(Self::weight_to_fee(weight))
	}

from ink.

smiasojed avatar smiasojed commented on May 24, 2024

Regarding the observation you made: The 0 is intentional, as the comment indicates, "Equivalent to the newer [seal1][super::api_doc::Version2::weight_to_fee] version but works with ref_time Weight only." (proof_size is set to 0).
The issue you observed is related to the runtime configuration. By changing type FeeMultiplierUpdate = () to type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self> in pallet_transaction_payment::Config for Runtime, you can make it work.

from ink.

smiasojed avatar smiasojed commented on May 24, 2024

@arturoBeccar, please advise if it works for you, and can we close the issue?

from ink.

arturoBeccar avatar arturoBeccar commented on May 24, 2024

Hi @smiasojed, recompiling the node on commit f1d8389 , and calling a contract with this function:

 #[ink(message)]
        pub fn weight_to_fee(&self, gas: u64) -> Balance {
            self.env().weight_to_fee(gas)
        }

We still obtain 0 with any gas number in e2e.

weight_to_fee_error_e2e_20231204

Any idea on why this is happening?

from ink.

smiasojed avatar smiasojed commented on May 24, 2024

Hi @arturoBeccar,
This is how I tested it:

  1. I recompiled the substrate-contract-node on commit 'f1d8389.'
  2. I started the node.
  3. I added the 'weight_to_fee' message to the Flipper contract.
  4. I instantiated it.
  5. I called 'weight_to_fee':
    cargo contract call --suri //Alice --manifest-path ../ink/integration-tests/flipper/Cargo.toml --contract 5D4NHEJyj56T7J9TXZwUjmuWBzecFvEunX51GmRmcv1igd8s --message weight_to_fee --args 10
    Result Ok(9)
    Do you verify it in the same manner?

from ink.

arturoBeccar avatar arturoBeccar commented on May 24, 2024

Hi @smiasojed. I tried the suggested steps and it worked correctly. I confirm the issue is now resolved in PR #219 to substrate-contract-node and can be closed. Thanks!

from ink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.