-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before the orderer and peer components standardized on a proto message format for shared communication, some proto messages were being unmarshaled as the wrong type, resulting in messages which looked like configuration transactions, but were not. All these transactions were then rejected because they did not apply correctly as configuration. The fabric has since standardized on a shared set of protos, so it should be safe to re-enable configuration transaction filtering. This changeset re-enables the configuration filters. Additionally, this changeset hooks the configuration transaction execution (application) into the multichain manager writerinterceptor path and adds tests for this path. Change-Id: I5ba75861812d54e19fa6eeac98174215761f9ad2 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information
Jason Yellick
committed
Dec 5, 2016
1 parent
ae9f2f2
commit 50120eb
Showing
3 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright IBM Corp. 2016 All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package multichain | ||
|
||
import ( | ||
"testing" | ||
|
||
cb "github.com/hyperledger/fabric/protos/common" | ||
) | ||
|
||
func TestCommitConfig(t *testing.T) { | ||
mcm := &mockConfigtxManager{} | ||
ctx1 := makeConfigTx("foo", 0) | ||
wi := newWriteInterceptor(mcm, &mockLedgerWriter{}) | ||
wi.Append([]*cb.Envelope{ctx1}, nil) | ||
if mcm.config == nil { | ||
t.Fatalf("Should have applied configuration") | ||
} | ||
} | ||
|
||
func TestIgnoreMultiConfig(t *testing.T) { | ||
mcm := &mockConfigtxManager{} | ||
ctx1 := makeConfigTx("foo", 0) | ||
ctx2 := makeConfigTx("foo", 1) | ||
wi := newWriteInterceptor(mcm, &mockLedgerWriter{}) | ||
wi.Append([]*cb.Envelope{ctx1, ctx2}, nil) | ||
if mcm.config != nil { | ||
t.Fatalf("Should not have applied configuration, we should only check batches with a single tx") | ||
} | ||
} | ||
|
||
func TestIgnoreSingleNonConfig(t *testing.T) { | ||
mcm := &mockConfigtxManager{} | ||
ctx1 := makeNormalTx("foo", 0) | ||
wi := newWriteInterceptor(mcm, &mockLedgerWriter{}) | ||
wi.Append([]*cb.Envelope{ctx1}, nil) | ||
if mcm.config != nil { | ||
t.Fatalf("Should not have applied configuration, it was a normal transaction") | ||
} | ||
|
||
} |