Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ values.
| `--storage-per-flow` | `FLOW_STORAGEMBPERFLOW` | | Specify size of the storage in MB for each FLOW in account balance. Default value from the flow-go |
| `--min-account-balance` | `FLOW_MINIMUMACCOUNTBALANCE` | | Specify minimum balance the account must have. Default value from the flow-go |
| `--transaction-fees` | `FLOW_TRANSACTIONFEESENABLED` | `false` | Enable variable transaction fees and execution effort metering <br> as described in [Variable Transaction Fees: Execution Effort](https://github.com/onflow/flow/pull/753) FLIP |
| `--transaction-max-gas-limit` | `FLOW_TRANSACTIONMAXGASLIMIT` | `9999` | Maximum [gas limit for transactions](https://docs.onflow.org/flow-go-sdk/building-transactions/#gas-limit) |
| `--script-gas-limit` | `FLOW_SCRIPTGASLIMIT` | `100000` | Specify gas limit for script execution |
| `--transaction-max-compute-limit` | `FLOW_TRANSACTIONMAXCOMPUTELIMIT` | `9999` | Maximum [compute limit for transactions](https://docs.onflow.org/flow-go-sdk/building-transactions/#gas-limit) |
| `--script-compute-limit` | `FLOW_SCRIPTCOMPUTELIMIT` | `100000` | Specify compute limit for script execution |
| ~~`--transaction-max-gas-limit`~~ | ~~`FLOW_TRANSACTIONMAXGASLIMIT`~~ | `9999` | **Deprecated:** Use `--transaction-max-compute-limit` instead |
| ~~`--script-gas-limit`~~ | ~~`FLOW_SCRIPTGASLIMIT`~~ | `100000` | **Deprecated:** Use `--script-compute-limit` instead |
| `--coverage-reporting` | `FLOW_COVERAGEREPORTING` | `false` | Enable Cadence code coverage reporting |
| `--contract-removal` | `FLOW_CONTRACTREMOVAL` | `true` | Allow removal of already deployed contracts, used for updating during development |
| `--skip-tx-validation` | `FLOW_SKIPTRANSACTIONVALIDATION` | `false` | Skip verification of transaction signatures and sequence numbers |
Expand Down
28 changes: 24 additions & 4 deletions cmd/emulator/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ type Config struct {
StorageMBPerFLOW string `flag:"storage-per-flow" info:"the MB amount of storage capacity an account has per 1 FLOW token it has. e.g. '100.0'. The default is taken from the current version of flow-go"`
MinimumAccountBalance string `flag:"min-account-balance" info:"The minimum account balance of an account. This is also the cost of creating one account. e.g. '0.001'. The default is taken from the current version of flow-go"`
TransactionFeesEnabled bool `default:"false" flag:"transaction-fees" info:"enable transaction fees"`
TransactionMaxGasLimit int `default:"9999" flag:"transaction-max-gas-limit" info:"maximum gas limit for transactions"`
ScriptGasLimit int `default:"100000" flag:"script-gas-limit" info:"gas limit for scripts"`
TransactionMaxGasLimit int `default:"9999" flag:"transaction-max-gas-limit" info:"(deprecated) use --transaction-max-compute-limit"`
ScriptGasLimit int `default:"100000" flag:"script-gas-limit" info:"(deprecated) use --script-compute-limit"`
TransactionMaxComputeLimit int `default:"9999" flag:"transaction-max-compute-limit" info:"maximum compute limit for transactions"`
ScriptComputeLimit int `default:"100000" flag:"script-compute-limit" info:"compute limit for scripts"`
Contracts bool `default:"false" flag:"contracts" info:"deploy common contracts when emulator starts"`
ContractRemovalEnabled bool `default:"true" flag:"contract-removal" info:"allow removal of already deployed contracts, used for updating during development"`
SkipTxValidation bool `default:"false" flag:"skip-tx-validation" info:"skip verification of transaction signatures and sequence numbers"`
Expand Down Expand Up @@ -162,6 +164,20 @@ func Cmd(config StartConfig) *cobra.Command {
conf.ForkHeight = conf.StartBlockHeight
}

// Gas/Compute terminology deprecation
if cmd.PersistentFlags().Changed("transaction-max-gas-limit") {
logger.Warn().Msg("❗ --transaction-max-gas-limit is deprecated; use --transaction-max-compute-limit")
if !cmd.PersistentFlags().Changed("transaction-max-compute-limit") {
conf.TransactionMaxComputeLimit = conf.TransactionMaxGasLimit
}
}
if cmd.PersistentFlags().Changed("script-gas-limit") {
logger.Warn().Msg("❗ --script-gas-limit is deprecated; use --script-compute-limit")
if !cmd.PersistentFlags().Changed("script-compute-limit") {
conf.ScriptComputeLimit = conf.ScriptGasLimit
}
}

// In non-fork mode, fork-only flags are invalid
if conf.ForkHost == "" && (conf.StartBlockHeight > 0 || conf.ForkHeight > 0) {
Exit(1, "❗ --fork-height requires --fork-host")
Expand Down Expand Up @@ -210,8 +226,8 @@ func Cmd(config StartConfig) *cobra.Command {
Snapshot: conf.Snapshot,
DBPath: conf.DBPath,
GenesisTokenSupply: parseCadenceUFix64(conf.TokenSupply, "token-supply"),
TransactionMaxGasLimit: uint64(conf.TransactionMaxGasLimit),
ScriptGasLimit: uint64(conf.ScriptGasLimit),
TransactionMaxGasLimit: uint64(conf.TransactionMaxComputeLimit),
ScriptGasLimit: uint64(conf.ScriptComputeLimit),
TransactionExpiry: uint(conf.TransactionExpiry),
StorageLimitEnabled: conf.StorageLimitEnabled,
StorageMBPerFLOW: storageMBPerFLOW,
Expand Down Expand Up @@ -274,6 +290,10 @@ func Cmd(config StartConfig) *cobra.Command {
_ = cmd.PersistentFlags().MarkDeprecated("rpc-host", "use --fork-host")
_ = cmd.PersistentFlags().MarkHidden("start-block-height")
_ = cmd.PersistentFlags().MarkDeprecated("start-block-height", "use --fork-height")
_ = cmd.PersistentFlags().MarkHidden("transaction-max-gas-limit")
_ = cmd.PersistentFlags().MarkDeprecated("transaction-max-gas-limit", "use --transaction-max-compute-limit")
_ = cmd.PersistentFlags().MarkHidden("script-gas-limit")
_ = cmd.PersistentFlags().MarkDeprecated("script-gas-limit", "use --script-compute-limit")

return cmd
}
Expand Down
6 changes: 4 additions & 2 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ values.
| `--storage-per-flow` | `FLOW_STORAGEMBPERFLOW` | | Specify size of the storage in MB for each FLOW in account balance. Default value from the flow-go |
| `--min-account-balance` | `FLOW_MINIMUMACCOUNTBALANCE` | | Specify minimum balance the account must have. Default value from the flow-go |
| `--transaction-fees` | `FLOW_TRANSACTIONFEESENABLED` | `false` | Enable variable transaction fees and execution effort metering <br> as described in [Variable Transaction Fees: Execution Effort](https://github.com/onflow/flow/pull/753) FLIP |
| `--transaction-max-gas-limit` | `FLOW_TRANSACTIONMAXGASLIMIT` | `9999` | Maximum [gas limit for transactions](https://docs.onflow.org/flow-go-sdk/building-transactions/#gas-limit) |
| `--script-gas-limit` | `FLOW_SCRIPTGASLIMIT` | `100000` | Specify gas limit for script execution |
| `--transaction-max-compute-limit` | `FLOW_TRANSACTIONMAXCOMPUTELIMIT` | `9999` | Maximum [compute limit for transactions](https://docs.onflow.org/flow-go-sdk/building-transactions/#gas-limit) |
| `--script-compute-limit` | `FLOW_SCRIPTCOMPUTELIMIT` | `100000` | Specify compute limit for script execution |
| ~~`--transaction-max-gas-limit`~~ | ~~`FLOW_TRANSACTIONMAXGASLIMIT`~~ | `9999` | **Deprecated:** Use `--transaction-max-compute-limit` instead |
| ~~`--script-gas-limit`~~ | ~~`FLOW_SCRIPTGASLIMIT`~~ | `100000` | **Deprecated:** Use `--script-compute-limit` instead |
| `--with-contracts` | `FLOW_WITHCONTRACTS` | `false` | Deploy common contracts when emulator starts |
| `--coverage-reporting` | `FLOW_COVERAGEREPORTING` | `false` | Enable Cadence code coverage reporting |
| `--skip-transaction-validation` | `FLOW_SKIPTRANSACTIONVALIDATION` | `false` | Skip verification of transaction signatures and sequence numbers |
Expand Down
2 changes: 1 addition & 1 deletion types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ type InvalidTransactionGasLimitError struct {
func (e *InvalidTransactionGasLimitError) isTransactionValidationError() {}

func (e *InvalidTransactionGasLimitError) Error() string {
return fmt.Sprintf("transaction gas limit (%d) exceeds the maximum gas limit (%d)", e.Actual, e.Maximum)
return fmt.Sprintf("transaction compute limit (%d) exceeds the maximum compute limit (%d)", e.Actual, e.Maximum)
}

// An InvalidStateVersionError indicates that a state version hash provided is invalid.
Expand Down
12 changes: 6 additions & 6 deletions utils/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func PrintScriptResult(logger *zerolog.Logger, result *types.ScriptResult) {
if result.Succeeded() {
logger.Debug().
Str("scriptID", result.ScriptID.String()).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Msg("⭐ Script executed")
} else {
logger.Warn().
Str("scriptID", result.ScriptID.String()).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Msg("❗ Script reverted")
}
Expand All @@ -56,13 +56,13 @@ func PrintTransactionResult(logger *zerolog.Logger, result *types.TransactionRes
if result.Succeeded() {
logger.Debug().
Str("txID", result.TransactionID.String()).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Msg("⭐ Transaction executed")
} else {
logger.Warn().
Str("txID", result.TransactionID.String()).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Msg("❗ Transaction reverted")
}
Expand Down Expand Up @@ -95,15 +95,15 @@ func PrintScheduledTransactionResult(logger *zerolog.Logger, result *types.Trans
logger.Debug().
Str("systemTxId", result.TransactionID.String()).
Str("scheduledTxId", scheduledTxID).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Str("kind", "scheduled").
Msg("⏱️ Scheduled transaction executed")
} else {
logger.Warn().
Str("systemTxId", result.TransactionID.String()).
Str("scheduledTxId", scheduledTxID).
Uint64("computationUsed", result.ComputationUsed).
Uint64("computeUnitsUsed", result.ComputationUsed).
Uint64("memoryEstimate", result.MemoryEstimate).
Str("kind", "scheduled").
Msg("❗ Scheduled transaction reverted")
Expand Down
Loading