Feature/jsonrpc#1
Conversation
…on and execution, test coverage of JsonRpcService, moved keystore tests to nunit
…on and execution, test coverage of JsonRpcService, moved keystore tests to nunit
…mind into feature/jsonrpc
…ethod and mappers for json RPC
| // lower difficulty branch | ||
| _blockStore.AddBlock(suggestedBlock, false); | ||
| } | ||
| SuggestedBlock = null; |
| public interface IBlockchainProcessor | ||
| { | ||
| Block HeadBlock { get; } | ||
| //Currently processing block |
|
|
||
| public Address Address => PublicKey.Address; | ||
|
|
||
| public Guid Id { get; set; } |
There was a problem hiding this comment.
we will need to review how we pass private key around in memory (need to be protected and overwritten), separately - let us discuss why we need Guid - can't we store by public key? (or is it to cover all the scenarios when public key is same? - rare)
| } | ||
|
|
||
| public static byte[] GenerateRandomBytes(int lenght) | ||
| { |
There was a problem hiding this comment.
if not behind interface then equally we can use SecureRandom.GetBytes directly, otherwise let us push it behind ISecureRandom so we can test with this class wherever used
| transaction.Signature = signature; | ||
| } | ||
|
|
||
| transaction.RecomputeHash(); |
There was a problem hiding this comment.
any suggestion how to do that nicer? I did not like it in my code (for block header) and wanted to refactor
There was a problem hiding this comment.
maybe some change tracking and getter for hash that would always recompute when onvoked and any changes were made...
| } | ||
|
|
||
| public byte[] ToBytes() | ||
| { |
There was a problem hiding this comment.
there is implicit conversion operator, not sure if we need it ever
There was a problem hiding this comment.
I am not a great fan of the Hex class any more by the way, we will review when alpha version fiinished
| { | ||
| void Log(string text); | ||
| void Debug(string text); | ||
| void Error(string text, Exception ex = null); |
There was a problem hiding this comment.
maybe better Error(string text) and Error(Exception ex) separately?
| public Keccak Hash { get; set; } | ||
|
|
||
| public void RecomputeHash() | ||
| { |
There was a problem hiding this comment.
do we have a single test for this (not that I never neglected it)
| public long GasUsed { get; set; } | ||
| public Bloom Bloom { get; set; } | ||
| public LogEntry[] Logs { get; set; } | ||
| public Address Recipient { get; set; } |
There was a problem hiding this comment.
need to learn more - this I guess is only in the network version but not in the one created by EVM
| void AddTransactionReceipt(Keccak transactionHash, TransactionReceipt transactionReceipt, Keccak blockhash); | ||
| Transaction GetTransaction(Keccak transactionHash); | ||
| TransactionReceipt GetTransactionReceipt(Keccak transactionHash); | ||
| bool WasProcessed(Keccak transactionHash); |
There was a problem hiding this comment.
what does it mean? it may not be on the main chain even if it was added, maybe worth to clarify the API, let us discuss
| transactionReceipt.GasUsed = gasUsedSoFar; | ||
| transactionReceipt.PostTransactionState = _stateProvider.StateRoot; | ||
| transactionReceipt.StatusCode = statusCode; | ||
| transactionReceipt.Recipient = recipient; |
There was a problem hiding this comment.
cool but I guess it was never tested so worth adding a test if not there yet
| } | ||
|
|
||
| public void AddTransactionReceipt(Keccak transactionHash, TransactionReceipt transactionReceipt, Keccak blockhash) | ||
| { |
There was a problem hiding this comment.
let me know how it discriminates between processed and failed or succeeded and also if it matters whether it was included in the main chain
| _transactions[transaction.Hash] = transaction; | ||
| } | ||
|
|
||
| public void AddTransactionReceipt(Keccak transactionHash, TransactionReceipt transactionReceipt, Keccak blockhash) |
jsonRpc initial version, key store impementation