Skip to content

GAS reloading on execution #2443

Closed
@igormcoelho

Description

@igormcoelho

Summary or problem description
This change allows contracts to add more GAS into engine during execution. This simplifies GAS calculations on complex contracts, so that more and more GAS can be required during runtime, depending on the situation.

Related to: neo-project/proposals#137

Do you have any solution you want to propose?
I propose that GAS Native Contract have some method like GAS.transferToSystem(scripthash, amount), where an amount of GAS is requested to be put on the engine executing the transaction.

Example:

// inside smart contract
RunBigCode();
// check if there's enough gas... if not, top-up more 0.1 GAS
GAS.transferToSystem(scripthash, 0.1);   // this adds more 0.1 into ApplicationEngine, and takes from 'scripthash'
// run more code
RunBigCode();
// check if there's enough gas... if not, top-up more 0.1 GAS
GAS.transferToSystem(scripthash, 0.1); 
// ...

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • Ledger
  • Other: ApplicationEngine

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionInitial issue state - proposed but not yet accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions