-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validator nodes return error on tx submission #1792
Changes from all commits
389fcd5
4cd8dd5
fdb8097
9ca6b7d
7342f61
0a1ae98
ec074d9
c8e9932
61c14d5
6c870d5
4fc6f2d
28ddf00
9216dfb
e43a8a3
2016e42
cc98174
6c2e432
52526c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,7 +213,7 @@ func NewEnclave( | |
blockchain, | ||
) | ||
} else { | ||
service = nodetype.NewValidator(blockProcessor, batchExecutor, registry, rConsumer, chainConfig, config.SequencerID, storage, sigVerifier, logger) | ||
service = nodetype.NewValidator(blockProcessor, batchExecutor, registry, rConsumer, chainConfig, config.SequencerID, storage, sigVerifier, mempool, logger) | ||
} | ||
|
||
chain := l2chain.NewChain( | ||
|
@@ -473,9 +473,17 @@ func (e *enclaveImpl) SubmitBatch(extBatch *common.ExtBatch) common.SystemError | |
return responses.ToInternalError(fmt.Errorf("requested SubmitBatch with the enclave stopping")) | ||
} | ||
|
||
core.LogMethodDuration(e.logger, measure.NewStopwatch(), "SubmitBatch call completed.", log.BatchHashKey, extBatch.Hash()) | ||
defer core.LogMethodDuration(e.logger, measure.NewStopwatch(), "SubmitBatch call completed.", log.BatchHashKey, extBatch.Hash()) | ||
|
||
e.logger.Info("Received new p2p batch", log.BatchHeightKey, extBatch.Header.Number, log.BatchHashKey, extBatch.Hash(), "l1", extBatch.Header.L1Proof) | ||
seqNo := extBatch.Header.SequencerOrderNo.Uint64() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect this is a source of flakyness. |
||
if seqNo > common.L2GenesisSeqNo+1 { | ||
_, err := e.storage.FetchBatchBySeqNo(seqNo - 1) | ||
if err != nil { | ||
return responses.ToInternalError(fmt.Errorf("could not find previous batch with seq: %d", seqNo-1)) | ||
} | ||
} | ||
|
||
batch, err := core.ToBatch(extBatch, e.dataEncryptionService, e.dataCompressionService) | ||
if err != nil { | ||
return responses.ToInternalError(fmt.Errorf("could not convert batch. Cause: %w", err)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ import ( | |
"math/big" | ||
"strings" | ||
|
||
// unsafe package imported in order to link to a private function in go-ethereum. | ||
// This allows us to validate transactions against the tx pool rules. | ||
_ "unsafe" | ||
|
||
gethlog "github.com/ethereum/go-ethereum/log" | ||
"github.com/ten-protocol/go-ten/go/common/log" | ||
|
||
|
@@ -78,6 +82,14 @@ func (t *TxPool) Add(transaction *common.L2Tx) error { | |
return nil | ||
} | ||
|
||
//go:linkname validateTxBasics github.com/ethereum/go-ethereum/core/txpool/legacypool.(*LegacyPool).validateTxBasics | ||
func validateTxBasics(_ *legacypool.LegacyPool, _ *types.Transaction, _ bool) error | ||
|
||
// Validate - run the underlying tx pool validation logic | ||
func (t *TxPool) Validate(tx *common.L2Tx) error { | ||
return validateTxBasics(t.legacyPool, tx, false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will be hacky no matter how we do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah fair enough. Not seen the |
||
} | ||
|
||
func (t *TxPool) Running() bool { | ||
return t.running | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ const ( | |
StartPortSimulationInMem = 22000 | ||
StartPortSimulationFullNetwork = 26000 | ||
StartPortSmartContractTests = 30000 | ||
StartPortContractDeployerTest = 34000 | ||
StartPortContractDeployerTest1 = 34000 | ||
StartPortContractDeployerTest2 = 35000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anixon604 spotted this issue. We used the same port in 2 test in the same file. Would fail if tests run in parallel |
||
StartPortWalletExtensionUnitTest = 38000 | ||
StartPortFaucetUnitTest = 42000 | ||
StartPortFaucetHTTPUnitTest = 48000 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package eth2network | |
import ( | ||
"context" | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
"io" | ||
"net/http" | ||
|
@@ -245,7 +246,7 @@ func (n *Impl) Start() error { | |
for i := range n.dataDirs { | ||
nodeID := i | ||
eg.Go(func() error { | ||
return n.waitForNodeUp(nodeID, 30*time.Second) | ||
return n.waitForNodeUp(nodeID, time.Minute) | ||
}) | ||
} | ||
err = eg.Wait() | ||
|
@@ -321,22 +322,36 @@ func (n *Impl) Start() error { | |
// Stop stops the network | ||
func (n *Impl) Stop() error { | ||
for i := 0; i < len(n.dataDirs); i++ { | ||
err := n.gethProcesses[i].Process.Kill() | ||
err := kill(n.gethProcesses[i].Process, 0) | ||
if err != nil { | ||
fmt.Printf("unable to kill geth node - %s\n", err.Error()) | ||
return err | ||
} | ||
err = n.prysmBeaconProcesses[i].Process.Kill() | ||
err = kill(n.prysmBeaconProcesses[i].Process, 0) | ||
if err != nil { | ||
fmt.Printf("unable to kill prysm beacon node - %s\n", err.Error()) | ||
return err | ||
} | ||
err = n.prysmValidatorProcesses[i].Process.Kill() | ||
err = kill(n.prysmValidatorProcesses[i].Process, 0) | ||
if err != nil { | ||
fmt.Printf("unable to kill prysm validator node - %s\n", err.Error()) | ||
return err | ||
} | ||
} | ||
// wait a second for the kill signal | ||
time.Sleep(time.Second) | ||
return nil | ||
} | ||
|
||
const maxTryKill = 5 | ||
|
||
func kill(p *os.Process, cnt int) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to make the kill a bit more robust. |
||
if killErr := p.Kill(); killErr == nil { | ||
return nil | ||
} else if !errors.Is(killErr, os.ErrProcessDone) { | ||
if cnt >= maxTryKill { | ||
return killErr | ||
} | ||
time.Sleep(time.Second) | ||
return kill(p, cnt+1) | ||
} | ||
return nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is from @anixon604's branch.
It doesn't seem to do anything. Leaving it in , and it will be overridden when he merges