Skip to content

Commit

Permalink
Merge branch 'master' into lazytree
Browse files Browse the repository at this point in the history
  • Loading branch information
tkstanczak authored Jun 21, 2019
2 parents 0977bfd + 59b7cb6 commit 65d3a5a
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 24 deletions.
47 changes: 47 additions & 0 deletions scripts/packaging/build-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
RELEASE_DIRECTORY=../../../../nethermind-packages
CLI_PATH=nethermind/src/Nethermind/Nethermind.Cli
LINUX=linux-x64
OSX=osx-x64
WIN10=win10-x64
PUBLISH_PATH=bin/release/netcoreapp2.2
EXEC=Nethermind.Cli
ZIP=$EXEC.zip
OUT=out
LIN_RELEASE=nethermind-lin-x64
OSX_RELEASE=nethermind-osx-x64
WIN_RELEASE=nethermind-win-x64

cd $CLI_PATH

echo =======================================================
echo Publishing Nethermind Cli for different platforms...
echo =======================================================
echo Nethermind Cli path: $CLI_PATH

dotnet publish -c release -r $LINUX
dotnet publish -c release -r $OSX
dotnet publish -c release -r $WIN10

rm -rf $OUT && mkdir $OUT $OUT/$LINUX $OUT/$OSX $OUT/$WIN10

echo =======================================================
echo Packing Nethermind Cli for different platforms...
echo =======================================================

warp-packer --arch linux-x64 --input_dir $PUBLISH_PATH/$LINUX/publish --exec $EXEC --output $OUT/$LINUX/$EXEC
warp-packer --arch macos-x64 --input_dir $PUBLISH_PATH/$OSX/publish --exec $EXEC --output $OUT/$OSX/$EXEC
warp-packer --arch windows-x64 --input_dir $PUBLISH_PATH/$WIN10/publish --exec $EXEC.exe --output $OUT/$WIN10/$EXEC.exe

mkdir -p $RELEASE_DIRECTORY/$LIN_RELEASE
mkdir -p $RELEASE_DIRECTORY/$OSX_RELEASE
mkdir -p $RELEASE_DIRECTORY/$WIN_RELEASE

mv $OUT/$LINUX/$EXEC $RELEASE_DIRECTORY/$LIN_RELEASE
mv $OUT/$OSX/$EXEC $RELEASE_DIRECTORY/$OSX_RELEASE
mv $OUT/$WIN10/$EXEC.exe $RELEASE_DIRECTORY/$WIN_RELEASE

rm -rf $OUT

echo =======================================================
echo Building Nethermind Cli completed
echo =======================================================
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Blockchain/BlockProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void StoreTxReceipts(Block block, TxReceipt[] txReceipts)
{
txReceipts[i].BlockHash = block.Hash;
_receiptStorage.Add(txReceipts[i], true);
_txPool.RemoveTransaction(txReceipts[i].TransactionHash);
_txPool.RemoveTransaction(txReceipts[i].TxHash);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private FilterLog CreateLog(LogFilter logFilter, TxReceipt txReceipt, LogEntry l
private FilterLog CreateLog(UInt256 logIndex, TxReceipt txReceipt, LogEntry logEntry)
{
return new FilterLog(logIndex, txReceipt.BlockNumber, txReceipt.BlockHash,
(UInt256)txReceipt.Index, txReceipt.TransactionHash, logEntry.LoggersAddress,
(UInt256)txReceipt.Index, txReceipt.TxHash, logEntry.LoggersAddress,
logEntry.Data, logEntry.Topics);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public TxReceipt Find(Keccak hash)
}

public void Add(TxReceipt txReceipt, bool isProcessed)
=> _receipts.TryAdd(txReceipt.TransactionHash, txReceipt);
=> _receipts.TryAdd(txReceipt.TxHash, txReceipt);

public void Insert(long blockNumber, TxReceipt txReceipt)
{
if (txReceipt != null)
{
_receipts.TryAdd(txReceipt.TransactionHash, txReceipt);
_receipts.TryAdd(txReceipt.TxHash, txReceipt);
}

LowestInsertedReceiptBlock = blockNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void Add(TxReceipt txReceipt, bool isProcessed)
behaviors = behaviors | RlpBehaviors.Storage;
}

_database.Set(txReceipt.TransactionHash,
_database.Set(txReceipt.TxHash,
Rlp.Encode(txReceipt, behaviors).Bytes);
}

Expand All @@ -80,7 +80,7 @@ public void Insert(long blockNumber, TxReceipt txReceipt)
{
var spec = _specProvider.GetSpec(blockNumber);
RlpBehaviors behaviors = spec.IsEip658Enabled ? RlpBehaviors.Eip658Receipts : RlpBehaviors.None;
_database.Set(txReceipt.TransactionHash, Rlp.Encode(txReceipt, behaviors).Bytes);
_database.Set(txReceipt.TxHash, Rlp.Encode(txReceipt, behaviors).Bytes);
}

LowestInsertedReceiptBlock = blockNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ private int InsertReceipts(FastBlocksBatch batch)
break;
}

receipt.TransactionHash = block
receipt.TxHash = block
.Transactions[receiptIndex]
.Hash;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Nethermind/Nethermind.Cli/Modules/EthCliModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ public string GetUncleCountByBlockNumber(string blockParameter)
}

