clean up from PR review
This commit is contained in:
parent
fbc87c0410
commit
8fc463bfad
@ -242,9 +242,9 @@ track this process:
|
|||||||
Our Postgres schemas are built around a single IPFS backing Postgres IPLD blockstore table
|
Our Postgres schemas are built around a single IPFS backing Postgres IPLD blockstore table
|
||||||
(`ipld.blocks`) that conforms with
|
(`ipld.blocks`) that conforms with
|
||||||
[go-ds-sql](https://github.com/ipfs/go-ds-sql/blob/master/postgres/postgres.go). All IPLD objects
|
[go-ds-sql](https://github.com/ipfs/go-ds-sql/blob/master/postgres/postgres.go). All IPLD objects
|
||||||
are stored in this table, where `key` is the blockstore-prefixed multihash key for the IPLD object
|
are stored in this table, where `key` is the CID for the IPLD object and `data` contains the bytes
|
||||||
and `data` contains the bytes for the IPLD block (in the case of all Ethereum IPLDs, this is the RLP
|
for the IPLD block (in the case of all Ethereum IPLDs, this is the RLP byte encoding of the Ethereum
|
||||||
byte encoding of the Ethereum object).
|
object).
|
||||||
|
|
||||||
The IPLD objects in this table can be traversed using an IPLD DAG interface, but since this table
|
The IPLD objects in this table can be traversed using an IPLD DAG interface, but since this table
|
||||||
only maps CID to raw IPLD object it is not very suitable for looking up Ethereum objects by their
|
only maps CID to raw IPLD object it is not very suitable for looking up Ethereum objects by their
|
||||||
|
1
api.go
1
api.go
@ -29,7 +29,6 @@ import (
|
|||||||
const APIName = "statediff"
|
const APIName = "statediff"
|
||||||
|
|
||||||
// APIVersion is the version of the state diffing service API
|
// APIVersion is the version of the state diffing service API
|
||||||
// TODO: match package version?
|
|
||||||
const APIVersion = "0.0.1"
|
const APIVersion = "0.0.1"
|
||||||
|
|
||||||
// PublicStateDiffAPI provides an RPC subscription interface
|
// PublicStateDiffAPI provides an RPC subscription interface
|
||||||
|
@ -25,8 +25,6 @@ type BlockChain interface {
|
|||||||
GetBlockByNumber(number uint64) *types.Block
|
GetBlockByNumber(number uint64) *types.Block
|
||||||
GetReceiptsByHash(hash common.Hash) types.Receipts
|
GetReceiptsByHash(hash common.Hash) types.Receipts
|
||||||
GetTd(hash common.Hash, number uint64) *big.Int
|
GetTd(hash common.Hash, number uint64) *big.Int
|
||||||
// TODO LockTrie is never used
|
|
||||||
// UnlockTrie(root core.Hash)
|
|
||||||
StateCache() adapt.StateView
|
StateCache() adapt.StateView
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +47,7 @@ func (b *pluginBlockChain) SubscribeChainEvent(ch chan<- core.ChainEvent) event.
|
|||||||
go func() {
|
go func() {
|
||||||
for event := range bufferChan {
|
for event := range bufferChan {
|
||||||
block := utils.MustDecode[types.Block](event.Block)
|
block := utils.MustDecode[types.Block](event.Block)
|
||||||
// TODO: apparently we ignore the logs
|
// Note: logs are processed with receipts while building the payload
|
||||||
// logs := utils.MustDecode[types.Log](chainEvent.Logs)
|
|
||||||
ch <- core.ChainEvent{
|
ch <- core.ChainEvent{
|
||||||
Block: block,
|
Block: block,
|
||||||
Hash: common.Hash(event.Hash),
|
Hash: common.Hash(event.Hash),
|
||||||
|
@ -58,7 +58,7 @@ func processTransactions(txs []*types.Transaction) ([]*EthTx, error) {
|
|||||||
|
|
||||||
// processReceiptsAndLogs will take in receipts
|
// processReceiptsAndLogs will take in receipts
|
||||||
// to return IPLD node slices for eth-rct and eth-log
|
// to return IPLD node slices for eth-rct and eth-log
|
||||||
func processReceiptsAndLogs(rcts types.Receipts) ([]*EthReceipt, [][]*EthLog, error) {
|
func processReceiptsAndLogs(rcts []*types.Receipt) ([]*EthReceipt, [][]*EthLog, error) {
|
||||||
// Pre allocating memory.
|
// Pre allocating memory.
|
||||||
ethRctNodes := make([]*EthReceipt, len(rcts))
|
ethRctNodes := make([]*EthReceipt, len(rcts))
|
||||||
ethLogNodes := make([][]*EthLog, len(rcts))
|
ethLogNodes := make([][]*EthLog, len(rcts))
|
||||||
@ -81,31 +81,6 @@ func processReceiptsAndLogs(rcts types.Receipts) ([]*EthReceipt, [][]*EthLog, er
|
|||||||
return ethRctNodes, ethLogNodes, nil
|
return ethRctNodes, ethLogNodes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// // processReceiptsAndLogs will take in receipts
|
|
||||||
// // to return IPLD node slices for eth-rct and eth-log
|
|
||||||
// func processReceiptsAndLogs(rcts []*types.Receipt) ([]*EthReceipt, [][]*EthLog, error) {
|
|
||||||
// // Pre allocating memory.
|
|
||||||
// ethRctNodes := make([]*EthReceipt, len(rcts))
|
|
||||||
// ethLogNodes := make([][]*EthLog, len(rcts))
|
|
||||||
|
|
||||||
// for idx, rct := range rcts {
|
|
||||||
// logNodes, err := processLogs(rct.Logs)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, nil, err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ethRct, err := NewReceipt(rct)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, nil, err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ethRctNodes[idx] = ethRct
|
|
||||||
// ethLogNodes[idx] = logNodes
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return ethRctNodes, ethLogNodes, nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
func processLogs(logs []*types.Log) ([]*EthLog, error) {
|
func processLogs(logs []*types.Log) ([]*EthLog, error) {
|
||||||
logNodes := make([]*EthLog, len(logs))
|
logNodes := make([]*EthLog, len(logs))
|
||||||
for idx, log := range logs {
|
for idx, log := range logs {
|
||||||
|
@ -25,13 +25,6 @@ var (
|
|||||||
func Initialize(ctx core.Context, pl core.PluginLoader, logger core.Logger) {
|
func Initialize(ctx core.Context, pl core.PluginLoader, logger core.Logger) {
|
||||||
log.SetDefaultLogger(logger)
|
log.SetDefaultLogger(logger)
|
||||||
|
|
||||||
// lvl, err := strconv.ParseInt(ctx.String("verbosity"), 10, 8)
|
|
||||||
// if err != nil {
|
|
||||||
// log.Error("cannot parse verbosity", "error", err)
|
|
||||||
// }
|
|
||||||
// log.TestLogger.SetLevel(int(lvl))
|
|
||||||
// log.SetDefaultLogger(log.TestLogger)
|
|
||||||
|
|
||||||
pluginLoader = pl
|
pluginLoader = pl
|
||||||
gethContext = ctx
|
gethContext = ctx
|
||||||
|
|
||||||
|
@ -436,11 +436,6 @@ func (sds *Service) processStateDiff(currentBlock *types.Block, parentRoot commo
|
|||||||
BlockHash: currentBlock.Hash(),
|
BlockHash: currentBlock.Hash(),
|
||||||
BlockNumber: currentBlock.Number(),
|
BlockNumber: currentBlock.Number(),
|
||||||
}, params)
|
}, params)
|
||||||
// allow dereferencing of parent, keep current locked as it should be the next parent
|
|
||||||
// sds.BlockChain.UnlockTrie(parentRoot)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
stateDiffRlp, err := rlp.EncodeToBytes(&stateDiff)
|
stateDiffRlp, err := rlp.EncodeToBytes(&stateDiff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -753,10 +748,6 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p
|
|||||||
if err = tx.Submit(err); err != nil {
|
if err = tx.Submit(err); err != nil {
|
||||||
return fmt.Errorf("batch transaction submission failed: %w", err)
|
return fmt.Errorf("batch transaction submission failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow dereferencing of parent, keep current locked as it should be the next parent
|
|
||||||
// TODO never locked
|
|
||||||
// sds.BlockChain.UnlockTrie(parentRoot)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,6 @@ func (bc *BlockChain) SetTd(hash common.Hash, blockNum uint64, td *big.Int) {
|
|||||||
bc.TDByNum[blockNum] = td
|
bc.TDByNum[blockNum] = td
|
||||||
}
|
}
|
||||||
|
|
||||||
// func (bc *BlockChain) UnlockTrie(root core.Hash) {}
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
func (bc *BlockChain) StateCache() adapt.StateView {
|
func (bc *BlockChain) StateCache() adapt.StateView {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user