diff --git a/README.md b/README.md index 0f5ce6b35..6509b245a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Quorum -Quorum Slack +Quorum Slack Quorum is an Ethereum-based distributed ledger protocol with transaction/contract privacy and new consensus mechanisms. @@ -128,6 +128,7 @@ Further documentation can be found in the [docs](docs/) folder and on the [wiki] * [quorum-examples](https://github.com/jpmorganchase/quorum-examples): example quorum clusters * [quorum-tools](https://github.com/jpmorganchase/quorum-tools): local cluster orchestration, and integration testing tool * [Quorum Wiki](https://github.com/jpmorganchase/quorum/wiki) +* [Quorum Community Slack Inviter](https://clh7rniov2.execute-api.us-east-1.amazonaws.com/Express/): Quorum Slack community entry point ## Third Party Tools/Libraries diff --git a/core/tx_pool.go b/core/tx_pool.go index 2ebc03532..55c7405af 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -220,7 +220,7 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block config: config, chainconfig: chainconfig, chain: chain, - signer: types.MakeSigner(chainconfig, new(big.Int)), + signer: types.NewEIP155Signer(chainconfig.ChainId), pending: make(map[common.Address]*txList), queue: make(map[common.Address]*txList), beats: make(map[common.Address]time.Time), diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index fa8e36799..84c5dc617 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -32,6 +32,7 @@ import ( "time" "io/ioutil" "os" + "reflect" ) // testTxPoolConfig is a transaction pool configuration without stateful disk @@ -1522,3 +1523,48 @@ func benchmarkPoolBatchInsert(b *testing.B, size int) { pool.AddRemotes(batch) } } + +//Checks that the EIP155 signer is assigned to the TxPool no matter the configuration, even invalid config +func TestEIP155SignerOnTxPool(t *testing.T) { + var flagtests = []struct { + name string + homesteadBlock *big.Int + eip155Block *big.Int + }{ + {"hsnileip155nil", nil, nil}, + {"hsnileip1550", nil, big.NewInt(0)}, + {"hsnileip155100", nil, big.NewInt(100)}, + {"hs0eip155nil", big.NewInt(0), nil}, + {"hs0eip1550", big.NewInt(0), big.NewInt(0)}, + {"hs0eip155100", big.NewInt(0), big.NewInt(100)}, + {"hs100eip155nil", big.NewInt(100), nil}, + {"hs100eip1550", big.NewInt(100), big.NewInt(0)}, + {"hs100eip155100", big.NewInt(100), big.NewInt(100)}, + } + + for _, tt := range flagtests { + t.Run("", func(t *testing.T) { + db, _ := ethdb.NewMemDatabase() + statedb, _ := state.New(common.Hash{}, state.NewDatabase(db)) + blockchain := &testBlockChain{statedb, big.NewInt(1000000), new(event.Feed)} + + chainconfig := ¶ms.ChainConfig{ + ChainId: big.NewInt(10), + HomesteadBlock: tt.homesteadBlock, + EIP150Block: big.NewInt(0), + EIP155Block: tt.eip155Block, + EIP158Block: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + Ethash: new(params.EthashConfig), + } + + pool := NewTxPool(testTxPoolConfig, chainconfig, blockchain) + + if reflect.TypeOf(types.EIP155Signer{}) != reflect.TypeOf(pool.signer) { + t.Fail() + } + }) + } + +} + diff --git a/miner/worker.go b/miner/worker.go index 4a86f4a38..1310dd1a0 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -566,7 +566,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB from, _ := types.Sender(env.signer, tx) // Check whether the tx is replay protected. If we're not in the EIP155 hf // phase, start ignoring the sender until we do. - if tx.Protected() && !env.config.IsEIP155(env.header.Number) { + if tx.Protected() && !env.config.IsEIP155(env.header.Number) && !tx.IsPrivate() { log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", env.config.EIP155Block) txs.Pop() diff --git a/private/constellation/constellation.go b/private/constellation/constellation.go index 570a92de7..69afcde68 100644 --- a/private/constellation/constellation.go +++ b/private/constellation/constellation.go @@ -1,19 +1,30 @@ package constellation import ( + "errors" "fmt" - "github.com/patrickmn/go-cache" "os" "path/filepath" + "strings" "time" + + "github.com/patrickmn/go-cache" ) type Constellation struct { - node *Client - c *cache.Cache + node *Client + c *cache.Cache + isConstellationNotInUse bool } +var ( + ErrConstellationIsntInit = errors.New("Constellation not in use") +) + func (g *Constellation) Send(data []byte, from string, to []string) (out []byte, err error) { + if g.isConstellationNotInUse { + return nil, ErrConstellationIsntInit + } out, err = g.node.SendPayload(data, from, to) if err != nil { return nil, err @@ -23,6 +34,9 @@ func (g *Constellation) Send(data []byte, from string, to []string) (out []byte, } func (g *Constellation) Receive(data []byte) ([]byte, error) { + if g.isConstellationNotInUse { + return nil, nil + } if len(data) == 0 { return data, nil } @@ -47,7 +61,7 @@ func New(path string) (*Constellation, error) { } // We accept either the socket or a configuration file that points to // a socket. - isSocket := info.Mode() & os.ModeSocket != 0 + isSocket := info.Mode()&os.ModeSocket != 0 if !isSocket { cfg, err := LoadConfig(path) if err != nil { @@ -66,10 +80,18 @@ func New(path string) (*Constellation, error) { return &Constellation{ node: n, c: cache.New(5*time.Minute, 5*time.Minute), + isConstellationNotInUse: false, }, nil } func MustNew(path string) *Constellation { + if strings.EqualFold(path, "ignore") { + return &Constellation{ + node: nil, + c: nil, + isConstellationNotInUse: true, + } + } g, err := New(path) if err != nil { panic(fmt.Sprintf("MustNew: Failed to connect to Constellation (%s): %v", path, err))