[CliFunction("eth", "getTransactionByBlockNumberAndIndex")]
public string GetTransactionByBlockNumberAndIndex(string blockParameter, string index)
public object GetTransactionByBlockNumberAndIndex(string blockParameter, string index)
{
return NodeManager.Post<string>("eth_getTransactionByBlockNumberAndIndex", blockParameter, index).Result;
return NodeManager.Post<object>("eth_getTransactionByBlockNumberAndIndex", blockParameter, index).Result;
}

[CliFunction("eth", "getTransactionReceipt")]
public string GetTransactionReceipt(string txHash)
public object GetTransactionReceipt(string txHash)
{
return NodeManager.Post<string>("eth_getTransactionReceipt", txHash).Result;
return NodeManager.Post<object>("eth_getTransactionReceipt", txHash).Result;
}

[CliFunction("eth", "getBalance")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private Block CreateBlock(int splitVariant, int splitFrom, int i, Block parent)
foreach (Transaction transaction in current.Transactions)
{
TxReceipt receipt = new TxReceipt();
receipt.TransactionHash = transaction.Hash;
receipt.TxHash = transaction.Hash;
_receiptStorage.Add(receipt, false);
receipts.Add(receipt);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ReceiptBuilder WithLogs(LogEntry[] logs)

public ReceiptBuilder WithTransactionHash(Keccak hash)
{
TestObject.TransactionHash = hash;
TestObject.TxHash = hash;
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Core/TransactionReceipt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TxReceipt

public long BlockNumber { get; set; }
public Keccak BlockHash { get; set; }
public Keccak TransactionHash { get; set; }
public Keccak TxHash { get; set; }
public int Index { get; set; }
public long GasUsed { get; set; }
public long GasUsedTotal { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public Keccak SendTransaction(Transaction transaction, bool doNotEvict = false)

public TxReceipt GetReceipt(Keccak txHash)
{
return _receiptsTracer.TxReceipts.Single(r => r?.TransactionHash == txHash);
return _receiptsTracer.TxReceipts.Single(r => r?.TxHash == txHash);
}

public Facade.BlockchainBridge.CallOutput Call(BlockHeader blockHeader, Transaction transaction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private TxReceipt BuildReceipt(Address recipient, long spentGas, byte statusCode
txReceipt.GasUsed = spentGas;
txReceipt.Sender = transaction.SenderAddress;
txReceipt.ContractAddress = transaction.IsContractCreation ? recipient : null;
txReceipt.TransactionHash = transaction.Hash;
txReceipt.TxHash = transaction.Hash;

return txReceipt;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Nethermind/Nethermind.Facade/BlockchainBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public Keccak SendTransaction(Transaction transaction, bool doNotEvict = false)

public TxReceipt GetReceipt(Keccak txHash)
{
var receipt = _receiptStorage.Find(txHash);
receipt.TransactionHash = txHash;
return receipt;
var txReceipt = _receiptStorage.Find(txHash);
txReceipt.TxHash = txHash;
return txReceipt;
}

public class CallOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void Eth_get_transaction_receipt()

string serialized = RpcTest.TestSerializedRequest(module, "eth_getTransactionReceipt", TestItem.KeccakA.ToString());

Assert.AreEqual("{\"id\":67,\"jsonrpc\":\"2.0\",\"result\":{\"transactionHash\":\"0x03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b760\",\"transactionIndex\":\"0x2\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"cumulativeGasUsed\":\"0x3e8\",\"gasUsed\":\"0x64\",\"from\":\"0xb7705ae4c6f81b66cdb323c65f4e8133690fc099\",\"to\":\"0x942921b14f1b1c385cd7e0cc2ef7abe5598c8358\",\"contractAddress\":\"0x76e68a8696537e4141926f3e528733af9e237d69\",\"logs\":[{\"removed\":false,\"logIndex\":\"0x0\",\"transactionIndex\":\"0x2\",\"transactionHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"address\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0x\",\"topics\":[\"0x0000000000000000000000000000000000000000000000000000000000000000\"]},{\"removed\":false,\"logIndex\":\"0x1\",\"transactionIndex\":\"0x2\",\"transactionHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"address\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0x\",\"topics\":[\"0x0000000000000000000000000000000000000000000000000000000000000000\"]}],\"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"root\":\"0x1f675bff07515f5df96737194ea945c36c41e7b4fcef307b7cd4d0e602a69111\",\"status\":\"0x0\",\"error\":\"error\"}}", serialized);
Assert.AreEqual("{\"id\":67,\"jsonrpc\":\"2.0\",\"result\":{\"transactionHash\":\"0x03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b760\",\"transactionIndex\":\"0x2\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"cumulativeGasUsed\":\"0x3e8\",\"gasUsed\":\"0x64\",\"from\":\"0xb7705ae4c6f81b66cdb323c65f4e8133690fc099\",\"to\":\"0x942921b14f1b1c385cd7e0cc2ef7abe5598c8358\",\"contractAddress\":\"0x76e68a8696537e4141926f3e528733af9e237d69\",\"logs\":[{\"removed\":false,\"logIndex\":\"0x0\",\"transactionIndex\":\"0x2\",\"transactionHash\":\"0x03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b760\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"address\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0x\",\"topics\":[\"0x0000000000000000000000000000000000000000000000000000000000000000\"]},{\"removed\":false,\"logIndex\":\"0x1\",\"transactionIndex\":\"0x2\",\"transactionHash\":\"0x03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b760\",\"blockHash\":\"0x017e667f4b8c174291d1543c466717566e206df1bfd6f30271055ddafdb18f72\",\"blockNumber\":\"0x2\",\"address\":\"0x0000000000000000000000000000000000000000\",\"data\":\"0x\",\"topics\":[\"0x0000000000000000000000000000000000000000000000000000000000000000\"]}],\"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"root\":\"0x1f675bff07515f5df96737194ea945c36c41e7b4fcef307b7cd4d0e602a69111\",\"status\":\"0x0\",\"error\":\"error\"}}", serialized);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.JsonRpc/Data/LogEntryForRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public LogEntryForRpc(TxReceipt receipt, LogEntry logEntry, int index)
Removed = false;
LogIndex = index;
TransactionIndex = receipt.Index;
TransactionHash = receipt.TransactionHash;
TransactionHash = receipt.TxHash;
BlockHash = receipt.BlockHash;
BlockNumber = receipt.BlockNumber;
Address = logEntry.LoggersAddress;
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.PubSub.Kafka/Avro/AvroMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public FullTransaction MapFullTransaction(Core.FullTransaction fullTransaction)
logsBloom = receipt.Bloom.ToString(),
gasUsed = receipt.GasUsed,
contractAddress = receipt.ContractAddress?.ToString() ?? string.Empty,
transactionHash = receipt.TransactionHash.ToString(),
transactionHash = receipt.TxHash.ToString(),
cumulativeGasUsed = receipt.GasUsedTotal,
status = receipt.StatusCode,
logs = receipt.Logs?.Select((l, i) => new Log
Expand All @@ -111,7 +111,7 @@ public FullTransaction MapFullTransaction(Core.FullTransaction fullTransaction)
transactionIndex = receipt.Index,
blockHash = receipt.BlockHash.ToString(),
data = l.Data.ToString(),
transactionHash = receipt.TransactionHash.ToString(),
transactionHash = receipt.TxHash.ToString(),
address = l.LoggersAddress.ToString(),
logTopics = l.Topics?.Select(t => t.ToString()).ToList() ?? new List<string>(),
removed = removed
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.PubSub/PubSubModelMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public TransactionReceipt MapTransactionReceipt(Core.TxReceipt receipt)
StatusCode = receipt.StatusCode,
BlockNumber = receipt.BlockNumber.ToString(),
BlockHash = receipt.BlockHash?.Bytes,
TransactionHash = receipt.TransactionHash?.Bytes,
TransactionHash = receipt.TxHash?.Bytes,
Index = receipt.Index,
GasUsed = receipt.GasUsed,
Sender = receipt.Sender?.Bytes,
Expand Down

0 comments on commit 65d3a5a

Please sign in to comment.