ava-labs / hypersdk

Opinionated Framework for Building Hyper-Scalable Blockchains on Avalanche
https://hypersdk.xyz/
Other
193 stars 100 forks source link

Pass all gas parameter in `ExternalCallContext` #1184

Open iFrostizz opened 1 month ago

iFrostizz commented 1 month ago

It is currently a bit unpractical to supply a constant max_units because some programs called externally may use more than others, and if we offload this to the parameters of the function then it adds more complexity. It would be nice to be able to pass an option to the current max_units field of the ExternalCallContext and in the case of this value being None, any unit that has not been spent would be refunded to the current context.

richardpringle commented 1 month ago

We can probably use an Option<NonZeroU64> and just treat it as a u64 on the go side. If the value is 0, that means to take what's needed.