Skip to content

Commit

Permalink
Deployment fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIliev545 committed Jan 15, 2024
1 parent a0f632c commit b952cdf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion go/config/enclave_cli_flags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"github.com/ethereum/go-ethereum/params"
"github.com/ten-protocol/go-ten/go/common"
"github.com/ten-protocol/go-ten/go/common/flag"
)
Expand Down Expand Up @@ -53,7 +54,7 @@ var EnclaveFlags = map[string]*flag.TenFlag{
SequencerIDFlag: flag.NewStringFlag(SequencerIDFlag, "", "The 20 bytes of the address of the sequencer for this network"),
MaxBatchSizeFlag: flag.NewUint64Flag(MaxBatchSizeFlag, 1024*25, "The maximum size a batch is allowed to reach uncompressed"),
MaxRollupSizeFlag: flag.NewUint64Flag(MaxRollupSizeFlag, 1024*64, "The maximum size a rollup is allowed to reach"),
L2BaseFeeFlag: flag.NewUint64Flag(L2BaseFeeFlag, 1, ""),
L2BaseFeeFlag: flag.NewUint64Flag(L2BaseFeeFlag, params.InitialBaseFee, ""),
L2CoinbaseFlag: flag.NewStringFlag(L2CoinbaseFlag, "0xd6C9230053f45F873Cb66D8A02439380a37A4fbF", ""),
GasBatchExecutionLimit: flag.NewUint64Flag(GasBatchExecutionLimit, 30_000_000, "Max gas that can be executed in a single batch"),
ObscuroGenesisFlag: flag.NewStringFlag(ObscuroGenesisFlag, "", "The json string with the obscuro genesis"),
Expand Down
4 changes: 0 additions & 4 deletions go/enclave/components/batch_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ func (executor *batchExecutor) estimateL1Fees(stateDB *state.StateDB, context *B
continue
}

/*stateDB.SubBalance(*sender, cost)
stateDB.AddBalance(context.Creator, cost)*/
// todo - add refund logic.

transactions = append(transactions, common.L2PricedTransaction{
Tx: tx,
PublishingCost: big.NewInt(0).Set(cost),
Expand Down
7 changes: 5 additions & 2 deletions go/enclave/evm/evm_facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"errors"
"fmt"
"math/big"

// unsafe package imported in order to link to a private function in go-ethereum.
// This allows us to customize the message generated from a signed transaction and inject custom gas logic.
_ "unsafe"

"github.com/ethereum/go-ethereum/accounts/abi"
Expand Down Expand Up @@ -130,10 +133,10 @@ func executeTransaction(

if hasL1Cost {
l1Gas.Div(l1cost, header.BaseFee)
l1Gas.Add(l1Gas, big.NewInt(1)) // account for leftover
l1Gas.Add(l1Gas, big.NewInt(1))

if msg.GasLimit < l1Gas.Uint64() {
return nil, fmt.Errorf("gas limit for tx too low. Want at least: %d have: %d", l1Gas, msg.GasLimit)
return nil, fmt.Errorf("gas limit set by user is too low to pay for execution and l1 fees. Want at least: %d have: %d", l1Gas, msg.GasLimit)
}
msg.GasLimit -= l1Gas.Uint64()

Expand Down
3 changes: 3 additions & 0 deletions go/obsclient/authclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ func (ac *AuthObsClient) EstimateGasAndGasPrice(txData types.TxData) types.TxDat

gasPrice, err := ac.GasPrice(context.Background())
if err != nil {
// params.InitialBaseFee should be the new standard gas price.
// If the gas price is too low, then the gas required to be put in a transaction
// becomes astronomical.
gasPrice = big.NewInt(params.InitialBaseFee)
}

Expand Down
2 changes: 1 addition & 1 deletion integration/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func DefaultEnclaveConfig() *config.EnclaveConfig {
EdgelessDBHost: "",
SqliteDBPath: "",
ProfilerEnabled: false,
MinGasPrice: big.NewInt(1),
MinGasPrice: big.NewInt(params.InitialBaseFee),
SequencerID: gethcommon.BytesToAddress([]byte("")),
ObscuroGenesis: "",
DebugNamespaceEnabled: false,
Expand Down

0 comments on commit b952cdf

Please sign in to comment.