From eec89168458656e72b0fec6c6b50f9c1c5b7d20b Mon Sep 17 00:00:00 2001 From: "ptsayli@gmail.com" Date: Fri, 7 Aug 2020 20:03:22 +0530 Subject: [PATCH 1/4] chg: move state sync event from block to header --- consensus/bor/bor.go | 9 +++++-- core/types/block.go | 57 ++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 35e3bc64a0..aae8977233 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -655,6 +655,8 @@ func (c *Bor) Prepare(chain consensus.ChainReader, header *types.Header) error { // Finalize implements consensus.Engine, ensuring no uncles are set, nor block // rewards given. func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header) { + stateSyncData := []*types.StateData{} + var err error headerNumber := header.Number.Uint64() if headerNumber%c.config.Sprint == 0 { cx := chainContext{Chain: chain, Bor: c} @@ -666,7 +668,7 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state if !c.WithoutHeimdall { // commit statees - _, err := c.CommitStates(state, header, cx) + stateSyncData, err = c.CommitStates(state, header, cx) if err != nil { log.Error("Error while committing states", "error", err) return @@ -677,6 +679,8 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state // No block rewards in PoA, so the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) + header.SetStateSync(stateSyncData) + } // FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, @@ -707,10 +711,11 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Hea // No block rewards in PoA, so the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) + header.SetStateSync(stateSyncData) + // Assemble block block := types.NewBlock(header, txs, nil, receipts) - block.SetStateSync(stateSyncData) // return the final block for sealing return block, nil } diff --git a/core/types/block.go b/core/types/block.go index e00b5e0d2b..3dd7366ae5 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -70,21 +70,22 @@ func (n *BlockNonce) UnmarshalText(input []byte) error { // Header represents a block header in the Ethereum blockchain. type Header struct { - ParentHash common.Hash `json:"parentHash" gencodec:"required"` - UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` - Coinbase common.Address `json:"miner" gencodec:"required"` - Root common.Hash `json:"stateRoot" gencodec:"required"` - TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` - ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` - Bloom Bloom `json:"logsBloom" gencodec:"required"` - Difficulty *big.Int `json:"difficulty" gencodec:"required"` - Number *big.Int `json:"number" gencodec:"required"` - GasLimit uint64 `json:"gasLimit" gencodec:"required"` - GasUsed uint64 `json:"gasUsed" gencodec:"required"` - Time uint64 `json:"timestamp" gencodec:"required"` - Extra []byte `json:"extraData" gencodec:"required"` - MixDigest common.Hash `json:"mixHash"` - Nonce BlockNonce `json:"nonce"` + ParentHash common.Hash `json:"parentHash" gencodec:"required"` + UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` + Coinbase common.Address `json:"miner" gencodec:"required"` + Root common.Hash `json:"stateRoot" gencodec:"required"` + TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` + ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` + Bloom Bloom `json:"logsBloom" gencodec:"required"` + Difficulty *big.Int `json:"difficulty" gencodec:"required"` + Number *big.Int `json:"number" gencodec:"required"` + GasLimit uint64 `json:"gasLimit" gencodec:"required"` + GasUsed uint64 `json:"gasUsed" gencodec:"required"` + Time uint64 `json:"timestamp" gencodec:"required"` + Extra []byte `json:"extraData" gencodec:"required"` + MixDigest common.Hash `json:"mixHash"` + Nonce BlockNonce `json:"nonce"` + stateSyncData []*StateData } // field type overrides for gencodec @@ -112,6 +113,11 @@ func (h *Header) Size() common.StorageSize { return headerSize + common.StorageSize(len(h.Extra)+(h.Difficulty.BitLen()+h.Number.BitLen())/8) } +// SetStateSync set sync data in block +func (b *Header) SetStateSync(stateData []*StateData) { + b.stateSyncData = stateData +} + // SanityCheck checks a few basic things -- these checks are way beyond what // any 'sane' production values should hold, and can mainly be used to prevent // that the unbounded fields are stuffed with junk data to add processing @@ -156,10 +162,9 @@ type Body struct { // Block represents an entire block in the Ethereum blockchain. type Block struct { - header *Header - uncles []*Header - transactions Transactions - stateSyncData []*StateData + header *Header + uncles []*Header + transactions Transactions // caches hash atomic.Value size atomic.Value @@ -266,11 +271,6 @@ func CopyHeader(h *Header) *Header { return &cpy } -// SetStateSync set sync data in block -func (b *Block) SetStateSync(stateData []*StateData) { - b.stateSyncData = stateData -} - // DecodeRLP decodes the Ethereum func (b *Block) DecodeRLP(s *rlp.Stream) error { var eb extblock @@ -321,7 +321,7 @@ func (b *Block) GasLimit() uint64 { return b.header.GasLimit } func (b *Block) GasUsed() uint64 { return b.header.GasUsed } func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } func (b *Block) Time() uint64 { return b.header.Time } -func (b *Block) StateSyncData() []*StateData { return b.stateSyncData } +func (b *Block) StateSyncData() []*StateData { return b.header.stateSyncData } func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } @@ -378,10 +378,9 @@ func (b *Block) WithSeal(header *Header) *Block { cpy := *header return &Block{ - header: &cpy, - transactions: b.transactions, - uncles: b.uncles, - stateSyncData: b.stateSyncData, + header: &cpy, + transactions: b.transactions, + uncles: b.uncles, } } From 38ebecb2fa410ce944ea8b00691b2f3fc82acd3d Mon Sep 17 00:00:00 2001 From: "ptsayli@gmail.com" Date: Tue, 11 Aug 2020 15:07:55 +0530 Subject: [PATCH 2/4] Fix: broadcast deposit event from non-validator node --- consensus/bor/bor.go | 1 - core/blockchain.go | 9 +++++---- core/state_processor.go | 2 +- core/types/block.go | 24 ++++++++++++++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index aae8977233..2a81a2ad34 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -680,7 +680,6 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) header.SetStateSync(stateSyncData) - } // FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, diff --git a/core/blockchain.go b/core/blockchain.go index 5a70de3fe8..952dea7dcc 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1542,10 +1542,6 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. if emitHeadEvent { bc.chainHeadFeed.Send(ChainHeadEvent{Block: block}) } - syncData := block.StateSyncData() - for _, data := range syncData { - bc.stateSyncFeed.Send(StateSyncEvent{StateData: data}) - } } else { bc.chainSideFeed.Send(ChainSideEvent{Block: block}) } @@ -1797,6 +1793,11 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er // Process block using the parent state as reference point substart := time.Now() receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig) + syncData := block.StateSyncData() + + for _, data := range syncData { + bc.stateSyncFeed.Send(StateSyncEvent{StateData: data}) + } if err != nil { bc.reportBlock(block, receipts, err) atomic.StoreUint32(&followupInterrupt, 1) diff --git a/core/state_processor.go b/core/state_processor.go index e6a5e9d682..ec98e3ee4e 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -77,7 +77,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg } // Finalize the block, applying any consensus engine specific extras (e.g. block rewards) p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles()) - + block.SetStateSync(header.StateData()) return receipts, allLogs, *usedGas, nil } diff --git a/core/types/block.go b/core/types/block.go index 3dd7366ae5..c2ebaedd95 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -114,8 +114,18 @@ func (h *Header) Size() common.StorageSize { } // SetStateSync set sync data in block -func (b *Header) SetStateSync(stateData []*StateData) { - b.stateSyncData = stateData +func (h *Header) SetStateSync(stateData []*StateData) { + h.stateSyncData = stateData +} + +// SetStateSync set sync data in block +func (h *Block) SetStateSync(stateData []*StateData) { + h.stateSyncData = stateData +} + +// StateSyncData set sync data in block +func (h *Header) StateData() []*StateData { + return h.stateSyncData } // SanityCheck checks a few basic things -- these checks are way beyond what @@ -162,9 +172,11 @@ type Body struct { // Block represents an entire block in the Ethereum blockchain. type Block struct { - header *Header - uncles []*Header - transactions Transactions + header *Header + uncles []*Header + transactions Transactions + stateSyncData []*StateData + // caches hash atomic.Value size atomic.Value @@ -321,7 +333,7 @@ func (b *Block) GasLimit() uint64 { return b.header.GasLimit } func (b *Block) GasUsed() uint64 { return b.header.GasUsed } func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } func (b *Block) Time() uint64 { return b.header.Time } -func (b *Block) StateSyncData() []*StateData { return b.header.stateSyncData } +func (b *Block) StateSyncData() []*StateData { return b.stateSyncData } func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } From ae38eea1f340ab0ab4962fbc1a769ca4e4966af7 Mon Sep 17 00:00:00 2001 From: "ptsayli@gmail.com" Date: Wed, 12 Aug 2020 11:32:03 +0530 Subject: [PATCH 3/4] add state sync to core.blockchain --- consensus/bor/bor.go | 7 ++-- core/blockchain.go | 11 ++++-- core/state_processor.go | 1 - core/types/block.go | 72 +++++++++++++++++---------------------- core/types/transaction.go | 8 ----- 5 files changed, 42 insertions(+), 57 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 2a81a2ad34..f112eefdd0 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -679,13 +679,13 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state // No block rewards in PoA, so the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) - header.SetStateSync(stateSyncData) + r := chain.(*core.BlockChain) + r.SetStateSync(stateSyncData) } // FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, // nor block rewards given, and returns the final block. func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) { - stateSyncData := []*types.StateData{} headerNumber := header.Number.Uint64() if headerNumber%c.config.Sprint == 0 { cx := chainContext{Chain: chain, Bor: c} @@ -699,7 +699,7 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Hea if !c.WithoutHeimdall { // commit statees - stateSyncData, err = c.CommitStates(state, header, cx) + _, err = c.CommitStates(state, header, cx) if err != nil { log.Error("Error while committing states", "error", err) return nil, err @@ -710,7 +710,6 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Hea // No block rewards in PoA, so the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) - header.SetStateSync(stateSyncData) // Assemble block block := types.NewBlock(header, txs, nil, receipts) diff --git a/core/blockchain.go b/core/blockchain.go index 952dea7dcc..1a0cfb6c26 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -180,6 +180,8 @@ type BlockChain struct { txLookupCache *lru.Cache // Cache for the most recent transaction lookup data. futureBlocks *lru.Cache // future blocks are blocks added for later processing + stateSyncData []*types.StateData + quit chan struct{} // blockchain quit channel wg sync.WaitGroup // chain processing wait group for shutting down running int32 // 0 if chain is running, 1 when stopped @@ -333,6 +335,11 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par return bc, nil } +// SetStateSync set sync data in block +func (bc *BlockChain) SetStateSync(stateData []*types.StateData) { + bc.stateSyncData = stateData +} + // GetVMConfig returns the block chain VM config. func (bc *BlockChain) GetVMConfig() *vm.Config { return &bc.vmConfig @@ -1793,9 +1800,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er // Process block using the parent state as reference point substart := time.Now() receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig) - syncData := block.StateSyncData() - - for _, data := range syncData { + for _, data := range bc.stateSyncData { bc.stateSyncFeed.Send(StateSyncEvent{StateData: data}) } if err != nil { diff --git a/core/state_processor.go b/core/state_processor.go index ec98e3ee4e..57faa93b72 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -77,7 +77,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg } // Finalize the block, applying any consensus engine specific extras (e.g. block rewards) p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles()) - block.SetStateSync(header.StateData()) return receipts, allLogs, *usedGas, nil } diff --git a/core/types/block.go b/core/types/block.go index c2ebaedd95..6baafa225d 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -66,26 +66,33 @@ func (n *BlockNonce) UnmarshalText(input []byte) error { return hexutil.UnmarshalFixedText("BlockNonce", input, n[:]) } +// StateData represents state received from Ethereum Blockchain +type StateData struct { + Did uint64 + Contract common.Address + Data string + TxHash common.Hash +} + //go:generate gencodec -type Header -field-override headerMarshaling -out gen_header_json.go // Header represents a block header in the Ethereum blockchain. type Header struct { - ParentHash common.Hash `json:"parentHash" gencodec:"required"` - UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` - Coinbase common.Address `json:"miner" gencodec:"required"` - Root common.Hash `json:"stateRoot" gencodec:"required"` - TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` - ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` - Bloom Bloom `json:"logsBloom" gencodec:"required"` - Difficulty *big.Int `json:"difficulty" gencodec:"required"` - Number *big.Int `json:"number" gencodec:"required"` - GasLimit uint64 `json:"gasLimit" gencodec:"required"` - GasUsed uint64 `json:"gasUsed" gencodec:"required"` - Time uint64 `json:"timestamp" gencodec:"required"` - Extra []byte `json:"extraData" gencodec:"required"` - MixDigest common.Hash `json:"mixHash"` - Nonce BlockNonce `json:"nonce"` - stateSyncData []*StateData + ParentHash common.Hash `json:"parentHash" gencodec:"required"` + UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` + Coinbase common.Address `json:"miner" gencodec:"required"` + Root common.Hash `json:"stateRoot" gencodec:"required"` + TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` + ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` + Bloom Bloom `json:"logsBloom" gencodec:"required"` + Difficulty *big.Int `json:"difficulty" gencodec:"required"` + Number *big.Int `json:"number" gencodec:"required"` + GasLimit uint64 `json:"gasLimit" gencodec:"required"` + GasUsed uint64 `json:"gasUsed" gencodec:"required"` + Time uint64 `json:"timestamp" gencodec:"required"` + Extra []byte `json:"extraData" gencodec:"required"` + MixDigest common.Hash `json:"mixHash"` + Nonce BlockNonce `json:"nonce"` } // field type overrides for gencodec @@ -113,21 +120,6 @@ func (h *Header) Size() common.StorageSize { return headerSize + common.StorageSize(len(h.Extra)+(h.Difficulty.BitLen()+h.Number.BitLen())/8) } -// SetStateSync set sync data in block -func (h *Header) SetStateSync(stateData []*StateData) { - h.stateSyncData = stateData -} - -// SetStateSync set sync data in block -func (h *Block) SetStateSync(stateData []*StateData) { - h.stateSyncData = stateData -} - -// StateSyncData set sync data in block -func (h *Header) StateData() []*StateData { - return h.stateSyncData -} - // SanityCheck checks a few basic things -- these checks are way beyond what // any 'sane' production values should hold, and can mainly be used to prevent // that the unbounded fields are stuffed with junk data to add processing @@ -172,10 +164,9 @@ type Body struct { // Block represents an entire block in the Ethereum blockchain. type Block struct { - header *Header - uncles []*Header - transactions Transactions - stateSyncData []*StateData + header *Header + uncles []*Header + transactions Transactions // caches hash atomic.Value @@ -328,12 +319,11 @@ func (b *Block) Transaction(hash common.Hash) *Transaction { return nil } -func (b *Block) Number() *big.Int { return new(big.Int).Set(b.header.Number) } -func (b *Block) GasLimit() uint64 { return b.header.GasLimit } -func (b *Block) GasUsed() uint64 { return b.header.GasUsed } -func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } -func (b *Block) Time() uint64 { return b.header.Time } -func (b *Block) StateSyncData() []*StateData { return b.stateSyncData } +func (b *Block) Number() *big.Int { return new(big.Int).Set(b.header.Number) } +func (b *Block) GasLimit() uint64 { return b.header.GasLimit } +func (b *Block) GasUsed() uint64 { return b.header.GasUsed } +func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } +func (b *Block) Time() uint64 { return b.header.Time } func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } diff --git a/core/types/transaction.go b/core/types/transaction.go index 55b3ac1036..866b715b73 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -60,14 +60,6 @@ type txdata struct { Hash *common.Hash `json:"hash" rlp:"-"` } -// State represents state received from Ethereum Blockchain -type StateData struct { - Did uint64 - Contract common.Address - Data string - TxHash common.Hash -} - type txdataMarshaling struct { AccountNonce hexutil.Uint64 Price *hexutil.Big From 722e246d07c78e5b14197f5f3ffd6f3bb6f54295 Mon Sep 17 00:00:00 2001 From: "ptsayli@gmail.com" Date: Wed, 12 Aug 2020 15:27:01 +0530 Subject: [PATCH 4/4] Fix: resolve comments --- consensus/bor/bor.go | 10 ++++++---- core/blockchain.go | 5 ++++- core/types/block.go | 8 -------- core/types/state_data.go | 11 +++++++++++ 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 core/types/state_data.go diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index f112eefdd0..9254062840 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -679,13 +679,14 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state // No block rewards in PoA, so the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) - r := chain.(*core.BlockChain) - r.SetStateSync(stateSyncData) + bc := chain.(*core.BlockChain) + bc.SetStateSync(stateSyncData) } // FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, // nor block rewards given, and returns the final block. func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) { + stateSyncData := []*types.StateData{} headerNumber := header.Number.Uint64() if headerNumber%c.config.Sprint == 0 { cx := chainContext{Chain: chain, Bor: c} @@ -699,7 +700,7 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Hea if !c.WithoutHeimdall { // commit statees - _, err = c.CommitStates(state, header, cx) + stateSyncData, err = c.CommitStates(state, header, cx) if err != nil { log.Error("Error while committing states", "error", err) return nil, err @@ -713,7 +714,8 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Hea // Assemble block block := types.NewBlock(header, txs, nil, receipts) - + bc := chain.(*core.BlockChain) + bc.SetStateSync(stateSyncData) // return the final block for sealing return block, nil } diff --git a/core/blockchain.go b/core/blockchain.go index 1a0cfb6c26..6ecab669b5 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -335,7 +335,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par return bc, nil } -// SetStateSync set sync data in block +// SetStateSync set sync data in state_data func (bc *BlockChain) SetStateSync(stateData []*types.StateData) { bc.stateSyncData = stateData } @@ -1548,6 +1548,9 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. // event here. if emitHeadEvent { bc.chainHeadFeed.Send(ChainHeadEvent{Block: block}) + for _, data := range bc.stateSyncData { + bc.stateSyncFeed.Send(StateSyncEvent{StateData: data}) + } } } else { bc.chainSideFeed.Send(ChainSideEvent{Block: block}) diff --git a/core/types/block.go b/core/types/block.go index 6baafa225d..be31b1a60a 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -66,14 +66,6 @@ func (n *BlockNonce) UnmarshalText(input []byte) error { return hexutil.UnmarshalFixedText("BlockNonce", input, n[:]) } -// StateData represents state received from Ethereum Blockchain -type StateData struct { - Did uint64 - Contract common.Address - Data string - TxHash common.Hash -} - //go:generate gencodec -type Header -field-override headerMarshaling -out gen_header_json.go // Header represents a block header in the Ethereum blockchain. diff --git a/core/types/state_data.go b/core/types/state_data.go new file mode 100644 index 0000000000..bd952627ac --- /dev/null +++ b/core/types/state_data.go @@ -0,0 +1,11 @@ +package types + +import "github.com/maticnetwork/bor/common" + +// StateData represents state received from Ethereum Blockchain +type StateData struct { + Did uint64 + Contract common.Address + Data string + TxHash common.Hash +}