Skip to content

Feature/jsonrpc#1

Merged
glesniakiewicz merged 17 commits into
masterfrom
feature/jsonrpc
Jan 15, 2018
Merged

Feature/jsonrpc#1
glesniakiewicz merged 17 commits into
masterfrom
feature/jsonrpc

Conversation

@glesniakiewicz
Copy link
Copy Markdown
Contributor

jsonRpc initial version, key store impementation

// lower difficulty branch
_blockStore.AddBlock(suggestedBlock, false);
}
SuggestedBlock = null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally instead

public interface IBlockchainProcessor
{
Block HeadBlock { get; }
//Currently processing block
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use /// comments instead


public Address Address => PublicKey.Address;

public Guid Id { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any suggestion how to do that nicer? I did not like it in my code (for block header) and wanted to refactor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe some change tracking and getter for hash that would always recompute when onvoked and any changes were made...

}

public byte[] ToBytes()
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is implicit conversion operator, not sure if we need it ever

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better Error(string text) and Error(Exception ex) separately?

public Keccak Hash { get; set; }

public void RecomputeHash()
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blockHash

@LukaszRozmej LukaszRozmej mentioned this pull request May 7, 2026
6 tasks
@LukaszRozmej LukaszRozmej mentioned this pull request May 18, 2026
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants