From 33d3de82c8e51eca4dc1dff7685afc167365ae61 Mon Sep 17 00:00:00 2001 From: Matt <98158711+BedrockSquirrel@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:24:51 +0000 Subject: [PATCH 1/5] Network test: local network QoL (#1818) --- .../networktest/actions/setup_actions.go | 20 ++++++++++++---- integration/networktest/env/network_setup.go | 4 ++-- integration/networktest/env/testnet.go | 2 +- .../tests/helpful/accs_and_contracts_test.go | 23 +++++++++++++++++++ .../helpful/spin_up_local_network_test.go | 9 +++++++- .../networktest/userwallet/authclient.go | 1 + .../simulation/devnetwork/dev_network.go | 2 +- 7 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 integration/networktest/tests/helpful/accs_and_contracts_test.go diff --git a/integration/networktest/actions/setup_actions.go b/integration/networktest/actions/setup_actions.go index 2fa447306a..a6a6f02556 100644 --- a/integration/networktest/actions/setup_actions.go +++ b/integration/networktest/actions/setup_actions.go @@ -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" @@ -45,8 +46,11 @@ 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 { @@ -54,11 +58,17 @@ func (a *AllocateFaucetFunds) String() string { } 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 { diff --git a/integration/networktest/env/network_setup.go b/integration/networktest/env/network_setup.go index 507700b461..cdbd7c81ab 100644 --- a/integration/networktest/env/network_setup.go +++ b/integration/networktest/env/network_setup.go @@ -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, "", diff --git a/integration/networktest/env/testnet.go b/integration/networktest/env/testnet.go index 103defc574..a1240b3bd8 100644 --- a/integration/networktest/env/testnet.go +++ b/integration/networktest/env/testnet.go @@ -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 diff --git a/integration/networktest/tests/helpful/accs_and_contracts_test.go b/integration/networktest/tests/helpful/accs_and_contracts_test.go new file mode 100644 index 0000000000..9b6673bfe9 --- /dev/null +++ b/integration/networktest/tests/helpful/accs_and_contracts_test.go @@ -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}, + ) +} diff --git a/integration/networktest/tests/helpful/spin_up_local_network_test.go b/integration/networktest/tests/helpful/spin_up_local_network_test.go index 83a5f4888c..526fdda702 100644 --- a/integration/networktest/tests/helpful/spin_up_local_network_test.go +++ b/integration/networktest/tests/helpful/spin_up_local_network_test.go @@ -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) } @@ -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...") diff --git a/integration/networktest/userwallet/authclient.go b/integration/networktest/userwallet/authclient.go index 7402bb3097..3a22bfa763 100644 --- a/integration/networktest/userwallet/authclient.go +++ b/integration/networktest/userwallet/authclient.go @@ -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, } diff --git a/integration/simulation/devnetwork/dev_network.go b/integration/simulation/devnetwork/dev_network.go index cbf1af8a76..2d1bc96884 100644 --- a/integration/simulation/devnetwork/dev_network.go +++ b/integration/simulation/devnetwork/dev_network.go @@ -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) From d43ae52ce11f136cb3535895ef9235ab5b01c6f4 Mon Sep 17 00:00:00 2001 From: Matt <98158711+BedrockSquirrel@users.noreply.github.com> Date: Tue, 27 Feb 2024 12:15:16 +0000 Subject: [PATCH 2/5] Batch limit: increase max to 36kb (#1817) --- go/config/enclave_cli_flags.go | 2 +- go/node/docker_node.go | 2 +- integration/common/constants.go | 2 +- integration/simulation/devnetwork/node.go | 2 +- integration/simulation/network/network_utils.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go/config/enclave_cli_flags.go b/go/config/enclave_cli_flags.go index 202b8b9ae5..0633920f80 100644 --- a/go/config/enclave_cli_flags.go +++ b/go/config/enclave_cli_flags.go @@ -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", ""), diff --git a/go/node/docker_node.go b/go/node/docker_node.go index 525517711f..7ce9cc5ec9 100644 --- a/go/node/docker_node.go +++ b/go/node/docker_node.go @@ -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", "{}", diff --git a/integration/common/constants.go b/integration/common/constants.go index c0efda30a0..c96503d3bc 100644 --- a/integration/common/constants.go +++ b/integration/common/constants.go @@ -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), diff --git a/integration/simulation/devnetwork/node.go b/integration/simulation/devnetwork/node.go index 493ea6a415..dbb0fba254 100644 --- a/integration/simulation/devnetwork/node.go +++ b/integration/simulation/devnetwork/node.go @@ -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, diff --git a/integration/simulation/network/network_utils.go b/integration/simulation/network/network_utils.go index 6e758ed85d..e5c8953d46 100644 --- a/integration/simulation/network/network_utils.go +++ b/integration/simulation/network/network_utils.go @@ -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, From 5e057c69687c139d9cc78228accf004d2ed8d119 Mon Sep 17 00:00:00 2001 From: Jennifer Echenim Date: Tue, 27 Feb 2024 13:49:21 +0100 Subject: [PATCH 3/5] Jennifer/3015 switch primary and secondary fonts on gateway and tenscan (#1819) * Update font-family --- tools/tenscan/frontend/styles/globals.css | 6 +++--- tools/walletextension/frontend/src/styles/globals.css | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/tenscan/frontend/styles/globals.css b/tools/tenscan/frontend/styles/globals.css index 5e03f76d5f..79c3d941e9 100644 --- a/tools/tenscan/frontend/styles/globals.css +++ b/tools/tenscan/frontend/styles/globals.css @@ -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, @@ -107,7 +107,7 @@ h5, h6 { font-weight: 500; - font-family: "Quicksand", cursive; + font-family: "DMSans", sans-serif; } /* styles for docs */ diff --git a/tools/walletextension/frontend/src/styles/globals.css b/tools/walletextension/frontend/src/styles/globals.css index 2906ab7bef..441012a02f 100644 --- a/tools/walletextension/frontend/src/styles/globals.css +++ b/tools/walletextension/frontend/src/styles/globals.css @@ -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, @@ -27,7 +27,7 @@ h5, h6 { font-weight: 500; - font-family: "Quicksand", sans-serif; + font-family: "DMSans", sans-serif; } :root { From 21860c193c0807a944eb0f8360e70e150b85c4a7 Mon Sep 17 00:00:00 2001 From: Stefan Iliev <46542846+StefanIliev545@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:38:31 +0200 Subject: [PATCH 4/5] Overestimate. (#1821) Co-authored-by: StefanIliev545 --- go/enclave/rpc/EstimateGas.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go/enclave/rpc/EstimateGas.go b/go/enclave/rpc/EstimateGas.go index c0821c4874..20708601d0 100644 --- a/go/enclave/rpc/EstimateGas.go +++ b/go/enclave/rpc/EstimateGas.go @@ -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) From 17b6298fb390c9c1578baaff0e55264272ff1b93 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Tue, 27 Feb 2024 16:12:17 +0000 Subject: [PATCH 5/5] Change log (#1822) --- changelog.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/changelog.md b/changelog.md index a0a22360fd..5636fdeacc 100644 --- a/changelog.md +++ b/changelog.md @@ -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