Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ten-protocol/go-ten into wi…
Browse files Browse the repository at this point in the history
…llh/enclave-api-get-batch-start-seq
  • Loading branch information
badgersrus committed Feb 28, 2024
2 parents 17709ec + 17b6298 commit da3be6e
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 21 deletions.
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
---
# Ten Testnet Change Log

# Feb 2024-02-27 (v0.23.0)
* An upgrade release to fix issues in the batch limit size which can stop deployment of some large contracts, and to
over-estimate the L1 gas cost to ensure it is possible to submit a transaction for rollup.
* A full list of the PRs merged in this release is as below;
* `21860c19` Overestimate L1 gas costs (#1821)
* `5e057c69` Switch primary and secondary fonts on gateway and tenscan (#1819)
* `d43ae52c` Batch limit: increase max to 36kb (#1817)
* `33d3de82` Network test: local network qol (#1818)
* `b7bea2c4` Fix mutex error (#1810)
* `25f4f5b6` Networktests: add options for test users to use gateway (#1806

# Feb 2024-02-20 (v0.22.0)
* Validator nodes now return errors on transaction submission. Previously, transactions that would fail validation were
accepted into the mempool of the validator without error (e.g. insufficient funds for a transfer, gas below the
Expand Down
2 changes: 1 addition & 1 deletion go/config/enclave_cli_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var EnclaveFlags = map[string]*flag.TenFlag{
MinGasPriceFlag: flag.NewInt64Flag(MinGasPriceFlag, 1, "The minimum gas price for mining a transaction"),
MessageBusAddressFlag: flag.NewStringFlag(MessageBusAddressFlag, "", "The address of the L1 message bus contract owned by the management contract."),
SequencerIDFlag: flag.NewStringFlag(SequencerIDFlag, "", "The 20 bytes of the address of the sequencer for this network"),
MaxBatchSizeFlag: flag.NewUint64Flag(MaxBatchSizeFlag, 1024*32, "The maximum size a batch is allowed to reach uncompressed"),
MaxBatchSizeFlag: flag.NewUint64Flag(MaxBatchSizeFlag, 1024*36, "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, params.InitialBaseFee, ""),
L2CoinbaseFlag: flag.NewStringFlag(L2CoinbaseFlag, "0xd6C9230053f45F873Cb66D8A02439380a37A4fbF", ""),
Expand Down
5 changes: 5 additions & 0 deletions go/enclave/rpc/EstimateGas.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func EstimateGasExecute(builder *CallBuilder[CallParamsWithBlock, hexutil.Uint64
// where BaseFee is bigger than the l1cost.
publishingGas = big.NewInt(0).Add(publishingGas, gethcommon.Big1)

// Overestimate the publishing cost in case of spikes.
// Batch execution still deducts normally.
// TODO: Change to fixed time period quotes, rather than this.
publishingGas = publishingGas.Mul(publishingGas, gethcommon.Big2)

executionGasEstimate, err := rpc.doEstimateGas(txArgs, blockNumber, rpc.config.GasLocalExecutionCapFlag)
if err != nil {
err = fmt.Errorf("unable to estimate transaction - %w", err)
Expand Down
2 changes: 1 addition & 1 deletion go/node/docker_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (d *DockerNode) startEnclave() error {
"-logPath", "sys_out",
"-logLevel", fmt.Sprintf("%d", log.LvlInfo),
fmt.Sprintf("-debugNamespaceEnabled=%t", d.cfg.debugNamespaceEnabled),
"-maxBatchSize=32768",
"-maxBatchSize=36864",
"-maxRollupSize=65536",
fmt.Sprintf("-logLevel=%d", d.cfg.logLevel),
"-obscuroGenesis", "{}",
Expand Down
2 changes: 1 addition & 1 deletion integration/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func DefaultEnclaveConfig() *config.EnclaveConfig {
SequencerID: gethcommon.BytesToAddress([]byte("")),
ObscuroGenesis: "",
DebugNamespaceEnabled: false,
MaxBatchSize: 1024 * 32,
MaxBatchSize: 1024 * 36,
MaxRollupSize: 1024 * 64,
GasPaymentAddress: gethcommon.HexToAddress("0xd6C9230053f45F873Cb66D8A02439380a37A4fbF"),
BaseFee: new(big.Int).SetUint64(params.InitialBaseFee),
Expand Down
20 changes: 15 additions & 5 deletions integration/networktest/actions/setup_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"

"github.com/ethereum/go-ethereum/common"
"github.com/ten-protocol/go-ten/integration"
"github.com/ten-protocol/go-ten/integration/common/testlog"
"github.com/ten-protocol/go-ten/integration/datagenerator"
Expand Down Expand Up @@ -45,20 +46,29 @@ func (c *CreateTestUser) Verify(_ context.Context, _ networktest.NetworkConnecto
return nil
}

// AllocateFaucetFunds is an action that allocates funds from the network faucet to a user,
// either UserID or Account must be set (not both) to fund a test user or a specific account respectively
type AllocateFaucetFunds struct {
UserID int
UserID int
Account *common.Address
}

func (a *AllocateFaucetFunds) String() string {
return fmt.Sprintf("AllocateFaucetFunds [user: %d]", a.UserID)
}

func (a *AllocateFaucetFunds) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error) {
user, err := FetchTestUser(ctx, a.UserID)
if err != nil {
return ctx, err
var acc common.Address
if a.Account != nil {
acc = *a.Account
} else {
user, err := FetchTestUser(ctx, a.UserID)
if err != nil {
return ctx, err
}
acc = user.Wallet().Address()
}
return ctx, network.AllocateFaucetFunds(ctx, user.Wallet().Address())
return ctx, network.AllocateFaucetFunds(ctx, acc)
}

func (a *AllocateFaucetFunds) Verify(_ context.Context, _ networktest.NetworkConnector) error {
Expand Down
4 changes: 2 additions & 2 deletions integration/networktest/env/network_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func DevTestnet() networktest.Environment {
// LongRunningLocalNetwork is a local network, the l1WSURL is optional (can be empty string), only required if testing L1 interactions
func LongRunningLocalNetwork(l1WSURL string) networktest.Environment {
connector := NewTestnetConnectorWithFaucetAccount(
"ws://127.0.0.1:37900",
[]string{"ws://127.0.0.1:37901"},
"ws://127.0.0.1:26900",
[]string{"ws://127.0.0.1:26901"},
genesis.TestnetPrefundedPK,
l1WSURL,
"",
Expand Down
2 changes: 1 addition & 1 deletion integration/networktest/env/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/ten-protocol/go-ten/integration/networktest"
)

var _defaultFaucetAmount = big.NewInt(750_000_000_000_000)
var _defaultFaucetAmount = big.NewInt(5_000_000_000_000_000)

type testnetConnector struct {
seqRPCAddress string
Expand Down
23 changes: 23 additions & 0 deletions integration/networktest/tests/helpful/accs_and_contracts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package helpful

import (
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ten-protocol/go-ten/integration/networktest"
"github.com/ten-protocol/go-ten/integration/networktest/actions"
"github.com/ten-protocol/go-ten/integration/networktest/env"
)

var _accountToFund = common.HexToAddress("0xD19f62b5A721747A04b969C90062CBb85D4aAaA8")

// Run this test to fund an account with native funds
func TestSendFaucetFunds(t *testing.T) {
networktest.TestOnlyRunsInIDE(t)
networktest.Run(
"send-faucet-funds",
t,
env.LongRunningLocalNetwork(""),
&actions.AllocateFaucetFunds{Account: &_accountToFund},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
func TestRunLocalNetwork(t *testing.T) {
networktest.TestOnlyRunsInIDE(t)
networktest.EnsureTestLogsSetUp("local-geth-network")
networkConnector, cleanUp, err := env.LocalDevNetwork().Prepare()
networkConnector, cleanUp, err := env.LocalDevNetwork(env.WithTenGateway()).Prepare()
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -80,12 +80,19 @@ func checkBalance(walDesc string, wal wallet.Wallet, rpcAddress string) {
}

func keepRunning(networkConnector networktest.NetworkConnector) {
gatewayURL, err := networkConnector.GetGatewayURL()
hasGateway := err == nil

fmt.Println("----")
fmt.Println("Sequencer RPC", networkConnector.SequencerRPCAddress())
for i := 0; i < networkConnector.NumValidators(); i++ {
fmt.Println("Validator ", i, networkConnector.ValidatorRPCAddress(i))
}
if hasGateway {
fmt.Println("Gateway ", gatewayURL)
}
fmt.Println("----")

done := make(chan os.Signal, 1)
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
fmt.Println("Network running until test is stopped...")
Expand Down
1 change: 1 addition & 0 deletions integration/networktest/userwallet/authclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (s *AuthClientUser) SendFunds(ctx context.Context, addr gethcommon.Address,
}

txData := &types.LegacyTx{
Nonce: s.wal.GetNonce(),
Value: value,
To: &addr,
}
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/devnetwork/dev_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (s *InMemDevNetwork) startTenGateway() {
}
tenGWContainer := container.NewWalletExtensionContainerFromConfig(cfg, s.logger)
go func() {
fmt.Println("Starting Ten Gateway")
fmt.Println("Starting Ten Gateway, HTTP Port:", _gwHTTPPort, "WS Port:", _gwWSPort)
err := tenGWContainer.Start()
if err != nil {
s.logger.Error("failed to start ten gateway", "err", err)
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/devnetwork/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (n *InMemNodeOperator) createEnclaveContainer() *enclavecontainer.EnclaveCo
MessageBusAddress: n.l1Data.MessageBusAddr,
SqliteDBPath: n.enclaveDBFilepath,
DebugNamespaceEnabled: true,
MaxBatchSize: 1024 * 32,
MaxBatchSize: 1024 * 36,
MaxRollupSize: 1024 * 64,
BaseFee: defaultCfg.BaseFee, // todo @siliev:: fix test transaction builders so this can be different
GasBatchExecutionLimit: defaultCfg.GasBatchExecutionLimit,
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/network/network_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func createInMemObscuroNode(
MinGasPrice: gethcommon.Big1,
MessageBusAddress: l1BusAddress,
ManagementContractAddress: *mgtContractAddress,
MaxBatchSize: 1024 * 32,
MaxBatchSize: 1024 * 36,
MaxRollupSize: 1024 * 64,
BaseFee: big.NewInt(1), // todo @siliev:: fix test transaction builders so this can be different
GasLocalExecutionCapFlag: params.MaxGasLimit / 2,
Expand Down
6 changes: 3 additions & 3 deletions tools/tenscan/frontend/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@
}

html {
font-family: "DMSans", sans-serif;
font-family: "Quicksand", sans-serif;
}

body {
@apply bg-background text-foreground;
font-feature-settings: "rlig" 1, "calt" 1;
font-family: "DMSans", sans-serif;
font-family: "Quicksand", sans-serif;
}

h1,
Expand All @@ -107,7 +107,7 @@
h5,
h6 {
font-weight: 500;
font-family: "Quicksand", cursive;
font-family: "DMSans", sans-serif;
}

/* styles for docs */
Expand Down
6 changes: 3 additions & 3 deletions tools/walletextension/frontend/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
}

html {
font-family: "DMSans", sans-serif;
font-family: "Quicksand", sans-serif;
}

body {
@apply bg-background text-foreground;
font-feature-settings: "rlig" 1, "calt" 1;
font-family: "DMSans", sans-serif;
font-family: "Quicksand", sans-serif;
}

h1,
Expand All @@ -27,7 +27,7 @@
h5,
h6 {
font-weight: 500;
font-family: "Quicksand", sans-serif;
font-family: "DMSans", sans-serif;
}

:root {
Expand Down

0 comments on commit da3be6e

Please sign in to comment.