Search in sources :

Example 1 with BytesValueRLPOutput

use of org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput in project besu by hyperledger.

the class AccountRangeMessage method create.

public static AccountRangeMessage create(final Optional<BigInteger> requestId, final Map<Bytes32, Bytes> accounts, final ArrayDeque<Bytes> proof) {
    final BytesValueRLPOutput tmp = new BytesValueRLPOutput();
    tmp.startList();
    requestId.ifPresent(tmp::writeBigIntegerScalar);
    tmp.writeList(accounts.entrySet(), (entry, rlpOutput) -> {
        rlpOutput.startList();
        rlpOutput.writeBytes(entry.getKey());
        rlpOutput.writeRLPBytes(entry.getValue());
        rlpOutput.endList();
    });
    tmp.writeList(proof, (bytes, rlpOutput) -> rlpOutput.writeBytes(bytes));
    tmp.endList();
    return new AccountRangeMessage(tmp.encoded());
}
Also used : BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput)

Example 2 with BytesValueRLPOutput

use of org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput in project besu by hyperledger.

the class MultiTenancyAcceptanceTest method privGetTransactionReceiptSuccessShouldReturnTransactionReceiptAfterMined.

@Test
public void privGetTransactionReceiptSuccessShouldReturnTransactionReceiptAfterMined() throws JsonProcessingException {
    final PrivateTransaction validSignedPrivateTransaction = getValidSignedPrivateTransaction(senderAddress);
    final BytesValueRLPOutput rlpOutput = getRLPOutput(validSignedPrivateTransaction);
    retrievePrivacyGroupEnclaveStub();
    sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1);
    receiveEnclaveStub(validSignedPrivateTransaction);
    final Hash transactionReceipt = node.execute(privacyTransactions.sendRawTransaction(rlpOutput.encoded().toHexString()));
    node.verify(priv.getSuccessfulTransactionReceipt(transactionReceipt));
}
Also used : PrivateTransaction(org.hyperledger.besu.ethereum.privacy.PrivateTransaction) Hash(org.hyperledger.besu.datatypes.Hash) BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput) Test(org.junit.Test)

Example 3 with BytesValueRLPOutput

use of org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput in project besu by hyperledger.

the class MultiTenancyAcceptanceTest method privGetTransactionCountSuccessShouldReturnExpectedTransactionCount.

@Test
public void privGetTransactionCountSuccessShouldReturnExpectedTransactionCount() throws JsonProcessingException {
    final PrivateTransaction validSignedPrivateTransaction = getValidSignedPrivateTransaction(senderAddress);
    final String accountAddress = validSignedPrivateTransaction.getSender().toHexString();
    final BytesValueRLPOutput rlpOutput = getRLPOutput(validSignedPrivateTransaction);
    retrievePrivacyGroupEnclaveStub();
    sendEnclaveStub(PARTICIPANT_ENCLAVE_KEY1);
    receiveEnclaveStub(validSignedPrivateTransaction);
    node.verify(priv.getTransactionCount(accountAddress, PRIVACY_GROUP_ID, 0));
    final Hash transactionReceipt = node.execute(privacyTransactions.sendRawTransaction(rlpOutput.encoded().toHexString()));
    node.verify(priv.getSuccessfulTransactionReceipt(transactionReceipt));
    node.verify(priv.getTransactionCount(accountAddress, PRIVACY_GROUP_ID, 1));
}
Also used : PrivateTransaction(org.hyperledger.besu.ethereum.privacy.PrivateTransaction) Hash(org.hyperledger.besu.datatypes.Hash) BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput) Test(org.junit.Test)

Example 4 with BytesValueRLPOutput

use of org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput in project besu by hyperledger.

the class MultiTenancyAcceptanceTest method getRLPOutputForReceiveResponse.

private BytesValueRLPOutput getRLPOutputForReceiveResponse(final PrivateTransaction privateTransaction) {
    final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput();
    privateTransaction.writeTo(bvrlpo);
    return bvrlpo;
}
Also used : BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput)

Example 5 with BytesValueRLPOutput

use of org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput in project besu by hyperledger.

the class MultiTenancyValidationFailAcceptanceTest method getRLPOutput.

private BytesValueRLPOutput getRLPOutput(final PrivateTransaction validSignedPrivateTransaction) {
    final BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput();
    validSignedPrivateTransaction.writeTo(bvrlpo);
    return bvrlpo;
}
Also used : BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput)

Aggregations

BytesValueRLPOutput (org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput)190 Test (org.junit.Test)81 Bytes (org.apache.tuweni.bytes.Bytes)64 SECPSignature (org.hyperledger.besu.crypto.SECPSignature)29 Address (org.hyperledger.besu.datatypes.Address)27 Hash (org.hyperledger.besu.datatypes.Hash)18 RLPInput (org.hyperledger.besu.ethereum.rlp.RLPInput)17 BftExtraData (org.hyperledger.besu.consensus.common.bft.BftExtraData)14 Endpoint (org.hyperledger.besu.ethereum.p2p.discovery.Endpoint)14 UInt64 (org.apache.tuweni.units.bigints.UInt64)13 Transaction (org.hyperledger.besu.ethereum.core.Transaction)13 Bytes32 (org.apache.tuweni.bytes.Bytes32)12 PrivateTransaction (org.hyperledger.besu.ethereum.privacy.PrivateTransaction)12 Vote (org.hyperledger.besu.consensus.common.bft.Vote)10 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)8 BigInteger (java.math.BigInteger)7 List (java.util.List)7 ReceiveResponse (org.hyperledger.besu.enclave.types.ReceiveResponse)7 Optional (java.util.Optional)6 Random (java.util.Random)6