This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into use-txpool-prefix-and-group
- Loading branch information
Showing
152 changed files
with
4,837 additions
and
1,896 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...pantheon/tests/acceptance/dsl/condition/eea/ExpectSuccessfulEeaGetTransactionReceipt.java
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,36 @@ | ||
/* | ||
* Copyright 2018 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaGetTransactionReceiptTransaction; | ||
|
||
public class ExpectSuccessfulEeaGetTransactionReceipt implements Condition { | ||
|
||
private final EeaGetTransactionReceiptTransaction transaction; | ||
|
||
public ExpectSuccessfulEeaGetTransactionReceipt( | ||
final EeaGetTransactionReceiptTransaction transaction) { | ||
this.transaction = transaction; | ||
} | ||
|
||
@Override | ||
public void verify(final Node node) { | ||
final ResponseTypes.PrivateTransactionReceipt response = node.execute(transaction); | ||
assertThat(response.getContractAddress()).isNotEqualTo("0x"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eea.java
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,32 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectSuccessfulEeaGetTransactionReceipt; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; | ||
|
||
public class Eea { | ||
|
||
EeaTransactions transactions; | ||
|
||
public Eea(final EeaTransactions transactions) { | ||
this.transactions = transactions; | ||
} | ||
|
||
public Condition expectSuccessfulTransactionReceipt( | ||
final String transactionHash, final String publicKey) { | ||
return new ExpectSuccessfulEeaGetTransactionReceipt( | ||
transactions.getTransactionReceipt(transactionHash, publicKey)); | ||
} | ||
} |
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
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
40 changes: 40 additions & 0 deletions
40
...asys/pantheon/tests/acceptance/dsl/privacy/ExpectValidPrivateContractDeployedReceipt.java
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,40 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.privacy; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions; | ||
|
||
public class ExpectValidPrivateContractDeployedReceipt | ||
extends ExpectValidPrivateTransactionReceipt { | ||
|
||
private final String contractAddress; | ||
|
||
public ExpectValidPrivateContractDeployedReceipt( | ||
final String contractAddress, final Eea eea, final Transactions transactions) { | ||
super(eea, transactions); | ||
this.contractAddress = contractAddress; | ||
} | ||
|
||
public void verify( | ||
final PantheonNode node, final String transactionHash, final String publicKey) { | ||
ResponseTypes.PrivateTransactionReceipt privateTxReceipt = | ||
getPrivateTransactionReceipt(node, transactionHash, publicKey); | ||
|
||
assertEquals(contractAddress, privateTxReceipt.getContractAddress()); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...egasys/pantheon/tests/acceptance/dsl/privacy/ExpectValidPrivateContractEventsEmitted.java
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,44 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.privacy; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions; | ||
|
||
import java.math.BigInteger; | ||
|
||
import org.web3j.utils.Numeric; | ||
|
||
public class ExpectValidPrivateContractEventsEmitted extends ExpectValidPrivateTransactionReceipt { | ||
private final String eventValue; | ||
|
||
public ExpectValidPrivateContractEventsEmitted( | ||
final String eventValue, final Eea eea, final Transactions transactions) { | ||
super(eea, transactions); | ||
this.eventValue = eventValue; | ||
} | ||
|
||
public void verify( | ||
final PantheonNode node, final String transactionHash, final String PUBLIC_KEY) { | ||
ResponseTypes.PrivateTransactionReceipt privateTxReceipt = | ||
getPrivateTransactionReceipt(node, transactionHash, PUBLIC_KEY); | ||
|
||
String event = privateTxReceipt.getLogs().get(0).getData().substring(66, 130); | ||
assertEquals( | ||
Numeric.decodeQuantity(Numeric.prependHexPrefix(event)), new BigInteger(eventValue)); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...gasys/pantheon/tests/acceptance/dsl/privacy/ExpectValidPrivateContractValuesReturned.java
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,44 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.privacy; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions; | ||
import tech.pegasys.pantheon.util.bytes.BytesValue; | ||
|
||
import java.math.BigInteger; | ||
|
||
import org.web3j.utils.Numeric; | ||
|
||
public class ExpectValidPrivateContractValuesReturned extends ExpectValidPrivateTransactionReceipt { | ||
private final String returnValue; | ||
|
||
public ExpectValidPrivateContractValuesReturned( | ||
final String returnValue, final Eea eea, final Transactions transactions) { | ||
super(eea, transactions); | ||
this.returnValue = returnValue; | ||
} | ||
|
||
public void verify( | ||
final PantheonNode node, final String transactionHash, final String PUBLIC_KEY) { | ||
ResponseTypes.PrivateTransactionReceipt privateTxReceipt = | ||
getPrivateTransactionReceipt(node, transactionHash, PUBLIC_KEY); | ||
|
||
BytesValue output = BytesValue.fromHexString(privateTxReceipt.getOutput()); | ||
assertEquals(Numeric.decodeQuantity(output.toString()), new BigInteger(returnValue)); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...h/pegasys/pantheon/tests/acceptance/dsl/privacy/ExpectValidPrivateTransactionReceipt.java
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,40 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.privacy; | ||
|
||
import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions; | ||
|
||
public abstract class ExpectValidPrivateTransactionReceipt { | ||
|
||
private Eea eea; | ||
private Transactions transactions; | ||
|
||
ExpectValidPrivateTransactionReceipt(final Eea eea, final Transactions transactions) { | ||
this.eea = eea; | ||
this.transactions = transactions; | ||
} | ||
|
||
ResponseTypes.PrivateTransactionReceipt getPrivateTransactionReceipt( | ||
final PantheonNode node, final String transactionHash, final String publicKey) { | ||
|
||
waitFor(() -> node.verify(eea.expectSuccessfulTransactionReceipt(transactionHash, publicKey))); | ||
ResponseTypes.PrivateTransactionReceipt privateTxReceipt = | ||
node.execute(transactions.getPrivateTransactionReceipt(transactionHash, publicKey)); | ||
return privateTxReceipt; | ||
} | ||
} |
Oops, something went wrong.