Skip to content

Commit

Permalink
feat: Removed code irrelevancies and added static ECDSA key (#663)
Browse files Browse the repository at this point in the history
Signed-off-by: gsstoykov <georgi.stoykov@limechain.tech>
  • Loading branch information
gsstoykov authored Feb 23, 2024
1 parent 86a62fa commit 5030f47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,11 @@

#include <chrono>
#include <gtest/gtest.h>
#include <string_view>

using namespace Hedera;

class ContractDeleteTransactionIntegrationTests : public BaseIntegrationTest
{
// protected:
// [[nodiscard]] inline std::string_view getBytecode() const { return bytecode; }

// private:
// std::string_view bytecode =
// "608060405234801561001057600080fd5b5060405161011e38038061011e8339818101604052602081101561003357600080fd5b5051600080"
// "61010c6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063d09de08a146037578063f891409614"
// "605b575b600080fd5b603d606d565b6040518082815260200191505060405180910390f35b605b60048036036020811015605757600080fd5b"
// "81019080803590602001909291905050506071565b005b60008054604080516020600284861615610100026000190190921691909104601f81"
// "01849004840282018401909252828152606093909290918301828280156101845780601f106101595761010080835404028352916020019161"
// "0184565b820191906000526020600020905b81548152906001019060200180831161016757829003601f168201915b5050505050905090565b"
// "828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101b757805160ff1916838001"
// "1785556101e5565b828001600101855582156101e5579182015b828111156101e55782518255916020019190600101906101ca565b5b509050"
// "6101f491906101f8565b5090565b61021891905b808211156102145760008160009055506001016101fc565b5090565b90565b6114f6806102"
// "2e6000396000f3fe608060405234801561001057600080fd5b50600436106100515760003560e01c80632e64cec714610056578063925242fa"
// "1461008a575b600080fd5b61005e6100c6565b6040518082815260200191505060405180910390f35b6100c46100cf565b6040518082815260"
// "200191505060405180910390f35b60005481565b600080546001019055565b60008181548110151561010157fe5b9060005260206000200154"
// "60ff16600a0a830260026020908101929092556002820193506101dd565b828054600181600116156101000203166002900490600052602060"
// "002090601f016020900481019282601f106101b757805160ff19168380011785556101e5565b828001600101855582156101e5579182015b82"
// "8111156101e55782518255916020019190600101906101ca565b5b5090506101f491906101f8565b5090565b60206040519081016040528060"
// "0081525090565b61026d91905b80821115610269576000816000905550600101610251565b5090565b905600a165627a7a723058206b034f5b"
// "f6e4b8fc3037a6d276b0de4f1d5752cc2fdd23e7a8e626b9f2e217c30029";
};

//-----
Expand Down
17 changes: 5 additions & 12 deletions src/sdk/tests/integration/EthereumTransactionIntegrationTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@
* limitations under the License.
*
*/
#include "AccountBalance.h"
#include "AccountBalanceQuery.h"
#include "AccountCreateTransaction.h"
#include "AccountDeleteTransaction.h"
#include "AccountInfo.h"
#include "AccountInfoQuery.h"
#include "BaseIntegrationTest.h"
#include "Client.h"
#include "ContractCreateTransaction.h"
#include "ContractDeleteTransaction.h"
#include "ContractFunctionParameters.h"
#include "ContractId.h"
#include "ECDSAsecp256k1PrivateKey.h"
#include "ECDSAsecp256k1PublicKey.h"
#include "ED25519PrivateKey.h"
#include "EthereumTransaction.h"
#include "EthereumTransactionDataEip1559.h"
#include "FileCreateTransaction.h"
#include "FileDeleteTransaction.h"
#include "FileId.h"
Expand All @@ -42,19 +40,12 @@
#include "TransferTransaction.h"
#include "exceptions/OpenSSLException.h"
#include "impl/HexConverter.h"
#include "impl/Network.h"
#include "impl/RLPItem.h"
#include "impl/Utilities.h"
#include "impl/openssl_utils/OpenSSLUtils.h"

#include <filesystem>
#include <fstream>
#include <gtest/gtest.h>
#include <nlohmann/json.hpp>
#include <thread>
#include <vector>

using json = nlohmann::json;
using namespace Hedera;

class EthereumTransactionIntegrationTests : public BaseIntegrationTest
Expand All @@ -65,7 +56,9 @@ class EthereumTransactionIntegrationTests : public BaseIntegrationTest
TEST_F(EthereumTransactionIntegrationTests, SignerNonceChangedOnEthereumTransaction)
{
// Given
const std::shared_ptr<ECDSAsecp256k1PrivateKey> testPrivateKey = ECDSAsecp256k1PrivateKey::generatePrivateKey();
const std::shared_ptr<ECDSAsecp256k1PrivateKey> testPrivateKey = ECDSAsecp256k1PrivateKey::fromString(
"30540201010420ac318ea8ff8d991ab2f16172b4738e74dc35a56681199cfb1c0cb2e7cb560ffda00706052b8104000aa124032200036843f5"
"cb338bbb4cdb21b0da4ea739d910951d6e8a5f703d313efe31afe788f4");
const std::shared_ptr<ECDSAsecp256k1PublicKey> testPublicKey =
std::dynamic_pointer_cast<ECDSAsecp256k1PublicKey>(testPrivateKey->getPublicKey());
const AccountId aliasAccountId = testPublicKey->toAccountId();
Expand Down Expand Up @@ -149,7 +142,7 @@ TEST_F(EthereumTransactionIntegrationTests, SignerNonceChangedOnEthereumTransact
// Type should be concatenated to RLP as this is a service side requirement
ethereumTransactionData = internal::Utilities::concatenateVectors({ type, ethereumTransactionData });

// When
// When Then
EthereumTransaction ethereumTransaction;
EXPECT_NO_THROW(ethereumTransaction = EthereumTransaction().setEthereumData(ethereumTransactionData));

Expand Down

0 comments on commit 5030f47

Please sign in to comment.