From 2202782ab8348246b8b5fe8d7d05c2abdf5aa25c Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Wed, 22 May 2019 16:52:50 -0700 Subject: [PATCH] Add long-term feedback as TODOs --- consensus/consensus_v2.go | 1 + consensus/consensus_validator.go | 1 + core/rawdb/accessors_chain.go | 1 + node/node.go | 6 ++++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index c1273d276..9693726af 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -133,6 +133,7 @@ func (consensus *Consensus) onAnnounce(msg *msg_pb.Message) { if consensus.BlockVerifier == nil { // do nothing } else if err := consensus.BlockVerifier(&blockObj); err != nil { + // TODO ek – maybe we could do this in commit phase err := ctxerror.New("block verification failed", "blockHash", blockObj.Hash(), ).WithCause(err) diff --git a/consensus/consensus_validator.go b/consensus/consensus_validator.go index a717907bc..0766aec76 100644 --- a/consensus/consensus_validator.go +++ b/consensus/consensus_validator.go @@ -95,6 +95,7 @@ func (consensus *Consensus) processAnnounceMessage(message *msg_pb.Message) { if consensus.BlockVerifier == nil { // do nothing } else if err := consensus.BlockVerifier(&blockObj); err != nil { + // TODO ek – maybe we could do this in commit phase err := ctxerror.New("block verification failed", "blockHash", blockObj.Hash(), ).WithCause(err) diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index cde96f76e..e4bc679d9 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -340,6 +340,7 @@ func ReadBlock(db DatabaseReader, hash common.Hash, number uint64) *types.Block func WriteBlock(db DatabaseWriter, block *types.Block) { WriteBody(db, block.Hash(), block.NumberU64(), block.Body()) WriteHeader(db, block.Header()) + // TODO ek – maybe roll the below into WriteHeader() epoch := block.Header().Epoch if epoch == nil { // backward compatibility diff --git a/node/node.go b/node/node.go index e92352187..166f22dfc 100644 --- a/node/node.go +++ b/node/node.go @@ -148,8 +148,9 @@ type Node struct { // TODO: leochen, can we use multiple account for staking? StakingAccount accounts.Account - // For test only - TestBankKeys []*ecdsa.PrivateKey + // For test only; TODO ek – remove this + TestBankKeys []*ecdsa.PrivateKey + ContractDeployerKey *ecdsa.PrivateKey ContractDeployerCurrentNonce uint64 // The nonce of the deployer contract at current block ContractAddresses []common.Address @@ -191,6 +192,7 @@ type Node struct { // When for a leader to propose the next shard state, // or for a validator to wait for a proposal before view change. + // TODO ek – replace with retry-based logic instead of delay proposeTime time.Time }