diff --git a/go/enclave/nodetype/sequencer.go b/go/enclave/nodetype/sequencer.go index 815fa6772f..0d69fc6986 100644 --- a/go/enclave/nodetype/sequencer.go +++ b/go/enclave/nodetype/sequencer.go @@ -141,7 +141,7 @@ func (s *sequencer) createGenesisBatch(block *common.L1Block) error { // this is the actual first block produced in chain err = s.blockchain.IngestNewBlock(batch) if err != nil { - return fmt.Errorf("unable to remove ingest new block into eth blockchain - %w", err) + return fmt.Errorf("failed to feed batch into the virtual eth chain - %w", err) } // the mempool can only be started after at least 1 block is in the blockchain object @@ -283,7 +283,7 @@ func (s *sequencer) produceBatch( // add the batch to the chain so it can remove pending transactions from the pool err = s.blockchain.IngestNewBlock(cb.Batch) if err != nil { - return nil, fmt.Errorf("unable to remove tx from mempool - %w", err) + return nil, fmt.Errorf("failed to feed batch into the virtual eth chain - %w", err) } return cb, nil diff --git a/go/enclave/nodetype/validator.go b/go/enclave/nodetype/validator.go index f35013cad4..8aaf80a167 100644 --- a/go/enclave/nodetype/validator.go +++ b/go/enclave/nodetype/validator.go @@ -112,6 +112,10 @@ func (val *obsValidator) ExecuteStoredBatches() error { if err != nil { return fmt.Errorf("could not store executed batch %s. Cause: %w", batch.Hash(), err) } + err = val.mempool.Chain.IngestNewBlock(batch) + if err != nil { + return fmt.Errorf("failed to feed batch into the virtual eth chain- %w", err) + } val.batchRegistry.OnBatchExecuted(batch, receipts) } } diff --git a/go/enclave/txpool/txpool.go b/go/enclave/txpool/txpool.go index 0ef7f854a2..d03b9ce782 100644 --- a/go/enclave/txpool/txpool.go +++ b/go/enclave/txpool/txpool.go @@ -26,7 +26,7 @@ type TxPool struct { txPoolConfig legacypool.Config legacyPool *legacypool.LegacyPool pool *gethtxpool.TxPool - blockchain *ethchainadapter.EthChainAdapter + Chain *ethchainadapter.EthChainAdapter gasTip *big.Int running bool stateMutex sync.Mutex @@ -39,7 +39,7 @@ func NewTxPool(blockchain *ethchainadapter.EthChainAdapter, gasTip *big.Int, log legacyPool := legacypool.New(txPoolConfig, blockchain) return &TxPool{ - blockchain: blockchain, + Chain: blockchain, txPoolConfig: txPoolConfig, legacyPool: legacyPool, gasTip: gasTip, @@ -55,7 +55,7 @@ func (t *TxPool) Start() error { return fmt.Errorf("tx pool already started") } - memp, err := gethtxpool.New(t.gasTip, t.blockchain, []gethtxpool.SubPool{t.legacyPool}) + memp, err := gethtxpool.New(t.gasTip, t.Chain, []gethtxpool.SubPool{t.legacyPool}) if err != nil { return fmt.Errorf("unable to init geth tx pool - %w", err) } @@ -88,9 +88,11 @@ func (t *TxPool) Add(transaction *common.L2Tx) error { //go:linkname validateTxBasics github.com/ethereum/go-ethereum/core/txpool/legacypool.(*LegacyPool).validateTxBasics func validateTxBasics(_ *legacypool.LegacyPool, _ *types.Transaction, _ bool) error +//go:linkname validateTx github.com/ethereum/go-ethereum/core/txpool/legacypool.(*LegacyPool).validateTx +func validateTx(_ *legacypool.LegacyPool, _ *types.Transaction, _ bool) error + // Validate - run the underlying tx pool validation logic func (t *TxPool) Validate(tx *common.L2Tx) error { -<<<<<<< HEAD // validate against the consensus rules err := validateTxBasics(t.legacyPool, tx, false) if err != nil { @@ -101,9 +103,6 @@ func (t *TxPool) Validate(tx *common.L2Tx) error { defer t.stateMutex.Unlock() // validate against the state. Things like nonce, balance, etc return validateTx(t.legacyPool, tx, false) -======= - return validateTxBasics(t.legacyPool, tx, false) ->>>>>>> parent of 3a74586b (change mempool validation function (#1800)) } func (t *TxPool) Running() bool { diff --git a/integration/common/utils.go b/integration/common/utils.go index a0a6c43f8c..f0ff1839ad 100644 --- a/integration/common/utils.go +++ b/integration/common/utils.go @@ -99,6 +99,7 @@ func PrefundWallets(ctx context.Context, faucetWallet wallet.Wallet, faucetClien txHashes := make([]gethcommon.Hash, len(wallets)) for idx, w := range wallets { destAddr := w.Address() + fmt.Printf("L2 prefund: %s\n", destAddr.Hex()) txData := &types.LegacyTx{ Nonce: startingNonce + uint64(idx), Value: alloc, diff --git a/integration/constants.go b/integration/constants.go index fe4ce15bc8..3d0062700a 100644 --- a/integration/constants.go +++ b/integration/constants.go @@ -3,7 +3,9 @@ package integration // Tracks the start ports handed out to different tests, in a bid to minimise conflicts. const ( StartPortEth2NetworkTests = 10000 + StartPortTenscanUnitTest = 12000 StartPortNodeRunnerTest = 14000 + StartPortTenGatewayUnitTest = 16000 StartPortSimulationGethInMem = 18000 StartPortSimulationInMem = 22000 StartPortSimulationFullNetwork = 26000 @@ -13,8 +15,6 @@ const ( StartPortWalletExtensionUnitTest = 38000 StartPortFaucetUnitTest = 42000 StartPortFaucetHTTPUnitTest = 48000 - StartPortTenscanUnitTest = 52000 - StartPortTenGatewayUnitTest = 56000 DefaultGethWSPortOffset = 100 DefaultGethAUTHPortOffset = 200 diff --git a/integration/simulation/simulation.go b/integration/simulation/simulation.go index 1e24750bab..6576e94dec 100644 --- a/integration/simulation/simulation.go +++ b/integration/simulation/simulation.go @@ -61,9 +61,12 @@ func (s *Simulation) Start() { s.bridgeFundingToObscuro() s.trackLogs() // Create log subscriptions, to validate that they're working correctly later. s.prefundObscuroAccounts() // Prefund every L2 wallet - s.deployObscuroERC20s() // Deploy the Obscuro HOC and POC ERC20 contracts - s.prefundL1Accounts() // Prefund every L1 wallet - s.checkHealthStatus() // Checks the nodes health status + + // wait for the validator to become up to date + time.Sleep(1 * time.Second) + s.deployObscuroERC20s() // Deploy the Obscuro HOC and POC ERC20 contracts + s.prefundL1Accounts() // Prefund every L1 wallet + s.checkHealthStatus() // Checks the nodes health status timer := time.Now() fmt.Printf("Starting injection\n") @@ -229,6 +232,7 @@ func (s *Simulation) deployObscuroERC20s() { // 0x526c84529b2b8c11f57d93d3f5537aca3aecef9b - this is the address of the L2 contract which is currently hardcoded. contractBytes := erc20contract.L2BytecodeWithDefaultSupply(string(token), gethcommon.HexToAddress("0x526c84529b2b8c11f57d93d3f5537aca3aecef9b")) + fmt.Printf("Deploy contract from: %s\n", owner.Address().Hex()) deployContractTxData := types.DynamicFeeTx{ Nonce: NextNonce(s.ctx, s.RPCHandles, owner), Gas: 5_000_000, @@ -243,12 +247,13 @@ func (s *Simulation) deployObscuroERC20s() { panic(err) } - err = s.RPCHandles.ObscuroWalletRndClient(owner).SendTransaction(s.ctx, signedTx) + rpc := s.RPCHandles.ObscuroWalletClient(owner.Address(), 1) + err = rpc.SendTransaction(s.ctx, signedTx) if err != nil { panic(err) } - err = testcommon.AwaitReceipt(s.ctx, s.RPCHandles.ObscuroWalletRndClient(owner), signedTx.Hash(), s.Params.ReceiptTimeout) + err = testcommon.AwaitReceipt(s.ctx, rpc, signedTx.Hash(), s.Params.ReceiptTimeout) if err != nil { panic(fmt.Sprintf("ERC20 deployment transaction unsuccessful. Cause: %s", err)) }