anthias-labs / arbiter

A blazing-fast Ethereum sandbox that lets developers orchestrate event-driven simulations.
https://github.com/anthias-labs/arbiter
Apache License 2.0
680 stars 65 forks source link

feat: adjustable gas price #241

Closed Autoparallel closed 1 year ago

Autoparallel commented 1 year ago

Idea

To make simulations as realistic as possible, we need to give agents some raw ether and force them to pay gas for transactions. At the moment, the gas price has been fixed to zero.

Solution

We can set another parameter in EnvironmentParameters similar to how I commented on #418. We can have an enum, or something, that allows the user to choose some gas rules for the environment. They can be externalized, stochastic, or off, e.g.,:

pub enum GasRules {
     UserControlled,
     Randomized(f64),
     None(u128),
}

This GasRules can go into the EnvironmentParameters.

We can also perhaps add functionality for gas tips later on if we expand upon an enum.


IT IS WORTH NOTING THAT ISSUE #410 IS RELEVANT HERE TOO

Autoparallel commented 1 year ago

I am going to work on this soon. I have thoughts on how to get a basic version of this done.

0xJepsen commented 1 year ago

We could probably put this in an arbiter.toml that would maybe configure revm?