From 05b197f559ae7c463b41529288f877aff76e650f Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 21 Jul 2021 10:57:35 +0300 Subject: [PATCH 01/32] data: add header v2 and interfaces --- data/block/block.go | 309 +++++++- data/block/block.pb.go | 136 ++-- data/block/blockV2.go | 511 +++++++++++++ data/block/blockV2.pb.go | 450 +++++++++++ data/block/blockV2_test.go | 704 ++++++++++++++++++ data/block/block_test.go | 62 +- data/block/economicsHandler.go | 129 ++++ data/block/epochStartHandler.go | 70 ++ data/block/epochStartShardDataHandler.go | 128 ++++ data/block/metaBlock.go | 343 ++++++++- data/block/metaBlock.pb.go | 266 +++---- data/block/metaBlock_test.go | 61 +- data/block/miniBlockHeader.go | 89 +++ data/block/peerBlock.go | 25 + data/block/proto/block.proto | 15 +- data/block/proto/blockV2.proto | 16 + data/block/shardDataHandler.go | 214 ++++++ data/errors.go | 15 + data/headerVersionData/shardHeader.go | 28 + data/interface.go | 191 ++++- data/receipt/receipt.pb.go | 52 +- data/rewardTx/rewardTx.go | 16 +- data/rewardTx/rewardTx.pb.go | 60 +- .../proto/smartContractResult.proto | 2 +- .../smartContractResult.pb.go | 136 ++-- data/transaction/transaction.pb.go | 78 +- go.mod | 2 +- go.sum | 28 + 28 files changed, 3650 insertions(+), 486 deletions(-) create mode 100644 data/block/blockV2.go create mode 100644 data/block/blockV2.pb.go create mode 100644 data/block/blockV2_test.go create mode 100644 data/block/economicsHandler.go create mode 100644 data/block/epochStartHandler.go create mode 100644 data/block/epochStartShardDataHandler.go create mode 100644 data/block/miniBlockHeader.go create mode 100644 data/block/peerBlock.go create mode 100644 data/block/proto/blockV2.proto create mode 100644 data/block/shardDataHandler.go create mode 100644 data/headerVersionData/shardHeader.go diff --git a/data/block/block.go b/data/block/block.go index 6e75fd255..c2d98eb44 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -5,8 +5,13 @@ import ( "math/big" "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" ) +// TODO: add access protection through wrappers +var _ = data.HeaderHandler(&Header{}) +var _ = data.ShardHeaderHandler(&Header{}) + // MiniBlockSlice should be used when referring to subset of mini blocks that is not // necessarily representing a full block body type MiniBlockSlice []*MiniBlock @@ -18,27 +23,53 @@ type MiniblockAndHash struct { } // SetNonce sets header nonce -func (h *Header) SetNonce(n uint64) { +func (h *Header) SetNonce(n uint64) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.Nonce = n + return nil } // SetEpoch sets header epoch -func (h *Header) SetEpoch(e uint32) { +func (h *Header) SetEpoch(e uint32) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.Epoch = e + return nil } // SetRound sets header round -func (h *Header) SetRound(r uint64) { +func (h *Header) SetRound(r uint64) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.Round = r + return nil } // SetRootHash sets root hash -func (h *Header) SetRootHash(rHash []byte) { +func (h *Header) SetRootHash(rHash []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.RootHash = rHash + return nil } -// SetValidatorStatsRootHash set's the root hash for the validator statistics trie -func (h *Header) SetValidatorStatsRootHash(_ []byte) { +// SetPrevHash sets prev hash +func (h *Header) SetPrevHash(pvHash []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + + h.PrevHash = pvHash + return nil } // GetValidatorStatsRootHash set's the root hash for the validator statistics trie @@ -46,73 +77,137 @@ func (h *Header) GetValidatorStatsRootHash() []byte { return []byte{} } -// SetPrevHash sets prev hash -func (h *Header) SetPrevHash(pvHash []byte) { - h.PrevHash = pvHash -} // SetPrevRandSeed sets previous random seed -func (h *Header) SetPrevRandSeed(pvRandSeed []byte) { +func (h *Header) SetPrevRandSeed(pvRandSeed []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.PrevRandSeed = pvRandSeed + return nil } // SetRandSeed sets previous random seed -func (h *Header) SetRandSeed(randSeed []byte) { +func (h *Header) SetRandSeed(randSeed []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.RandSeed = randSeed + return nil } -// SetPubKeysBitmap sets publick key bitmap -func (h *Header) SetPubKeysBitmap(pkbm []byte) { +// SetPubKeysBitmap sets public key bitmap +func (h *Header) SetPubKeysBitmap(pkbm []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.PubKeysBitmap = pkbm + return nil } // SetSignature sets header signature -func (h *Header) SetSignature(sg []byte) { +func (h *Header) SetSignature(sg []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.Signature = sg + return nil } // SetLeaderSignature will set the leader's signature -func (h *Header) SetLeaderSignature(sg []byte) { +func (h *Header) SetLeaderSignature(sg []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.LeaderSignature = sg + return nil } // SetChainID sets the chain ID on which this block is valid on -func (h *Header) SetChainID(chainID []byte) { +func (h *Header) SetChainID(chainID []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.ChainID = chainID + return nil } // SetSoftwareVersion sets the software version of the header -func (h *Header) SetSoftwareVersion(version []byte) { +func (h *Header) SetSoftwareVersion(version []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.SoftwareVersion = version + return nil } // SetTimeStamp sets header timestamp -func (h *Header) SetTimeStamp(ts uint64) { +func (h *Header) SetTimeStamp(ts uint64) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.TimeStamp = ts + return nil } // SetAccumulatedFees sets the accumulated fees in the header -func (h *Header) SetAccumulatedFees(value *big.Int) { +func (h *Header) SetAccumulatedFees(value *big.Int) error { + if h == nil { + return data.ErrNilPointerReceiver + } + if h.AccumulatedFees == nil { + h.AccumulatedFees = big.NewInt(0) + } h.AccumulatedFees.Set(value) + return nil } // SetDeveloperFees sets the developer fees in the header -func (h *Header) SetDeveloperFees(value *big.Int) { +func (h *Header) SetDeveloperFees(value *big.Int) error { + if h == nil { + return data.ErrNilPointerReceiver + } + if h.DeveloperFees == nil { + h.DeveloperFees = big.NewInt(0) + } h.DeveloperFees.Set(value) + return nil } // SetTxCount sets the transaction count of the block associated with this header -func (h *Header) SetTxCount(txCount uint32) { +func (h *Header) SetTxCount(txCount uint32) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.TxCount = txCount + return nil } // SetShardID sets header shard ID -func (h *Header) SetShardID(shId uint32) { +func (h *Header) SetShardID(shId uint32) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.ShardID = shId + return nil } // GetMiniBlockHeadersWithDst as a map of hashes and sender IDs func (h *Header) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 { + if h == nil { + return nil + } + hashDst := make(map[string]uint32) for _, val := range h.MiniBlockHeaders { if val.ReceiverShardID == destId && val.SenderShardID != destId { @@ -125,6 +220,9 @@ func (h *Header) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 { // GetOrderedCrossMiniblocksWithDst gets all cross miniblocks with the given destination shard ID, ordered in a // chronological way, taking into consideration the round in which they were created/executed in the sender shard func (h *Header) GetOrderedCrossMiniblocksWithDst(destId uint32) []*data.MiniBlockInfo { + if h == nil { + return nil + } miniBlocks := make([]*data.MiniBlockInfo, 0) for _, mb := range h.MiniBlockHeaders { @@ -142,6 +240,10 @@ func (h *Header) GetOrderedCrossMiniblocksWithDst(destId uint32) []*data.MiniBlo // GetMiniBlockHeadersHashes gets the miniblock hashes func (h *Header) GetMiniBlockHeadersHashes() [][]byte { + if h == nil { + return nil + } + result := make([][]byte, 0, len(h.MiniBlockHeaders)) for _, miniblock := range h.MiniBlockHeaders { result = append(result, miniblock.Hash) @@ -151,6 +253,10 @@ func (h *Header) GetMiniBlockHeadersHashes() [][]byte { // MapMiniBlockHashesToShards is a map of mini block hashes and sender IDs func (h *Header) MapMiniBlockHashesToShards() map[string]uint32 { + if h == nil { + return nil + } + hashDst := make(map[string]uint32) for _, val := range h.MiniBlockHeaders { hashDst[string(val.Hash)] = val.SenderShardID @@ -158,16 +264,128 @@ func (h *Header) MapMiniBlockHashesToShards() map[string]uint32 { return hashDst } -// Clone returns a clone of the object -func (h *Header) Clone() data.HeaderHandler { +// ShallowClone returns a clone of the object +func (h *Header) ShallowClone() data.HeaderHandler { + if h == nil { + return nil + } + headerCopy := *h return &headerCopy } +// IsInterfaceNil returns true if there is no value under the interface +func (h *Header) IsInterfaceNil() bool { + return h == nil +} + +// IsStartOfEpochBlock verifies if the block is of type start of epoch +func (h *Header) IsStartOfEpochBlock() bool { + if h == nil { + return false + } + + return len(h.EpochStartMetaHash) > 0 +} + +// GetBlockBodyTypeInt32 returns the block body type as int32 +func (h *Header) GetBlockBodyTypeInt32() int32 { + if h == nil { + return -1 + } + + return int32(h.GetBlockBodyType()) +} + +// GetMiniBlockHeaderHandlers returns the miniBlock headers as an array of miniBlock header handlers +func (h *Header) GetMiniBlockHeaderHandlers() []data.MiniBlockHeaderHandler { + if h == nil { + return nil + } + + mbHeaders := h.GetMiniBlockHeaders() + mbHeaderHandlers := make([]data.MiniBlockHeaderHandler, len(mbHeaders)) + + for i := range mbHeaders { + mbHeaderHandlers[i] = &mbHeaders[i] + } + + return mbHeaderHandlers +} + +// SetMiniBlockHeaderHandlers sets the miniBlock headers from the given miniBlock header handlers +func (h *Header) SetMiniBlockHeaderHandlers(mbHeaderHandlers []data.MiniBlockHeaderHandler) error { + if h == nil { + return data.ErrNilPointerReceiver + } + if len(mbHeaderHandlers) == 0 { + h.MiniBlockHeaders = nil + return nil + } + + miniBlockHeaders := make([]MiniBlockHeader, len(mbHeaderHandlers)) + h.MiniBlockHeaders = make([]MiniBlockHeader, len(mbHeaderHandlers)) + for i, mbHeaderHandler := range mbHeaderHandlers { + mbHeader, ok := mbHeaderHandler.(*MiniBlockHeader) + if !ok { + return data.ErrInvalidTypeAssertion + } + if mbHeader == nil { + return data.ErrNilPointerDereference + } + miniBlockHeaders[i] = *mbHeader + } + + h.MiniBlockHeaders = miniBlockHeaders + return nil +} + +// SetReceiptsHash sets the receipts hash +func (h *Header) SetReceiptsHash(hash []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.ReceiptsHash = hash + return nil +} + +// SetMetaBlockHashes sets the metaBlock hashes +func (h *Header) SetMetaBlockHashes(hashes [][]byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.MetaBlockHashes = hashes + return nil +} + +// SetScheduledRootHash not supported by V1 header +func (h *Header) SetScheduledRootHash(_ []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + + return data.ErrScheduledRootHashNotSupported +} + +// SetEpochStartMetaHash sets the epoch start metaBlock hash +func (h *Header) SetEpochStartMetaHash(hash []byte) error { + if h == nil { + return data.ErrNilPointerReceiver + } + h.EpochStartMetaHash = hash + return nil +} + +// ValidateHeaderVersion does extra validation for header version +func (h *Header) ValidateHeaderVersion() error { + // no extra validation for v1 header + return nil +} + // IntegrityAndValidity checks if data is valid func (b *Body) IntegrityAndValidity() error { - if b.IsInterfaceNil() { - return data.ErrNilBlockBody + if b == nil { + return data.ErrNilPointerReceiver } for i := 0; i < len(b.MiniBlocks); i++ { @@ -181,6 +399,10 @@ func (b *Body) IntegrityAndValidity() error { // Clone returns a clone of the object func (b *Body) Clone() data.BodyHandler { + if b == nil { + return nil + } + bodyCopy := *b return &bodyCopy @@ -191,18 +413,12 @@ func (b *Body) IsInterfaceNil() bool { return b == nil } -// IsInterfaceNil returns true if there is no value under the interface -func (h *Header) IsInterfaceNil() bool { - return h == nil -} - -// IsStartOfEpochBlock verifies if the block is of type start of epoch -func (h *Header) IsStartOfEpochBlock() bool { - return len(h.EpochStartMetaHash) > 0 -} - // Clone the underlying data func (mb *MiniBlock) Clone() *MiniBlock { + if mb == nil { + return nil + } + newMb := &MiniBlock{ ReceiverShardID: mb.ReceiverShardID, SenderShardID: mb.SenderShardID, @@ -213,3 +429,22 @@ func (mb *MiniBlock) Clone() *MiniBlock { return newMb } + +// IsScheduledMiniBlock returns if the mini block is of type scheduled or not +func (mb *MiniBlock) IsScheduledMiniBlock() bool { + if mb == nil { + return false + } + return len(mb.Reserved) > 0 && mb.Reserved[0] == byte(ScheduledBlock) +} + +// SetAdditionalData sets the additional data for the header +func (h *Header) SetAdditionalData(_ headerVersionData.HeaderAdditionalData) error { + // first header version does not have any additional data + return nil +} + +// HasScheduledSupport returns false as the first block version does not support scheduled data +func (h *Header) HasScheduledSupport() bool { + return false +} diff --git a/data/block/block.pb.go b/data/block/block.pb.go index 6b8fa2b4a..f1e96afc1 100644 --- a/data/block/block.pb.go +++ b/data/block/block.pb.go @@ -6,7 +6,7 @@ package block import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -39,6 +39,7 @@ const ( SmartContractResultBlock Type = 90 InvalidBlock Type = 120 ReceiptBlock Type = 150 + ScheduledBlock Type = 180 RewardsBlock Type = 255 ) @@ -49,6 +50,7 @@ var Type_name = map[int32]string{ 90: "SmartContractResultBlock", 120: "InvalidBlock", 150: "ReceiptBlock", + 180: "ScheduledBlock", 255: "RewardsBlock", } @@ -59,6 +61,7 @@ var Type_value = map[string]int32{ "SmartContractResultBlock": 90, "InvalidBlock": 120, "ReceiptBlock": 150, + "ScheduledBlock": 180, "RewardsBlock": 255, } @@ -589,63 +592,64 @@ func init() { func init() { proto.RegisterFile("block.proto", fileDescriptor_8e550b1f5926e92d) } var fileDescriptor_8e550b1f5926e92d = []byte{ - // 882 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x6f, 0x23, 0x45, - 0x14, 0xf6, 0x24, 0xb6, 0x73, 0x19, 0xdb, 0x89, 0x33, 0x1c, 0x61, 0x74, 0x3a, 0x6d, 0x2c, 0xeb, - 0x0a, 0x0b, 0xe9, 0x6c, 0x08, 0x0d, 0x88, 0x93, 0xd0, 0xd9, 0xc9, 0x29, 0x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, 0x76, 0x21, 0x8a, 0x47, 0xda, 0x5a, 0xdf, 0xb2, 0x2a, 0x2d, - 0x77, 0xc3, 0xa9, 0x18, 0x05, 0xbe, 0x65, 0x2e, 0xd9, 0xde, 0x5c, 0x3e, 0x96, 0xf9, 0x99, 0x58, - 0xea, 0x42, 0x28, 0x3f, 0xb2, 0xd4, 0xbf, 0xa4, 0xfd, 0xcd, 0xf5, 0xad, 0x93, 0xbb, 0xb9, 0x75, - 0x72, 0xf7, 0xb7, 0x0e, 0xf9, 0x61, 0xe6, 0x90, 0x5f, 0x66, 0x0e, 0x79, 0x3f, 0x73, 0xc8, 0xf5, - 0xcc, 0x21, 0x37, 0x33, 0x87, 0xfc, 0x35, 0x73, 0xc8, 0xdf, 0x33, 0x27, 0x77, 0x3f, 0x73, 0xc8, - 0x4f, 0x77, 0x4e, 0xee, 0xfa, 0xce, 0xc9, 0xdd, 0xdc, 0x39, 0xb9, 0xb7, 0x05, 0xfc, 0x1b, 0xed, - 0x15, 0x71, 0x4c, 0x5f, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x18, 0x2f, 0x4f, 0x6d, 0x56, 0x07, - 0x00, 0x00, + // 900 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x3d, 0x6f, 0x1b, 0x47, + 0x10, 0xe5, 0x4a, 0x24, 0x2d, 0x2d, 0x3f, 0x44, 0xad, 0x1d, 0xe5, 0x60, 0x18, 0x27, 0x82, 0x70, + 0x41, 0x04, 0x10, 0x99, 0x28, 0x4d, 0x82, 0x18, 0x08, 0x42, 0xca, 0x82, 0x98, 0xc4, 0x86, 0x70, + 0x27, 0xa4, 0x70, 0xb7, 0xbc, 0x1b, 0x93, 0x07, 0x93, 0xb7, 0xc4, 0xde, 0x1e, 0x25, 0x75, 0xfe, + 0x09, 0xa9, 0xd2, 0xa5, 0x0f, 0x52, 0xfb, 0x47, 0xb8, 0x48, 0xa1, 0x52, 0x55, 0x12, 0x9d, 0x9a, + 0x94, 0xfe, 0x07, 0x09, 0x76, 0xf6, 0x8e, 0x1f, 0x27, 0x15, 0x29, 0x5c, 0x89, 0xef, 0xcd, 0xec, + 0xce, 0x9b, 0xd9, 0x77, 0x23, 0x5a, 0x19, 0x4e, 0x84, 0xf7, 0xa6, 0x33, 0x93, 0x42, 0x09, 0x56, + 0xc2, 0x3f, 0x8f, 0x0f, 0x46, 0x81, 0x1a, 0xc7, 0xc3, 0x8e, 0x27, 0xa6, 0xdd, 0x91, 0x18, 0x89, + 0x2e, 0xd2, 0xc3, 0xf8, 0x35, 0x22, 0x04, 0xf8, 0xcb, 0x9c, 0x6a, 0xbd, 0x23, 0x74, 0xfb, 0x45, + 0x10, 0x06, 0x3d, 0x7d, 0x13, 0x7b, 0x4c, 0xb7, 0xce, 0x2e, 0x4e, 0x78, 0x34, 0x86, 0xc8, 0x22, + 0xcd, 0xcd, 0x76, 0xd5, 0x59, 0x60, 0xd6, 0xa6, 0x3b, 0x0e, 0x78, 0x10, 0xcc, 0x41, 0xba, 0x63, + 0x2e, 0xfd, 0xc1, 0x91, 0xb5, 0xd1, 0x24, 0xed, 0x9a, 0x93, 0xa7, 0xd9, 0x53, 0x5a, 0x73, 0x21, + 0xf4, 0x97, 0x79, 0x9b, 0x98, 0xb7, 0x4e, 0xb2, 0x7d, 0x5a, 0x3c, 0xbb, 0x9c, 0x81, 0x55, 0x6c, + 0x92, 0x76, 0xfd, 0xb0, 0x62, 0xf4, 0x74, 0x34, 0xe5, 0x60, 0x40, 0x8b, 0x71, 0x20, 0x02, 0x39, + 0x07, 0xdf, 0x2a, 0x35, 0x89, 0x16, 0x93, 0xe1, 0xd6, 0x1f, 0x84, 0xee, 0x2c, 0x64, 0x9f, 0x00, + 0xf7, 0x41, 0x32, 0x46, 0x8b, 0x5a, 0xaa, 0x45, 0x30, 0x17, 0x7f, 0xdf, 0x95, 0xb2, 0x71, 0x9f, + 0x94,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76, 0x17, + 0x46, 0x32, 0xcc, 0x2f, 0x84, 0x3d, 0xa4, 0x75, 0xd7, 0x1b, 0x83, 0x1f, 0x4f, 0x20, 0x4d, 0x7b, + 0x47, 0x4c, 0xde, 0x39, 0x97, 0x7e, 0x64, 0xa8, 0x7f, 0x49, 0xef, 0xdb, 0xab, 0x1b, 0xbb, 0x70, + 0x7d, 0x63, 0x17, 0x3e, 0xdc, 0xd8, 0xe4, 0x6d, 0x62, 0x93, 0xdf, 0x12, 0x9b, 0xbc, 0x4f, 0x6c, + 0x72, 0x95, 0xd8, 0xe4, 0x3a, 0xb1, 0xc9, 0xdf, 0x89, 0x4d, 0xfe, 0x49, 0xec, 0xc2, 0x87, 0xc4, + 0x26, 0x3f, 0xdf, 0xda, 0x85, 0xab, 0x5b, 0xbb, 0x70, 0x7d, 0x6b, 0x17, 0x5e, 0x95, 0xf0, 0xbf, + 0xec, 0xb0, 0x8c, 0xb3, 0xfb, 0xf2, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x2f, 0x1f, 0x60, + 0x75, 0x07, 0x00, 0x00, } func (x Type) String() string { @@ -860,13 +864,13 @@ func (this *Header) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.AccumulatedFees, that1.AccumulatedFees) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.DeveloperFees, that1.DeveloperFees) { return false } @@ -1224,7 +1228,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xc2 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.DeveloperFees) i -= size if _, err := __caster.MarshalTo(m.DeveloperFees, dAtA[i:]); err != nil { @@ -1237,7 +1241,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xba { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.AccumulatedFees) i -= size if _, err := __caster.MarshalTo(m.AccumulatedFees, dAtA[i:]); err != nil { @@ -1661,12 +1665,12 @@ func (m *Header) Size() (n int) { n += 2 + l + sovBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.AccumulatedFees) n += 2 + l + sovBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.DeveloperFees) n += 2 + l + sovBlock(uint64(l)) } @@ -2977,7 +2981,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3015,7 +3019,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { diff --git a/data/block/blockV2.go b/data/block/blockV2.go new file mode 100644 index 000000000..b3c380a0f --- /dev/null +++ b/data/block/blockV2.go @@ -0,0 +1,511 @@ +//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. blockV2.proto +package block + +import ( + "math/big" + + "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" +) + +// GetShardID returns the header shardID +func (hv2 *HeaderV2) GetShardID() uint32 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetShardID() +} + +// GetNonce returns the header nonce +func (hv2 *HeaderV2) GetNonce() uint64 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetNonce() +} + +// GetEpoch returns the header epoch +func (hv2 *HeaderV2) GetEpoch() uint32 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetEpoch() +} + +// GetRound returns the header round +func (hv2 *HeaderV2) GetRound() uint64 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetRound() +} + +// GetRootHash returns the header root hash +func (hv2 *HeaderV2) GetRootHash() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetRootHash() +} + +// GetPrevHash returns the header previous header hash +func (hv2 *HeaderV2) GetPrevHash() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetPrevHash() +} + +// GetPrevRandSeed returns the header previous random seed +func (hv2 *HeaderV2) GetPrevRandSeed() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetPrevRandSeed() +} + +// GetRandSeed returns the header random seed +func (hv2 *HeaderV2) GetRandSeed() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetRandSeed() +} + +// GetPubKeysBitmap returns the header public key bitmap for the aggregated signatures +func (hv2 *HeaderV2) GetPubKeysBitmap() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetPubKeysBitmap() +} + +// GetSignature returns the header aggregated signature +func (hv2 *HeaderV2) GetSignature() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetSignature() +} + +// GetLeaderSignature returns the leader signature on top of the finalized (signed) header +func (hv2 *HeaderV2) GetLeaderSignature() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetLeaderSignature() +} + +// GetChainID returns the chain ID +func (hv2 *HeaderV2) GetChainID() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetChainID() +} + +// GetSoftwareVersion returns the header software version +func (hv2 *HeaderV2) GetSoftwareVersion() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetSoftwareVersion() +} + +// GetTimeStamp returns the header timestamp +func (hv2 *HeaderV2) GetTimeStamp() uint64 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetTimeStamp() +} + +// GetTxCount returns the number of txs included in the block +func (hv2 *HeaderV2) GetTxCount() uint32 { + if hv2 == nil { + return 0 + } + + return hv2.Header.GetTxCount() +} + +// GetReceiptsHash returns the header receipt hash +func (hv2 *HeaderV2) GetReceiptsHash() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetReceiptsHash() +} + +// GetAccumulatedFees returns the block accumulated fees +func (hv2 *HeaderV2) GetAccumulatedFees() *big.Int { + if hv2 == nil { + return nil + } + + return hv2.Header.GetAccumulatedFees() +} + +// GetDeveloperFees returns the block developer fees +func (hv2 *HeaderV2) GetDeveloperFees() *big.Int { + if hv2 == nil { + return nil + } + + return hv2.Header.GetDeveloperFees() +} + +// GetReserved returns the reserved field +func (hv2 *HeaderV2) GetReserved() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetReserved() +} + +// GetMetaBlockHashes returns the metaBlock hashes +func (hv2 *HeaderV2) GetMetaBlockHashes() [][]byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetMetaBlockHashes() +} + +// GetEpochStartMetaHash returns the epoch start metaBlock hash +func (hv2 *HeaderV2) GetEpochStartMetaHash() []byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetEpochStartMetaHash() +} + +// SetNonce sets header nonce +func (hv2 *HeaderV2) SetNonce(n uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + return hv2.Header.SetNonce(n) +} + +// SetEpoch sets header epoch +func (hv2 *HeaderV2) SetEpoch(e uint32) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetEpoch(e) +} + +// SetRound sets header round +func (hv2 *HeaderV2) SetRound(r uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetRound(r) +} + +// SetRootHash sets root hash +func (hv2 *HeaderV2) SetRootHash(rHash []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetRootHash(rHash) +} + +// SetPrevHash sets prev hash +func (hv2 *HeaderV2) SetPrevHash(pvHash []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetPrevHash(pvHash) +} + +// SetPrevRandSeed sets previous random seed +func (hv2 *HeaderV2) SetPrevRandSeed(pvRandSeed []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetPrevRandSeed(pvRandSeed) +} + +// SetRandSeed sets previous random seed +func (hv2 *HeaderV2) SetRandSeed(randSeed []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetRandSeed(randSeed) +} + +// SetPubKeysBitmap sets public key bitmap +func (hv2 *HeaderV2) SetPubKeysBitmap(pkbm []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetPubKeysBitmap(pkbm) +} + +// SetSignature sets header signature +func (hv2 *HeaderV2) SetSignature(sg []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetSignature(sg) +} + +// SetLeaderSignature will set the leader's signature +func (hv2 *HeaderV2) SetLeaderSignature(sg []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetLeaderSignature(sg) +} + +// SetChainID sets the chain ID on which this block is valid on +func (hv2 *HeaderV2) SetChainID(chainID []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetChainID(chainID) +} + +// SetSoftwareVersion sets the software version of the header +func (hv2 *HeaderV2) SetSoftwareVersion(version []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetSoftwareVersion(version) +} + +// SetTimeStamp sets header timestamp +func (hv2 *HeaderV2) SetTimeStamp(ts uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetTimeStamp(ts) +} + +// SetAccumulatedFees sets the accumulated fees in the header +func (hv2 *HeaderV2) SetAccumulatedFees(value *big.Int) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetAccumulatedFees(value) +} + +// SetDeveloperFees sets the developer fees in the header +func (hv2 *HeaderV2) SetDeveloperFees(value *big.Int) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetDeveloperFees(value) +} + +// SetTxCount sets the transaction count of the block associated with this header +func (hv2 *HeaderV2) SetTxCount(txCount uint32) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetTxCount(txCount) +} + +// SetShardID sets header shard ID +func (hv2 *HeaderV2) SetShardID(shId uint32) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetShardID(shId) +} + +// GetMiniBlockHeadersWithDst as a map of hashes and sender IDs +func (hv2 *HeaderV2) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 { + if hv2 == nil { + return nil + } + + return hv2.Header.GetMiniBlockHeadersWithDst(destId) +} + +// GetOrderedCrossMiniblocksWithDst gets all cross miniblocks with the given destination shard ID, ordered in a +// chronological way, taking into consideration the round in which they were created/executed in the sender shard +func (hv2 *HeaderV2) GetOrderedCrossMiniblocksWithDst(destId uint32) []*data.MiniBlockInfo { + if hv2 == nil { + return nil + } + + return hv2.Header.GetOrderedCrossMiniblocksWithDst(destId) +} + +// GetMiniBlockHeadersHashes gets the miniblock hashes +func (hv2 *HeaderV2) GetMiniBlockHeadersHashes() [][]byte { + if hv2 == nil { + return nil + } + + return hv2.Header.GetMiniBlockHeadersHashes() +} + +// MapMiniBlockHashesToShards is a map of mini block hashes and sender IDs +func (hv2 *HeaderV2) MapMiniBlockHashesToShards() map[string]uint32 { + if hv2 == nil { + return nil + } + + return hv2.Header.MapMiniBlockHashesToShards() +} + +// ShallowClone returns a clone of the object +func (hv2 *HeaderV2) ShallowClone() data.HeaderHandler { + if hv2 == nil || hv2.Header == nil { + return nil + } + + internalHeaderCopy := *hv2.Header + headerCopy := *hv2 + headerCopy.Header = &internalHeaderCopy + + return &headerCopy +} + +// IsInterfaceNil returns true if there is no value under the interface +func (hv2 *HeaderV2) IsInterfaceNil() bool { + return hv2 == nil +} + +// IsStartOfEpochBlock verifies if the block is of type start of epoch +func (hv2 *HeaderV2) IsStartOfEpochBlock() bool { + if hv2 == nil { + return false + } + + return hv2.Header.IsStartOfEpochBlock() +} + +// GetBlockBodyTypeInt32 returns the block body type as int32 +func (hv2 *HeaderV2) GetBlockBodyTypeInt32() int32 { + if hv2 == nil { + return -1 + } + + return hv2.Header.GetBlockBodyTypeInt32() +} + +// GetMiniBlockHeaderHandlers returns the miniBlock headers as an array of miniBlock header handlers +func (hv2 *HeaderV2) GetMiniBlockHeaderHandlers() []data.MiniBlockHeaderHandler { + if hv2 == nil { + return nil + } + + return hv2.Header.GetMiniBlockHeaderHandlers() +} + +// SetMiniBlockHeaderHandlers sets the miniBlock headers from the given miniBlock header handlers +func (hv2 *HeaderV2) SetMiniBlockHeaderHandlers(mbHeaderHandlers []data.MiniBlockHeaderHandler) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetMiniBlockHeaderHandlers(mbHeaderHandlers) +} + +// SetReceiptsHash sets the receipts hash +func (hv2 *HeaderV2) SetReceiptsHash(hash []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetReceiptsHash(hash) +} + +// SetMetaBlockHashes sets the metaBlock hashes +func (hv2 *HeaderV2) SetMetaBlockHashes(hashes [][]byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetMetaBlockHashes(hashes) +} + +// SetEpochStartMetaHash sets the epoch start metaBlock hash +func (hv2 *HeaderV2) SetEpochStartMetaHash(hash []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + return hv2.Header.SetEpochStartMetaHash(hash) +} + +// HasScheduledSupport returns true as the second block version does support scheduled data +func (hv2 *HeaderV2) HasScheduledSupport() bool { + return true +} + +// SetScheduledRootHash sets the scheduled root hash +func (hv2 *HeaderV2) SetScheduledRootHash(rootHash []byte) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + hv2.ScheduledRootHash = rootHash + + return nil +} + +// ValidateHeaderVersion does extra validation for header version +func (hv2 *HeaderV2) ValidateHeaderVersion() error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + // the header needs to have a not nil & not empty scheduled root hash + if len(hv2.ScheduledRootHash) == 0 { + return data.ErrNilScheduledRootHash + } + + return hv2.Header.ValidateHeaderVersion() +} + +// SetAdditionalData sets the additional version related data for the header +func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.HeaderAdditionalData) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + + if check.IfNil(headerVersionData) { + return data.ErrNilPointerDereference + } + return hv2.SetScheduledRootHash(headerVersionData.GetScheduledRootHash()) +} diff --git a/data/block/blockV2.pb.go b/data/block/blockV2.pb.go new file mode 100644 index 000000000..f14cf7441 --- /dev/null +++ b/data/block/blockV2.pb.go @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: blockV2.proto + +package block + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// HeaderV2 extends the Header structure with extra fields for version 2 +type HeaderV2 struct { + Header *Header `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"` + ScheduledRootHash []byte `protobuf:"bytes,2,opt,name=ScheduledRootHash,proto3" json:"ScheduledRootHash,omitempty"` +} + +func (m *HeaderV2) Reset() { *m = HeaderV2{} } +func (*HeaderV2) ProtoMessage() {} +func (*HeaderV2) Descriptor() ([]byte, []int) { + return fileDescriptor_17a3844aa051366e, []int{0} +} +func (m *HeaderV2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HeaderV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderV2.Merge(m, src) +} +func (m *HeaderV2) XXX_Size() int { + return m.Size() +} +func (m *HeaderV2) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderV2.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderV2 proto.InternalMessageInfo + +func (m *HeaderV2) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *HeaderV2) GetScheduledRootHash() []byte { + if m != nil { + return m.ScheduledRootHash + } + return nil +} + +func init() { + proto.RegisterType((*HeaderV2)(nil), "proto.HeaderV2") +} + +func init() { proto.RegisterFile("blockV2.proto", fileDescriptor_17a3844aa051366e) } + +var fileDescriptor_17a3844aa051366e = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0xca, 0xc9, 0x4f, + 0xce, 0x0e, 0x33, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x52, 0xba, 0xe9, + 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, + 0xe1, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20, 0xba, 0xa4, 0xb8, 0xc1, 0x86, 0x40, + 0x38, 0x4a, 0xf1, 0x5c, 0x1c, 0x1e, 0xa9, 0x89, 0x29, 0xa9, 0x45, 0x61, 0x46, 0x42, 0xaa, 0x5c, + 0x6c, 0x10, 0xb6, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x11, 0x2f, 0x44, 0x8d, 0x1e, 0x44, 0x30, + 0x08, 0x2a, 0x29, 0xa4, 0xc3, 0x25, 0x18, 0x9c, 0x9c, 0x91, 0x9a, 0x52, 0x9a, 0x93, 0x9a, 0x12, + 0x94, 0x9f, 0x5f, 0xe2, 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x84, 0x29, + 0xe1, 0x64, 0x7f, 0xe1, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0x31, 0x36, + 0x3c, 0x92, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, + 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x56, + 0xb0, 0x3b, 0x93, 0xd8, 0xc0, 0x8e, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x49, 0x00, 0xac, + 0x00, 0xfc, 0x00, 0x00, 0x00, +} + +func (this *HeaderV2) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderV2) + if !ok { + that2, ok := that.(HeaderV2) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Header.Equal(that1.Header) { + return false + } + if !bytes.Equal(this.ScheduledRootHash, that1.ScheduledRootHash) { + return false + } + return true +} +func (this *HeaderV2) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&block.HeaderV2{") + if this.Header != nil { + s = append(s, "Header: "+fmt.Sprintf("%#v", this.Header)+",\n") + } + s = append(s, "ScheduledRootHash: "+fmt.Sprintf("%#v", this.ScheduledRootHash)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringBlockV2(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *HeaderV2) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderV2) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ScheduledRootHash) > 0 { + i -= len(m.ScheduledRootHash) + copy(dAtA[i:], m.ScheduledRootHash) + i = encodeVarintBlockV2(dAtA, i, uint64(len(m.ScheduledRootHash))) + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBlockV2(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBlockV2(dAtA []byte, offset int, v uint64) int { + offset -= sovBlockV2(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *HeaderV2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovBlockV2(uint64(l)) + } + l = len(m.ScheduledRootHash) + if l > 0 { + n += 1 + l + sovBlockV2(uint64(l)) + } + return n +} + +func sovBlockV2(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBlockV2(x uint64) (n int) { + return sovBlockV2(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *HeaderV2) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HeaderV2{`, + `Header:` + strings.Replace(fmt.Sprintf("%v", this.Header), "Header", "Header", 1) + `,`, + `ScheduledRootHash:` + fmt.Sprintf("%v", this.ScheduledRootHash) + `,`, + `}`, + }, "") + return s +} +func valueToStringBlockV2(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *HeaderV2) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderV2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderV2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledRootHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ScheduledRootHash = append(m.ScheduledRootHash[:0], dAtA[iNdEx:postIndex]...) + if m.ScheduledRootHash == nil { + m.ScheduledRootHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockV2(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBlockV2(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthBlockV2 + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBlockV2 + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBlockV2 + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBlockV2 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlockV2 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlockV2 = fmt.Errorf("proto: unexpected end of group") +) diff --git a/data/block/blockV2_test.go b/data/block/blockV2_test.go new file mode 100644 index 000000000..056a29760 --- /dev/null +++ b/data/block/blockV2_test.go @@ -0,0 +1,704 @@ +package block_test + +import ( + "testing" + + "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/block" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" + "github.com/stretchr/testify/require" +) + +func TestHeaderV2_GetEpochNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, uint32(0), h.GetEpoch()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, uint32(0), h.GetEpoch()) +} + +func TestHeaderV2_GetEpoch(t *testing.T) { + t.Parallel() + + epoch := uint32(1) + h := &block.HeaderV2{ + Header: &block.Header{ + Epoch: epoch, + }, + } + + require.Equal(t, epoch, h.GetEpoch()) +} + +func TestHeaderV2_GetShardNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, uint32(0), h.GetShardID()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, uint32(0), h.GetShardID()) +} + +func TestHeaderV2_GetShard(t *testing.T) { + t.Parallel() + + shardId := uint32(2) + h := &block.HeaderV2{ + Header: &block.Header{ + ShardID: shardId, + }, + } + + require.Equal(t, shardId, h.GetShardID()) +} +func TestHeaderV2_GetNonceNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, uint64(0), h.GetNonce()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, uint64(0), h.GetNonce()) +} + +func TestHeaderV2_GetNonce(t *testing.T) { + t.Parallel() + + nonce := uint64(2) + h := &block.HeaderV2{ + Header: &block.Header{ + Nonce: nonce, + }, + } + + require.Equal(t, nonce, h.GetNonce()) +} + +func TestHeaderV2_GetPrevHashNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetPrevHash()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetPrevHash()) +} + +func TestHeaderV2_GetPrevHash(t *testing.T) { + t.Parallel() + + prevHash := []byte("prev hash") + h := &block.HeaderV2{ + Header: &block.Header{ + PrevHash: prevHash, + }, + } + + require.Equal(t, prevHash, h.GetPrevHash()) +} + +func TestHeaderV2_GetPrevRandSeedNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetPrevRandSeed()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetPrevRandSeed()) +} + +func TestHeaderV2_GetPrevRandSeed(t *testing.T) { + t.Parallel() + + prevRandSeed := []byte("prev random seed") + h := &block.HeaderV2{ + Header: &block.Header{ + PrevRandSeed: prevRandSeed, + }, + } + + require.Equal(t, prevRandSeed, h.GetPrevRandSeed()) +} + +func TestHeaderV2_GetRandSeedNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetRandSeed()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetRandSeed()) +} + +func TestHeaderV2_GetRandSeed(t *testing.T) { + t.Parallel() + + randSeed := []byte("random seed") + h := &block.HeaderV2{ + Header: &block.Header{ + RandSeed: randSeed, + }, + } + + require.Equal(t, randSeed, h.GetRandSeed()) +} +func TestHeaderV2_GetPubKeysBitmapNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetPubKeysBitmap()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetPubKeysBitmap()) +} + +func TestHeaderV2_GetPubKeysBitmap(t *testing.T) { + t.Parallel() + + pubKeysBitmap := []byte{10, 11, 12, 13} + h := &block.HeaderV2{ + Header: &block.Header{ + PubKeysBitmap: pubKeysBitmap, + }, + } + + require.Equal(t, pubKeysBitmap, h.GetPubKeysBitmap()) +} + +func TestHeaderV2_GetRootHashNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetRootHash()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetRootHash()) +} + +func TestHeaderV2_GetRootHash(t *testing.T) { + t.Parallel() + + rootHash := []byte("root hash") + h := &block.HeaderV2{ + Header: &block.Header{ + RootHash: rootHash, + }, + } + + require.Equal(t, rootHash, h.GetRootHash()) +} + +func TestHeaderV2_GetRoundNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, uint64(0), h.GetRound()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, uint64(0), h.GetRound()) +} + +func TestHeaderV2_GetRound(t *testing.T) { + t.Parallel() + + round := uint64(1234) + h := &block.HeaderV2{ + Header: &block.Header{ + Round: round, + }, + } + + require.Equal(t, round, h.GetRound()) +} + +func TestHeaderV2_GetSignatureNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, []byte(nil), h.GetSignature()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, []byte(nil), h.GetSignature()) +} + +func TestHeaderV2_GetSignature(t *testing.T) { + t.Parallel() + + signature := []byte("signature") + h := &block.HeaderV2{ + Header: &block.Header{ + Signature: signature, + }, + } + + require.Equal(t, signature, h.GetSignature()) +} + +func TestHeaderV2_GetTxCountNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, uint32(0), h.GetTxCount()) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, uint32(0), h.GetTxCount()) +} + +func TestHeaderV2_GetTxCount(t *testing.T) { + t.Parallel() + + txCount := uint32(10) + h := &block.HeaderV2{ + Header: &block.Header{ + TxCount: txCount, + }, + } + + require.Equal(t, txCount, h.GetTxCount()) +} + +func TestHeaderV2_SetEpochNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetEpoch(1)) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetEpoch(1)) +} + +func TestHeaderV2_SetEpoch(t *testing.T) { + t.Parallel() + + epoch := uint32(10) + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetEpoch(epoch) + require.Nil(t, err) + require.Equal(t, epoch, h.GetEpoch()) +} + +func TestHeaderV2_SetNonceNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetNonce(1)) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetNonce(1)) +} + +func TestHeaderV2_SetNonce(t *testing.T) { + t.Parallel() + + nonce := uint64(11) + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetNonce(nonce) + require.Nil(t, err) + require.Equal(t, nonce, h.GetNonce()) +} + +func TestHeaderV2_SetPrevHashNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetPrevHash([]byte("prev hash"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetPrevHash([]byte("prev hash"))) +} + +func TestHeaderV2_SetPrevHash(t *testing.T) { + t.Parallel() + + prevHash := []byte("prev hash") + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetPrevHash(prevHash) + require.Nil(t, err) + require.Equal(t, prevHash, h.GetPrevHash()) +} + +func TestHeaderV2_SetPrevRandSeedNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetPrevRandSeed([]byte("prev rand seed"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetPrevRandSeed([]byte("prev rand seed"))) +} + +func TestHeaderV2_SetPrevRandSeed(t *testing.T) { + t.Parallel() + + prevRandSeed := []byte("prev random seed") + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetPrevRandSeed(prevRandSeed) + require.Nil(t, err) + require.Equal(t, prevRandSeed, h.GetPrevRandSeed()) +} + +func TestHeaderV2_SetRandSeedNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetRandSeed([]byte("rand seed"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetRandSeed([]byte("rand seed"))) +} + +func TestHeaderV2_SetRandSeed(t *testing.T) { + t.Parallel() + + randSeed := []byte("random seed") + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetRandSeed(randSeed) + require.Nil(t, err) + require.Equal(t, randSeed, h.GetRandSeed()) +} + +func TestHeaderV2_SetPubKeysBitmapNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetPubKeysBitmap([]byte("pub key bitmap"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetPubKeysBitmap([]byte("pub key bitmap"))) +} + +func TestHeaderV2_SetPubKeysBitmap(t *testing.T) { + t.Parallel() + + pubKeysBitmap := []byte{12, 13, 14, 15} + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetPubKeysBitmap(pubKeysBitmap) + require.Nil(t, err) + require.Equal(t, pubKeysBitmap, h.GetPubKeysBitmap()) +} + +func TestHeaderV2_SetRootHashNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetRootHash([]byte("root hash"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetRootHash([]byte("root hash"))) +} + +func TestHeaderV2_SetRootHash(t *testing.T) { + t.Parallel() + + rootHash := []byte("root hash") + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetRootHash(rootHash) + require.Nil(t, err) + require.Equal(t, rootHash, h.GetRootHash()) +} + +func TestHeaderV2_SetRoundNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetRound(1)) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetRound(1)) +} + +func TestHeaderV2_SetRound(t *testing.T) { + t.Parallel() + + round := uint64(10) + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetRound(round) + require.Nil(t, err) + require.Equal(t, round, h.GetRound()) +} + +func TestHeaderV2_SetSignatureNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetSignature([]byte("signature"))) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetSignature([]byte("signature"))) +} + +func TestHeaderV2_SetSignature(t *testing.T) { + t.Parallel() + + signature := []byte("signature") + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetSignature(signature) + require.Nil(t, err) + require.Equal(t, signature, h.GetSignature()) +} + +func TestHeaderV2_SetTimeStampNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetTimeStamp(100000)) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetTimeStamp(100000)) +} + +func TestHeaderV2_SetTimeStamp(t *testing.T) { + t.Parallel() + + timeStamp := uint64(100000) + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetTimeStamp(timeStamp) + require.Nil(t, err) + require.Equal(t, timeStamp, h.GetTimeStamp()) +} + +func TestHeaderV2_SetTxCountNilPointerReceiverOrInnerHeader(t *testing.T) { + t.Parallel() + + var h *block.HeaderV2 + require.Equal(t, data.ErrNilPointerReceiver, h.SetTxCount(10000)) + + h = &block.HeaderV2{ + Header: nil, + } + require.Equal(t, data.ErrNilPointerReceiver, h.SetTxCount(10000)) +} + +func TestHeaderV2_SetTxCount(t *testing.T) { + t.Parallel() + + txCount := uint32(10) + h := &block.HeaderV2{ + Header: &block.Header{}, + } + + err := h.SetTxCount(txCount) + require.Nil(t, err) + require.Equal(t, txCount, h.GetTxCount()) +} + +func TestHeaderV2_GetMiniBlockHeadersWithDstShouldWork(t *testing.T) { + t.Parallel() + + hashS0R0 := []byte("hash_0_0") + hashS0R1 := []byte("hash_0_1") + hash1S0R2 := []byte("hash_0_2") + hash2S0R2 := []byte("hash2_0_2") + + hdr := &block.Header{ + MiniBlockHeaders: []block.MiniBlockHeader{ + { + SenderShardID: 0, + ReceiverShardID: 0, + Hash: hashS0R0, + }, + { + SenderShardID: 0, + ReceiverShardID: 1, + Hash: hashS0R1, + }, + { + SenderShardID: 0, + ReceiverShardID: 2, + Hash: hash1S0R2, + }, + { + SenderShardID: 0, + ReceiverShardID: 2, + Hash: hash2S0R2, + }, + }, + } + + hashesWithDest2 := hdr.GetMiniBlockHeadersWithDst(2) + + require.Equal(t, uint32(0), hashesWithDest2[string(hash1S0R2)]) + require.Equal(t, uint32(0), hashesWithDest2[string(hash2S0R2)]) +} + +func TestHeaderV2_GetOrderedCrossMiniblocksWithDstShouldWork(t *testing.T) { + t.Parallel() + + hashSh0ToSh0 := []byte("hash_0_0") + hashSh0ToSh1 := []byte("hash_0_1") + hash1Sh0ToSh2 := []byte("hash1_0_2") + hash2Sh0ToSh2 := []byte("hash2_0_2") + + hdr := &block.Header{ + Round: 10, + MiniBlockHeaders: []block.MiniBlockHeader{ + { + SenderShardID: 0, + ReceiverShardID: 0, + Hash: hashSh0ToSh0, + }, + { + SenderShardID: 0, + ReceiverShardID: 1, + Hash: hashSh0ToSh1, + }, + { + SenderShardID: 0, + ReceiverShardID: 2, + Hash: hash1Sh0ToSh2, + }, + { + SenderShardID: 0, + ReceiverShardID: 2, + Hash: hash2Sh0ToSh2, + }, + }, + } + + miniBlocksInfo := hdr.GetOrderedCrossMiniblocksWithDst(2) + + require.Equal(t, 2, len(miniBlocksInfo)) + require.Equal(t, hash1Sh0ToSh2, miniBlocksInfo[0].Hash) + require.Equal(t, hdr.Round, miniBlocksInfo[0].Round) + require.Equal(t, hash2Sh0ToSh2, miniBlocksInfo[1].Hash) + require.Equal(t, hdr.Round, miniBlocksInfo[1].Round) +} + +func TestHeaderV2_SetScheduledRootHash(t *testing.T) { + t.Parallel() + + hv2 := block.HeaderV2{ + Header: &block.Header{}, + } + require.Nil(t, hv2.ScheduledRootHash) + + rootHash := []byte("root hash") + err := hv2.SetScheduledRootHash(rootHash) + require.Nil(t, err) + require.Equal(t, rootHash, hv2.ScheduledRootHash) +} + +func TestHeaderV2_ValidateHeaderVersion(t *testing.T) { + t.Parallel() + + hv2 := block.HeaderV2{ + Header: &block.Header{}, + } + + err := hv2.ValidateHeaderVersion() + require.Equal(t, data.ErrNilScheduledRootHash, err) + + hv2.ScheduledRootHash = make([]byte, 0) + err = hv2.ValidateHeaderVersion() + require.Equal(t, data.ErrNilScheduledRootHash, err) + + hv2.ScheduledRootHash = make([]byte, 32) + err = hv2.ValidateHeaderVersion() + require.Nil(t, err) +} + +func TestHeaderV2_SetAdditionalDataNilAdditionalDataShouldErr(t *testing.T) { + t.Parallel() + + shardBlock := &block.HeaderV2{ + Header: &block.Header{}, + ScheduledRootHash: nil, + } + + err := shardBlock.SetAdditionalData(nil) + + require.NotNil(t, err) + require.Equal(t, data.ErrNilPointerDereference, err) +} + +func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { + t.Parallel() + + shardBlock := &block.HeaderV2{ + Header: &block.Header{}, + ScheduledRootHash: nil, + } + + scRootHash := []byte("scheduledRootHash") + err := shardBlock.SetAdditionalData(&headerVersionData.AdditionalData{ + ScheduledRootHash: scRootHash, + }) + + require.Nil(t, err) + require.Equal(t, scRootHash, shardBlock.ScheduledRootHash) +} diff --git a/data/block/block_test.go b/data/block/block_test.go index a9b58b09b..7d17b9208 100644 --- a/data/block/block_test.go +++ b/data/block/block_test.go @@ -6,6 +6,7 @@ import ( "github.com/ElrondNetwork/elrond-go-core/data" "github.com/ElrondNetwork/elrond-go-core/data/block" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -136,8 +137,9 @@ func TestHeader_SetEpoch(t *testing.T) { epoch := uint32(10) h := block.Header{} - h.SetEpoch(epoch) + err := h.SetEpoch(epoch) + assert.Nil(t, err) assert.Equal(t, epoch, h.GetEpoch()) } @@ -146,8 +148,9 @@ func TestHeader_SetNonce(t *testing.T) { nonce := uint64(11) h := block.Header{} - h.SetNonce(nonce) + err := h.SetNonce(nonce) + assert.Nil(t, err) assert.Equal(t, nonce, h.GetNonce()) } @@ -156,8 +159,9 @@ func TestHeader_SetPrevHash(t *testing.T) { prevHash := []byte("prev hash") h := block.Header{} - h.SetPrevHash(prevHash) + err := h.SetPrevHash(prevHash) + assert.Nil(t, err) assert.Equal(t, prevHash, h.GetPrevHash()) } @@ -166,8 +170,9 @@ func TestHeader_SetPrevRandSeed(t *testing.T) { prevRandSeed := []byte("prev random seed") h := block.Header{} - h.SetPrevRandSeed(prevRandSeed) + err := h.SetPrevRandSeed(prevRandSeed) + assert.Nil(t, err) assert.Equal(t, prevRandSeed, h.GetPrevRandSeed()) } @@ -176,8 +181,9 @@ func TestHeader_SetRandSeed(t *testing.T) { randSeed := []byte("random seed") h := block.Header{} - h.SetRandSeed(randSeed) + err := h.SetRandSeed(randSeed) + assert.Nil(t, err) assert.Equal(t, randSeed, h.GetRandSeed()) } @@ -186,8 +192,9 @@ func TestHeader_SetPubKeysBitmap(t *testing.T) { pubKeysBitmap := []byte{12, 13, 14, 15} h := block.Header{} - h.SetPubKeysBitmap(pubKeysBitmap) + err := h.SetPubKeysBitmap(pubKeysBitmap) + assert.Nil(t, err) assert.Equal(t, pubKeysBitmap, h.GetPubKeysBitmap()) } @@ -196,8 +203,9 @@ func TestHeader_SetRootHash(t *testing.T) { rootHash := []byte("root hash") h := block.Header{} - h.SetRootHash(rootHash) + err := h.SetRootHash(rootHash) + assert.Nil(t, err) assert.Equal(t, rootHash, h.GetRootHash()) } @@ -206,8 +214,9 @@ func TestHeader_SetRound(t *testing.T) { rootHash := []byte("root hash") h := block.Header{} - h.SetRootHash(rootHash) + err := h.SetRootHash(rootHash) + assert.Nil(t, err) assert.Equal(t, rootHash, h.GetRootHash()) } @@ -216,8 +225,9 @@ func TestHeader_SetSignature(t *testing.T) { signature := []byte("signature") h := block.Header{} - h.SetSignature(signature) + err := h.SetSignature(signature) + assert.Nil(t, err) assert.Equal(t, signature, h.GetSignature()) } @@ -226,8 +236,9 @@ func TestHeader_SetTimeStamp(t *testing.T) { timeStamp := uint64(100000) h := block.Header{} - h.SetTimeStamp(timeStamp) + err := h.SetTimeStamp(timeStamp) + assert.Nil(t, err) assert.Equal(t, timeStamp, h.GetTimeStamp()) } @@ -236,8 +247,9 @@ func TestHeader_SetTxCount(t *testing.T) { txCount := uint32(10) h := block.Header{} - h.SetTxCount(txCount) + err := h.SetTxCount(txCount) + assert.Nil(t, err) assert.Equal(t, txCount, h.GetTxCount()) } @@ -245,7 +257,7 @@ func TestBody_IntegrityAndValidityNil(t *testing.T) { t.Parallel() var body *block.Body = nil - assert.Equal(t, data.ErrNilBlockBody, body.IntegrityAndValidity()) + assert.Equal(t, data.ErrNilPointerReceiver, body.IntegrityAndValidity()) } func TestBody_IntegrityAndValidityEmptyMiniblockShouldThrowException(t *testing.T) { @@ -379,3 +391,29 @@ func TestMiniBlock_Clone(t *testing.T) { assert.True(t, reflect.DeepEqual(miniBlock, clonedMB)) } + +func TestHeader_SetScheduledRootHash(t *testing.T) { + t.Parallel() + + header := &block.Header{} + err := header.SetScheduledRootHash([]byte("root hash")) + require.Equal(t, data.ErrScheduledRootHashNotSupported, err) +} + +func TestHeader_ValidateHeaderVersion(t *testing.T) { + t.Parallel() + + header := &block.Header{} + err := header.ValidateHeaderVersion() + require.Nil(t, err) +} + +func TestHeader_SetAdditionalDataShouldDoNothing(t *testing.T) { + t.Parallel() + + var shardBlock *block.Header + + //goland:noinspection ALL + err := shardBlock.SetAdditionalData(&headerVersionData.AdditionalData{}) + assert.Nil(t, err) +} diff --git a/data/block/economicsHandler.go b/data/block/economicsHandler.go new file mode 100644 index 000000000..689a077bd --- /dev/null +++ b/data/block/economicsHandler.go @@ -0,0 +1,129 @@ +package block + +import ( + "math/big" + + "github.com/ElrondNetwork/elrond-go-core/data" +) + +// SetTotalSupply sets the total supply +func (e *Economics) SetTotalSupply(totalSupply *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if totalSupply == nil{ + return data.ErrInvalidValue + } + if e.TotalSupply == nil { + e.TotalSupply = big.NewInt(0) + } + + e.TotalSupply.Set(totalSupply) + + return nil +} + +// SetTotalToDistribute sets the total to be distributed +func (e *Economics) SetTotalToDistribute(totalToDistribute *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if totalToDistribute == nil { + return data.ErrInvalidValue + } + if e.TotalToDistribute == nil { + e.TotalToDistribute = big.NewInt(0) + } + + e.TotalToDistribute.Set(totalToDistribute) + + return nil +} + +// SetTotalNewlyMinted sets the total number of minted tokens +func (e *Economics) SetTotalNewlyMinted(totalNewlyMinted *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if totalNewlyMinted == nil{ + return data.ErrInvalidValue + } + if e.TotalNewlyMinted == nil{ + e.TotalNewlyMinted = big.NewInt(0) + } + + e.TotalNewlyMinted.Set(totalNewlyMinted) + + return nil +} + +// SetRewardsPerBlock sets the rewards per block +func (e *Economics) SetRewardsPerBlock(rewardsPerBlock *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if rewardsPerBlock == nil{ + return data.ErrInvalidValue + } + if e.RewardsPerBlock == nil{ + e.RewardsPerBlock = big.NewInt(0) + } + + e.RewardsPerBlock.Set(rewardsPerBlock) + + return nil +} + +// SetRewardsForProtocolSustainability sets the rewards for protocol sustainability +func (e *Economics) SetRewardsForProtocolSustainability(rewardsForProtocolSustainability *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if rewardsForProtocolSustainability == nil{ + return data.ErrInvalidValue + } + if e.RewardsForProtocolSustainability == nil{ + e.RewardsForProtocolSustainability = big.NewInt(0) + } + + e.RewardsForProtocolSustainability.Set(rewardsForProtocolSustainability) + + return nil +} + +// SetNodePrice sets the node price +func (e *Economics) SetNodePrice(nodePrice *big.Int) error { + if e == nil { + return data.ErrNilPointerReceiver + } + if nodePrice == nil{ + return data.ErrInvalidValue + } + if e.NodePrice == nil{ + e.NodePrice = big.NewInt(0) + } + + e.NodePrice.Set(nodePrice) + + return nil +} + +// SetPrevEpochStartRound sets the previous epoch start round +func (e *Economics) SetPrevEpochStartRound(prevEpochStartRound uint64) error { + if e == nil { + return data.ErrNilPointerReceiver + } + + e.PrevEpochStartRound = prevEpochStartRound + return nil +} + +// SetPrevEpochStartHash sets the previous epoch start hash +func (e *Economics) SetPrevEpochStartHash(prevEpochStartHash []byte) error { + if e == nil { + return data.ErrNilPointerReceiver + } + + e.PrevEpochStartHash = prevEpochStartHash + return nil +} diff --git a/data/block/epochStartHandler.go b/data/block/epochStartHandler.go new file mode 100644 index 000000000..5c5fde24b --- /dev/null +++ b/data/block/epochStartHandler.go @@ -0,0 +1,70 @@ +package block + +import ( + "github.com/ElrondNetwork/elrond-go-core/data" +) + +// GetLastFinalizedHeaderHandlers returns the last finalized header handlers +func (es *EpochStart) GetLastFinalizedHeaderHandlers() []data.EpochStartShardDataHandler { + if es == nil { + return nil + } + + epochStartShardDataHandlers := make([]data.EpochStartShardDataHandler, len(es.LastFinalizedHeaders)) + for i := range es.LastFinalizedHeaders { + epochStartShardDataHandlers[i] = &es.LastFinalizedHeaders[i] + } + + return epochStartShardDataHandlers +} + +// GetEconomicsHandler returns the economics handler +func (es *EpochStart) GetEconomicsHandler() data.EconomicsHandler { + if es == nil { + return nil + } + + return &es.Economics +} + +// SetLastFinalizedHeaders sets the last finalized header +func (es *EpochStart) SetLastFinalizedHeaders(epochStartDataHandlers []data.EpochStartShardDataHandler) error { + if es == nil { + return data.ErrNilPointerReceiver + } + + epochStartData := make([]EpochStartShardData, len(epochStartDataHandlers)) + for i := range epochStartDataHandlers { + shardData, ok := epochStartDataHandlers[i].(*EpochStartShardData) + if !ok { + return data.ErrInvalidTypeAssertion + } + if shardData == nil { + return data.ErrNilPointerDereference + } + epochStartData[i] = *shardData + } + + es.LastFinalizedHeaders = epochStartData + + return nil +} + +// SetEconomics sets the economics data +func (es *EpochStart) SetEconomics(economicsHandler data.EconomicsHandler) error { + if es == nil { + return data.ErrNilPointerReceiver + } + + ec, ok := economicsHandler.(*Economics) + if !ok { + return data.ErrInvalidTypeAssertion + } + if ec == nil { + return data.ErrNilPointerDereference + } + + es.Economics = *ec + + return nil +} diff --git a/data/block/epochStartShardDataHandler.go b/data/block/epochStartShardDataHandler.go new file mode 100644 index 000000000..a3a83166f --- /dev/null +++ b/data/block/epochStartShardDataHandler.go @@ -0,0 +1,128 @@ +package block + +import "github.com/ElrondNetwork/elrond-go-core/data" + +// GetPendingMiniBlockHeaderHandlers returns the pending miniBlock header handlers +func (essd *EpochStartShardData) GetPendingMiniBlockHeaderHandlers() []data.MiniBlockHeaderHandler { + if essd == nil { + return nil + } + + pendingMbHeaderHandlers := make([]data.MiniBlockHeaderHandler, len(essd.PendingMiniBlockHeaders)) + for i := range essd.PendingMiniBlockHeaders { + pendingMbHeaderHandlers[i] = &essd.PendingMiniBlockHeaders[i] + } + + return pendingMbHeaderHandlers +} + +// SetShardID sets the epoch start shardData shardID +func (essd *EpochStartShardData) SetShardID(shardID uint32) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.ShardID = shardID + + return nil +} + +// SetEpoch sets the epoch start shardData epoch +func (essd *EpochStartShardData) SetEpoch(epoch uint32) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.Epoch = epoch + + return nil +} + +// SetRound sets the epoch start shardData round +func (essd *EpochStartShardData) SetRound(round uint64) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.Round = round + + return nil +} + +// SetNonce sets the epoch start shardData nonce +func (essd *EpochStartShardData) SetNonce(nonce uint64) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.Nonce = nonce + + return nil +} + +// SetHeaderHash sets the epoch start shardData header hash +func (essd *EpochStartShardData) SetHeaderHash(hash []byte) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.HeaderHash = hash + + return nil +} + +// SetRootHash sets the epoch start shardData root hash +func (essd *EpochStartShardData) SetRootHash(rootHash []byte) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.RootHash = rootHash + + return nil +} + +// SetFirstPendingMetaBlock sets the epoch start shardData first pending metaBlock +func (essd *EpochStartShardData) SetFirstPendingMetaBlock(metaBlock []byte) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.FirstPendingMetaBlock = metaBlock + + return nil +} + +// SetLastFinishedMetaBlock sets the epoch start shardData last finished metaBlock +func (essd *EpochStartShardData) SetLastFinishedMetaBlock(lastFinishedMetaBlock []byte) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.LastFinishedMetaBlock = lastFinishedMetaBlock + + return nil +} + +// SetPendingMiniBlockHeaders sets the epoch start shardData pending miniBlock headers +func (essd *EpochStartShardData) SetPendingMiniBlockHeaders(miniBlockHeaderHandlers []data.MiniBlockHeaderHandler) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + pendingMiniBlockHeaders := make([]MiniBlockHeader, len(miniBlockHeaderHandlers)) + for i := range miniBlockHeaderHandlers { + mbHeader, ok := miniBlockHeaderHandlers[i].(*MiniBlockHeader) + if !ok { + return data.ErrInvalidTypeAssertion + } + if mbHeader == nil { + return data.ErrNilPointerDereference + } + pendingMiniBlockHeaders[i] = *mbHeader + } + + essd.PendingMiniBlockHeaders = pendingMiniBlockHeaders + + return nil +} diff --git a/data/block/metaBlock.go b/data/block/metaBlock.go index cc9e4451e..370cd5142 100644 --- a/data/block/metaBlock.go +++ b/data/block/metaBlock.go @@ -7,10 +7,12 @@ import ( "github.com/ElrondNetwork/elrond-go-core/core" "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" ) // don't break the interface var _ = data.HeaderHandler(&MetaBlock{}) +var _ = data.MetaHeaderHandler(&MetaBlock{}) // GetShardID returns the metachain shard id func (m *MetaBlock) GetShardID() uint32 { @@ -18,96 +20,253 @@ func (m *MetaBlock) GetShardID() uint32 { } // SetNonce sets header nonce -func (m *MetaBlock) SetNonce(n uint64) { +func (m *MetaBlock) SetNonce(n uint64) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.Nonce = n + + return nil } // SetEpoch sets header epoch -func (m *MetaBlock) SetEpoch(e uint32) { +func (m *MetaBlock) SetEpoch(e uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.Epoch = e + + return nil } // SetRound sets header round -func (m *MetaBlock) SetRound(r uint64) { +func (m *MetaBlock) SetRound(r uint64) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.Round = r + + return nil } // SetRootHash sets root hash -func (m *MetaBlock) SetRootHash(rHash []byte) { +func (m *MetaBlock) SetRootHash(rHash []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.RootHash = rHash + + return nil } // SetValidatorStatsRootHash set's the root hash for the validator statistics trie -func (m *MetaBlock) SetValidatorStatsRootHash(rHash []byte) { +func (m *MetaBlock) SetValidatorStatsRootHash(rHash []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.ValidatorStatsRootHash = rHash + + return nil } // SetPrevHash sets prev hash -func (m *MetaBlock) SetPrevHash(pvHash []byte) { +func (m *MetaBlock) SetPrevHash(pvHash []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.PrevHash = pvHash + + return nil } // SetPrevRandSeed sets the previous randomness seed -func (m *MetaBlock) SetPrevRandSeed(pvRandSeed []byte) { +func (m *MetaBlock) SetPrevRandSeed(pvRandSeed []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.PrevRandSeed = pvRandSeed + + return nil } // SetRandSeed sets the current random seed -func (m *MetaBlock) SetRandSeed(randSeed []byte) { +func (m *MetaBlock) SetRandSeed(randSeed []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.RandSeed = randSeed + + return nil } -// SetPubKeysBitmap sets publick key bitmap -func (m *MetaBlock) SetPubKeysBitmap(pkbm []byte) { +// SetPubKeysBitmap sets public key bitmap +func (m *MetaBlock) SetPubKeysBitmap(pkbm []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.PubKeysBitmap = pkbm + + return nil } // SetSignature set header signature -func (m *MetaBlock) SetSignature(sg []byte) { +func (m *MetaBlock) SetSignature(sg []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.Signature = sg + + return nil } // SetLeaderSignature will set the leader's signature -func (m *MetaBlock) SetLeaderSignature(sg []byte) { +func (m *MetaBlock) SetLeaderSignature(sg []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.LeaderSignature = sg + + return nil } // SetChainID sets the chain ID on which this block is valid on -func (m *MetaBlock) SetChainID(chainID []byte) { +func (m *MetaBlock) SetChainID(chainID []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.ChainID = chainID + + return nil } // SetSoftwareVersion sets the software version of the block -func (m *MetaBlock) SetSoftwareVersion(version []byte) { +func (m *MetaBlock) SetSoftwareVersion(version []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.SoftwareVersion = version + + return nil } // SetAccumulatedFees sets the accumulated fees in the header -func (m *MetaBlock) SetAccumulatedFees(value *big.Int) { +func (m *MetaBlock) SetAccumulatedFees(value *big.Int) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if value == nil { + return data.ErrInvalidValue + } + if m.AccumulatedFees == nil { + m.AccumulatedFees = big.NewInt(0) + } + m.AccumulatedFees.Set(value) + + return nil +} + +// SetAccumulatedFeesInEpoch sets the epoch accumulated fees in the header +func (m *MetaBlock) SetAccumulatedFeesInEpoch(value *big.Int) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if value == nil { + return data.ErrInvalidValue + } + if m.AccumulatedFeesInEpoch == nil { + m.AccumulatedFeesInEpoch = big.NewInt(0) + } + + m.AccumulatedFeesInEpoch.Set(value) + + return nil } // SetDeveloperFees sets the developer fees in the header -func (m *MetaBlock) SetDeveloperFees(value *big.Int) { +func (m *MetaBlock) SetDeveloperFees(value *big.Int) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if value == nil { + return data.ErrInvalidValue + } + if m.DeveloperFees == nil { + m.DeveloperFees = big.NewInt(0) + } + m.DeveloperFees.Set(value) + + return nil +} + +// SetDeveloperFees sets the developer fees in the header +func (m *MetaBlock) SetDevFeesInEpoch(value *big.Int) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if value == nil { + return data.ErrInvalidValue + } + if m.DevFeesInEpoch == nil { + m.DevFeesInEpoch = big.NewInt(0) + } + + m.DevFeesInEpoch.Set(value) + + return nil } // SetTimeStamp sets header timestamp -func (m *MetaBlock) SetTimeStamp(ts uint64) { +func (m *MetaBlock) SetTimeStamp(ts uint64) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.TimeStamp = ts + + return nil } // SetTxCount sets the transaction count of the current meta block -func (m *MetaBlock) SetTxCount(txCount uint32) { +func (m *MetaBlock) SetTxCount(txCount uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + m.TxCount = txCount + + return nil } // SetShardID sets header shard ID -func (m *MetaBlock) SetShardID(_ uint32) { +func (m *MetaBlock) SetShardID(_ uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + return nil } // GetMiniBlockHeadersWithDst as a map of hashes and sender IDs func (m *MetaBlock) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 { + if m == nil { + return nil + } + hashDst := make(map[string]uint32) for i := 0; i < len(m.ShardInfo); i++ { if m.ShardInfo[i].ShardID == destId { @@ -136,6 +295,10 @@ func (m *MetaBlock) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 // GetOrderedCrossMiniblocksWithDst gets all cross miniblocks with the given destination shard ID, ordered in a // chronological way, taking into consideration the round in which they were created/executed in the sender shard func (m *MetaBlock) GetOrderedCrossMiniblocksWithDst(destId uint32) []*data.MiniBlockInfo { + if m == nil { + return nil + } + miniBlocks := make([]*data.MiniBlockInfo, 0) for i := 0; i < len(m.ShardInfo); i++ { @@ -176,10 +339,15 @@ func (m *MetaBlock) GetOrderedCrossMiniblocksWithDst(destId uint32) []*data.Mini // GetMiniBlockHeadersHashes gets the miniblock hashes func (m *MetaBlock) GetMiniBlockHeadersHashes() [][]byte { + if m == nil { + return nil + } + result := make([][]byte, 0, len(m.MiniBlockHeaders)) for _, miniblock := range m.MiniBlockHeaders { result = append(result, miniblock.Hash) } + return result } @@ -190,16 +358,145 @@ func (m *MetaBlock) IsInterfaceNil() bool { // IsStartOfEpochBlock verifies if the block is of type start of epoch func (m *MetaBlock) IsStartOfEpochBlock() bool { + if m == nil { + return false + } + return len(m.EpochStart.LastFinalizedHeaders) > 0 } -// Clone will return a clone of the object -func (m *MetaBlock) Clone() data.HeaderHandler { +// ShallowClone will return a clone of the object +func (m *MetaBlock) ShallowClone() data.HeaderHandler { + if m == nil { + return nil + } + metaBlockCopy := *m + return &metaBlockCopy } -// GetEpochStartMetaHash returns the hash of the epoch start meta block -func (m *MetaBlock) GetEpochStartMetaHash() []byte { +// GetMiniBlockHeaderHandlers returns the miniBlock headers as an array of miniBlock header handlers +func (m *MetaBlock) GetMiniBlockHeaderHandlers() []data.MiniBlockHeaderHandler { + if m == nil { + return nil + } + + mbHeaders := m.GetMiniBlockHeaders() + mbHeaderHandlers := make([]data.MiniBlockHeaderHandler, len(mbHeaders)) + + for i := range mbHeaders { + mbHeaderHandlers[i] = &mbHeaders[i] + } + + return mbHeaderHandlers +} + +// HasScheduledSupport returns false as the initial metaBlock version does not support scheduled data +func (m *MetaBlock) HasScheduledSupport() bool { + return false +} + +// SetMiniBlockHeaderHandlers sets the miniBlock headers from the given miniBlock header handlers +func (m *MetaBlock) SetMiniBlockHeaderHandlers(mbHeaderHandlers []data.MiniBlockHeaderHandler) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if mbHeaderHandlers == nil { + m.MiniBlockHeaders = nil + return nil + } + + mbHeaders := make([]MiniBlockHeader, len(mbHeaderHandlers)) + for i := range mbHeaderHandlers { + mbHeader, ok := mbHeaderHandlers[i].(*MiniBlockHeader) + if !ok { + return data.ErrInvalidTypeAssertion + } + if mbHeader == nil { + return data.ErrNilPointerDereference + } + mbHeaders[i] = *mbHeader + } + + m.MiniBlockHeaders = mbHeaders + + return nil +} + +// SetReceiptsHash sets the receipts hash +func (m *MetaBlock) SetReceiptsHash(hash []byte) error { + if m == nil { + return nil + } + + m.ReceiptsHash = hash + + return nil +} + +// GetShardInfoHandlers - gets the shardInfo as an array of ShardDataHandler +func (m *MetaBlock) GetShardInfoHandlers() []data.ShardDataHandler { + if m == nil || m.ShardInfo == nil { + return nil + } + + shardInfoHandlers := make([]data.ShardDataHandler, len(m.ShardInfo)) + for i := range m.ShardInfo { + shardInfoHandlers[i] = &m.ShardInfo[i] + } + + return shardInfoHandlers +} + +// GetEpochStartHandler - +func (m *MetaBlock) GetEpochStartHandler() data.EpochStartHandler { + if m == nil { + return nil + } + + return &m.EpochStart +} + +// SetShardInfoHandlers - +func (m *MetaBlock) SetShardInfoHandlers(shardInfo []data.ShardDataHandler) error { + if m == nil { + return data.ErrNilPointerReceiver + } + if shardInfo == nil { + m.ShardInfo = nil + return nil + } + + sInfo := make([]ShardData, len(shardInfo)) + for i := range shardInfo { + shData, ok := shardInfo[i].(*ShardData) + if !ok { + return data.ErrInvalidTypeAssertion + } + if shData == nil { + return data.ErrNilPointerDereference + } + sInfo[i] = *shData + } + + m.ShardInfo = sInfo + + return nil +} + +// SetScheduledRootHash not supported on the first version of metablock +func (m *MetaBlock) SetScheduledRootHash(_ []byte) error { + return data.ErrScheduledRootHashNotSupported +} + +// ValidateHeaderVersion - always valid for initial version +func (m *MetaBlock) ValidateHeaderVersion() error { + return nil +} + +// SetAdditionalData sets the additional version-related data +func (m *MetaBlock) SetAdditionalData(_ headerVersionData.HeaderAdditionalData) error { + // no extra data for the initial version metaBlock header return nil } diff --git a/data/block/metaBlock.pb.go b/data/block/metaBlock.pb.go index e93b3ecaa..922d9b0ee 100644 --- a/data/block/metaBlock.pb.go +++ b/data/block/metaBlock.pb.go @@ -6,7 +6,7 @@ package block import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -780,86 +780,86 @@ func init() { func init() { proto.RegisterFile("metaBlock.proto", fileDescriptor_87b91ab531130b2b) } var fileDescriptor_87b91ab531130b2b = []byte{ - // 1257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6e, 0xdb, 0x46, - 0x13, 0x17, 0x6d, 0xcb, 0xb6, 0x46, 0x96, 0x4d, 0x6f, 0x1c, 0x87, 0x9f, 0xf1, 0x81, 0x31, 0x84, - 0x1e, 0xdc, 0x02, 0xb1, 0x5b, 0x37, 0x68, 0x0f, 0x3d, 0x14, 0xb6, 0x65, 0x23, 0x6a, 0x12, 0x43, - 0xa0, 0x5c, 0x1f, 0x7a, 0x5b, 0x91, 0x1b, 0x6a, 0x61, 0x6a, 0x57, 0x25, 0x97, 0x76, 0x5d, 0xa0, - 0x40, 0x1f, 0xa1, 0xbd, 0xf5, 0x01, 0x7a, 0x08, 0xda, 0x17, 0xc9, 0x31, 0xc7, 0x9c, 0x9a, 0x46, - 0xb9, 0xf4, 0x98, 0x02, 0x7d, 0x80, 0x62, 0x77, 0x49, 0x91, 0xa2, 0xe8, 0x26, 0x07, 0xe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0x3f, 0x35, 0xa8, 0x65, 0x9b, 0x64, 0xbc, + 0x07, 0x8d, 0xfc, 0x1e, 0x1c, 0x6f, 0xd2, 0x99, 0xd2, 0x4d, 0x3a, 0x9b, 0xdf, 0xa4, 0xff, 0xcf, + 0x75, 0xee, 0x26, 0xe4, 0xa3, 0x15, 0x3c, 0xe5, 0x56, 0x55, 0x5d, 0x37, 0xfd, 0x8d, 0xc5, 0x4b, + 0x66, 0x07, 0xc9, 0x27, 0x9a, 0xae, 0x29, 0x23, 0xbd, 0xd0, 0x56, 0x72, 0x64, 0x2b, 0x67, 0x33, + 0x3e, 0x76, 0x99, 0x1a, 0x2c, 0x14, 0xa9, 0xc1, 0x16, 0xac, 0x3c, 0x56, 0x59, 0xcb, 0xce, 0xe8, + 0xe2, 0x15, 0xe1, 0x49, 0x22, 0x52, 0x2b, 0x23, 0x22, 0x79, 0x52, 0x01, 0x05, 0x52, 0x51, 0xa4, + 0x3b, 0xf5, 0x12, 0xba, 0x13, 0x3f, 0x24, 0xa9, 0x7e, 0x29, 0x79, 0x48, 0xf2, 0xba, 0xf4, 0x91, + 0x69, 0x14, 0x1e, 0x99, 0xcf, 0x60, 0xfd, 0x84, 0xfa, 0xcc, 0xa3, 0x92, 0x8b, 0x8e, 0xa4, 0x32, + 0x1c, 0x9f, 0x54, 0x6c, 0xc1, 0xb9, 0x42, 0x4b, 0x1e, 0x80, 0x39, 0xf1, 0x52, 0x98, 0xef, 0xf0, + 0x52, 0x98, 0x65, 0x64, 0xce, 0x41, 0x17, 0xd9, 0x50, 0x86, 0x2a, 0xee, 0xaa, 0xbe, 0x5d, 0x1e, + 0x23, 0x9f, 0xe7, 0x9b, 0xdf, 0x22, 0xaa, 0x33, 0x57, 0x27, 0x9a, 0x3c, 0x09, 0x91, 0x9f, 0x13, + 0x0b, 0x16, 0xf6, 0xfb, 0x94, 0x05, 0xad, 0x03, 0xeb, 0x86, 0xa6, 0xe6, 0x89, 0x18, 0x17, 0xb0, + 0xc3, 0x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x3e, 0xb2, 0x8d, 0x17, 0x23, 0xdb, 0x78, 0x39, 0xb2, + 0x8d, 0x3f, 0x47, 0xb6, 0xf1, 0xd7, 0xc8, 0xae, 0xbc, 0x19, 0xd9, 0xc6, 0xf7, 0xaf, 0xed, 0xca, + 0x8b, 0xd7, 0x76, 0xe5, 0xe5, 0x6b, 0xbb, 0xf2, 0x75, 0x55, 0x7d, 0xf0, 0x76, 0xe7, 0xd5, 0x98, + 0x7d, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x56, 0xd4, 0xe2, 0x47, 0x0f, 0x00, 0x00, } func (x PeerAction) String() string { @@ -901,7 +901,7 @@ func (this *PeerData) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.ValueChange, that1.ValueChange) { return false } @@ -957,13 +957,13 @@ func (this *ShardData) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.AccumulatedFees, that1.AccumulatedFees) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.DeveloperFees, that1.DeveloperFees) { return false } @@ -1055,37 +1055,37 @@ func (this *Economics) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.TotalSupply, that1.TotalSupply) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.TotalToDistribute, that1.TotalToDistribute) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.TotalNewlyMinted, that1.TotalNewlyMinted) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.RewardsPerBlock, that1.RewardsPerBlock) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.RewardsForProtocolSustainability, that1.RewardsForProtocolSustainability) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.NodePrice, that1.NodePrice) { return false } @@ -1222,25 +1222,25 @@ func (this *MetaBlock) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.AccumulatedFees, that1.AccumulatedFees) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.AccumulatedFeesInEpoch, that1.AccumulatedFeesInEpoch) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.DeveloperFees, that1.DeveloperFees) { return false } } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.DevFeesInEpoch, that1.DevFeesInEpoch) { return false } @@ -1435,7 +1435,7 @@ func (m *PeerData) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.ValueChange) i -= size if _, err := __caster.MarshalTo(m.ValueChange, dAtA[i:]); err != nil { @@ -1493,7 +1493,7 @@ func (m *ShardData) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.DeveloperFees) i -= size if _, err := __caster.MarshalTo(m.DeveloperFees, dAtA[i:]); err != nil { @@ -1509,7 +1509,7 @@ func (m *ShardData) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x68 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.AccumulatedFees) i -= size if _, err := __caster.MarshalTo(m.AccumulatedFees, dAtA[i:]); err != nil { @@ -1714,7 +1714,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x38 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.NodePrice) i -= size if _, err := __caster.MarshalTo(m.NodePrice, dAtA[i:]); err != nil { @@ -1725,7 +1725,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.RewardsForProtocolSustainability) i -= size if _, err := __caster.MarshalTo(m.RewardsForProtocolSustainability, dAtA[i:]); err != nil { @@ -1736,7 +1736,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.RewardsPerBlock) i -= size if _, err := __caster.MarshalTo(m.RewardsPerBlock, dAtA[i:]); err != nil { @@ -1747,7 +1747,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.TotalNewlyMinted) i -= size if _, err := __caster.MarshalTo(m.TotalNewlyMinted, dAtA[i:]); err != nil { @@ -1758,7 +1758,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.TotalToDistribute) i -= size if _, err := __caster.MarshalTo(m.TotalToDistribute, dAtA[i:]); err != nil { @@ -1769,7 +1769,7 @@ func (m *Economics) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.TotalSupply) i -= size if _, err := __caster.MarshalTo(m.TotalSupply, dAtA[i:]); err != nil { @@ -1866,7 +1866,7 @@ func (m *MetaBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xc8 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.DevFeesInEpoch) i -= size if _, err := __caster.MarshalTo(m.DevFeesInEpoch, dAtA[i:]); err != nil { @@ -1879,7 +1879,7 @@ func (m *MetaBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xc2 { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.DeveloperFees) i -= size if _, err := __caster.MarshalTo(m.DeveloperFees, dAtA[i:]); err != nil { @@ -1892,7 +1892,7 @@ func (m *MetaBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xba { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.AccumulatedFeesInEpoch) i -= size if _, err := __caster.MarshalTo(m.AccumulatedFeesInEpoch, dAtA[i:]); err != nil { @@ -1905,7 +1905,7 @@ func (m *MetaBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xb2 { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.AccumulatedFees) i -= size if _, err := __caster.MarshalTo(m.AccumulatedFees, dAtA[i:]); err != nil { @@ -2111,7 +2111,7 @@ func (m *PeerData) Size() (n int) { n += 1 + sovMetaBlock(uint64(m.TimeStamp)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.ValueChange) n += 1 + l + sovMetaBlock(uint64(l)) } @@ -2166,7 +2166,7 @@ func (m *ShardData) Size() (n int) { n += 1 + sovMetaBlock(uint64(m.NumPendingMiniBlocks)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.AccumulatedFees) n += 1 + l + sovMetaBlock(uint64(l)) } @@ -2174,7 +2174,7 @@ func (m *ShardData) Size() (n int) { n += 1 + sovMetaBlock(uint64(m.LastIncludedMetaNonce)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.DeveloperFees) n += 1 + l + sovMetaBlock(uint64(l)) } @@ -2231,32 +2231,32 @@ func (m *Economics) Size() (n int) { var l int _ = l { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.TotalSupply) n += 1 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.TotalToDistribute) n += 1 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.TotalNewlyMinted) n += 1 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.RewardsPerBlock) n += 1 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.RewardsForProtocolSustainability) n += 1 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.NodePrice) n += 1 + l + sovMetaBlock(uint64(l)) } @@ -2370,22 +2370,22 @@ func (m *MetaBlock) Size() (n int) { n += 2 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.AccumulatedFees) n += 2 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.AccumulatedFeesInEpoch) n += 2 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.DeveloperFees) n += 2 + l + sovMetaBlock(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.DevFeesInEpoch) n += 2 + l + sovMetaBlock(uint64(l)) } @@ -2725,7 +2725,7 @@ func (m *PeerData) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3115,7 +3115,7 @@ func (m *ShardData) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3172,7 +3172,7 @@ func (m *ShardData) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3562,7 +3562,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3600,7 +3600,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3638,7 +3638,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3676,7 +3676,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3714,7 +3714,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -3752,7 +3752,7 @@ func (m *Economics) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -4601,7 +4601,7 @@ func (m *MetaBlock) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -4639,7 +4639,7 @@ func (m *MetaBlock) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -4677,7 +4677,7 @@ func (m *MetaBlock) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -4715,7 +4715,7 @@ func (m *MetaBlock) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { diff --git a/data/block/metaBlock_test.go b/data/block/metaBlock_test.go index a98eb5007..56ec35cd3 100644 --- a/data/block/metaBlock_test.go +++ b/data/block/metaBlock_test.go @@ -4,7 +4,9 @@ import ( "testing" "github.com/ElrondNetwork/elrond-go-core/core" + "github.com/ElrondNetwork/elrond-go-core/data" "github.com/ElrondNetwork/elrond-go-core/data/block" + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -143,8 +145,9 @@ func TestMetaBlock_SetEpoch(t *testing.T) { epoch := uint32(10) m := block.MetaBlock{} - m.SetEpoch(epoch) + err := m.SetEpoch(epoch) + assert.Nil(t, err) assert.Equal(t, epoch, m.GetEpoch()) } @@ -153,8 +156,9 @@ func TestMetaBlock_SetNonce(t *testing.T) { nonce := uint64(11) m := block.MetaBlock{} - m.SetNonce(nonce) + err := m.SetNonce(nonce) + assert.Nil(t, err) assert.Equal(t, nonce, m.GetNonce()) } @@ -163,8 +167,9 @@ func TestMetaBlock_SetPrevHash(t *testing.T) { prevHash := []byte("prev hash") m := block.MetaBlock{} - m.SetPrevHash(prevHash) + err := m.SetPrevHash(prevHash) + assert.Nil(t, err) assert.Equal(t, prevHash, m.GetPrevHash()) } @@ -173,8 +178,9 @@ func TestMetaBlock_SetPubKeysBitmap(t *testing.T) { pubKeysBitmap := []byte{12, 13, 14, 15} m := block.MetaBlock{} - m.SetPubKeysBitmap(pubKeysBitmap) + err := m.SetPubKeysBitmap(pubKeysBitmap) + assert.Nil(t, err) assert.Equal(t, pubKeysBitmap, m.GetPubKeysBitmap()) } @@ -183,8 +189,9 @@ func TestMetaBlock_SetPrevRandSeed(t *testing.T) { prevRandSeed := []byte("previous random seed") m := block.MetaBlock{} - m.SetPrevRandSeed(prevRandSeed) + err := m.SetPrevRandSeed(prevRandSeed) + assert.Nil(t, err) assert.Equal(t, prevRandSeed, m.GetPrevRandSeed()) } @@ -193,8 +200,9 @@ func TestMetaBlock_SetRandSeed(t *testing.T) { randSeed := []byte("random seed") m := block.MetaBlock{} - m.SetRandSeed(randSeed) + err := m.SetRandSeed(randSeed) + assert.Nil(t, err) assert.Equal(t, randSeed, m.GetRandSeed()) } @@ -203,8 +211,9 @@ func TestMetaBlock_SetRootHash(t *testing.T) { rootHash := []byte("root hash") m := block.MetaBlock{} - m.SetRootHash(rootHash) + err := m.SetRootHash(rootHash) + assert.Nil(t, err) assert.Equal(t, rootHash, m.GetRootHash()) } @@ -213,8 +222,9 @@ func TestMetaBlock_SetRound(t *testing.T) { rootHash := []byte("root hash") m := block.MetaBlock{} - m.SetRootHash(rootHash) + err := m.SetRootHash(rootHash) + assert.Nil(t, err) assert.Equal(t, rootHash, m.GetRootHash()) } @@ -223,8 +233,9 @@ func TestMetaBlock_SetSignature(t *testing.T) { signature := []byte("signature") m := block.MetaBlock{} - m.SetSignature(signature) + err := m.SetSignature(signature) + assert.Nil(t, err) assert.Equal(t, signature, m.GetSignature()) } @@ -233,8 +244,9 @@ func TestMetaBlock_SetTimeStamp(t *testing.T) { timestamp := uint64(100000) m := block.MetaBlock{} - m.SetTimeStamp(timestamp) + err := m.SetTimeStamp(timestamp) + assert.Nil(t, err) assert.Equal(t, timestamp, m.GetTimeStamp()) } @@ -243,8 +255,9 @@ func TestMetaBlock_SetTxCount(t *testing.T) { txCount := uint32(100) m := block.MetaBlock{} - m.SetTxCount(txCount) + err := m.SetTxCount(txCount) + assert.Nil(t, err) assert.Equal(t, txCount, m.GetTxCount()) } @@ -346,3 +359,29 @@ func TestMetaBlock_GetOrderedCrossMiniblocksWithDstShouldWork(t *testing.T) { assert.Equal(t, miniBlocksInfo[2].Hash, []byte("hash5")) assert.Equal(t, miniBlocksInfo[2].Round, uint64(7)) } + +func TestMetaBlock_SetScheduledRootHash(t *testing.T) { + t.Parallel() + + metaHdr := &block.MetaBlock{} + err := metaHdr.SetScheduledRootHash([]byte("")) + require.Equal(t, data.ErrScheduledRootHashNotSupported, err) +} + +func TestMetaBlock_ValidateHeaderVersion(t *testing.T) { + t.Parallel() + + metaHdr := &block.MetaBlock{} + err := metaHdr.ValidateHeaderVersion() + require.Nil(t, err) +} + +func TestMetaBlock_SetAdditionalDataShouldDoNothing(t *testing.T) { + t.Parallel() + + var metaBlock *block.MetaBlock + + //goland:noinspection ALL + err := metaBlock.SetAdditionalData(&headerVersionData.AdditionalData{}) + require.Nil(t, err) +} diff --git a/data/block/miniBlockHeader.go b/data/block/miniBlockHeader.go new file mode 100644 index 000000000..8d52709c6 --- /dev/null +++ b/data/block/miniBlockHeader.go @@ -0,0 +1,89 @@ +package block + +import "github.com/ElrondNetwork/elrond-go-core/data" + +// GetTypeInt32 gets the miniBlock type +func (m *MiniBlockHeader) GetTypeInt32() int32 { + if m == nil { + return -1 + } + + return int32(m.Type) +} + +// SetHash sets the miniBlock hash +func (m *MiniBlockHeader) SetHash(hash []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.Hash = hash + + return nil +} + +// SetSenderShardID sets the miniBlock sender shardID +func (m *MiniBlockHeader) SetSenderShardID(shardID uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.SenderShardID = shardID + + return nil +} + +// SetReceiverShardID sets the miniBlock receiver ShardID +func (m *MiniBlockHeader) SetReceiverShardID(shardID uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.ReceiverShardID = shardID + + return nil +} + +// SetTxCount sets the miniBlock txs count +func (m *MiniBlockHeader) SetTxCount(count uint32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.TxCount = count + + return nil +} + +// SetTypeInt32 sets the miniBlock type +func (m *MiniBlockHeader) SetTypeInt32(t int32) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.Type = Type(t) + + return nil +} + +// SetReserved sets the miniBlock reserved field +func (m *MiniBlockHeader) SetReserved(reserved []byte) error { + if m == nil { + return data.ErrNilPointerReceiver + } + + m.Reserved = reserved + + return nil +} + +// ShallowClone returns the miniBlockHeader swallow clone +func (m *MiniBlockHeader) ShallowClone() data.MiniBlockHeaderHandler { + if m == nil { + return nil + } + + mbhCopy := *m + + return &mbhCopy +} diff --git a/data/block/peerBlock.go b/data/block/peerBlock.go new file mode 100644 index 000000000..3b5e2e3ff --- /dev/null +++ b/data/block/peerBlock.go @@ -0,0 +1,25 @@ +package block + +import "github.com/ElrondNetwork/elrond-go-core/data" + +// SetPubKey - setter for public key +func (pc *PeerChange) SetPubKey(pubKey []byte) error { + if pc == nil { + return data.ErrNilPointerReceiver + } + + pc.PubKey = pubKey + + return nil +} + +// SetShardIdDest - setter for destination shardID +func (pc *PeerChange) SetShardIdDest(shardID uint32) error { + if pc == nil { + return data.ErrNilPointerReceiver + } + + pc.ShardIdDest = shardID + + return nil +} diff --git a/data/block/proto/block.proto b/data/block/proto/block.proto index 44694111d..40b8ed499 100644 --- a/data/block/proto/block.proto +++ b/data/block/proto/block.proto @@ -15,13 +15,14 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; // Type identifies the type of the block enum Type { - TxBlock = 0; - StateBlock = 30; - PeerBlock = 60; - SmartContractResultBlock = 90; - InvalidBlock = 120; - ReceiptBlock = 150; - RewardsBlock = 255; + TxBlock = 0; + StateBlock = 30; + PeerBlock = 60; + SmartContractResultBlock = 90; + InvalidBlock = 120; + ReceiptBlock = 150; + ScheduledBlock = 180; + RewardsBlock = 255; } message MiniBlock { diff --git a/data/block/proto/blockV2.proto b/data/block/proto/blockV2.proto new file mode 100644 index 000000000..948ad1238 --- /dev/null +++ b/data/block/proto/blockV2.proto @@ -0,0 +1,16 @@ +// This file holds the data structures related with the functionality of a shard block V2 +syntax = "proto3"; + +package proto; + +option go_package = "block"; +option (gogoproto.stable_marshaler_all) = true; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "block.proto"; + +// HeaderV2 extends the Header structure with extra fields for version 2 +message HeaderV2 { + Header Header = 1; + bytes ScheduledRootHash = 2; +} diff --git a/data/block/shardDataHandler.go b/data/block/shardDataHandler.go new file mode 100644 index 000000000..dce41b421 --- /dev/null +++ b/data/block/shardDataHandler.go @@ -0,0 +1,214 @@ +package block + +import ( + "math/big" + + "github.com/ElrondNetwork/elrond-go-core/data" +) + +// GetShardMiniBlockHeaderHandlers returns the shard miniBlockHeaders as MiniBlockHeaderHandlers +func (sd *ShardData) GetShardMiniBlockHeaderHandlers() []data.MiniBlockHeaderHandler { + if sd == nil || sd.ShardMiniBlockHeaders == nil { + return nil + } + + miniBlockHeaderHandlers := make([]data.MiniBlockHeaderHandler, len(sd.ShardMiniBlockHeaders)) + for i := range sd.ShardMiniBlockHeaders { + miniBlockHeaderHandlers[i] = &sd.ShardMiniBlockHeaders[i] + } + + return miniBlockHeaderHandlers +} + +// SetHeaderHash sets the header hash +func (sd *ShardData) SetHeaderHash(hash []byte) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.HeaderHash = hash + return nil +} + +// SetShardMiniBlockHeaderHandlers sets the miniBlockHeaders from a list of MiniBlockHeaderHandler +func (sd *ShardData) SetShardMiniBlockHeaderHandlers(mbHeaderHandlers []data.MiniBlockHeaderHandler) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + if mbHeaderHandlers == nil { + sd.ShardMiniBlockHeaders = nil + return nil + } + + miniBlockHeaders := make([]MiniBlockHeader, len(mbHeaderHandlers)) + for i, mbh := range mbHeaderHandlers { + mbHeader, ok := mbh.(*MiniBlockHeader) + if !ok { + return data.ErrInvalidTypeAssertion + } + if mbHeader == nil { + return data.ErrNilPointerDereference + } + + miniBlockHeaders[i] = *mbHeader + } + + sd.ShardMiniBlockHeaders = miniBlockHeaders + + return nil +} + +// SetPrevRandSeed sets the prevRandSeed +func (sd *ShardData) SetPrevRandSeed(prevRandSeed []byte) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.PrevRandSeed = prevRandSeed + + return nil +} + +// SetPubKeysBitmap sets the pubKeysBitmap +func (sd *ShardData) SetPubKeysBitmap(pubKeysBitmap []byte) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.PubKeysBitmap = pubKeysBitmap + + return nil +} + +// SetSignature sets the signature +func (sd *ShardData) SetSignature(signature []byte) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.Signature = signature + + return nil +} + +// SetRound sets the round +func (sd *ShardData) SetRound(round uint64) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.Round = round + + return nil +} + +// SetPrevHash sets the prevHash +func (sd *ShardData) SetPrevHash(prevHash []byte) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.PrevHash = prevHash + + return nil +} + +// SetNonce sets the nonce +func (sd *ShardData) SetNonce(nonce uint64) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.Nonce = nonce + + return nil +} + +// SetAccumulatedFees sets the accumulatedFees +func (sd *ShardData) SetAccumulatedFees(fees *big.Int) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + if fees == nil { + return data.ErrInvalidValue + } + if sd.AccumulatedFees == nil { + sd.AccumulatedFees = big.NewInt(0) + } + + sd.AccumulatedFees.Set(fees) + + return nil +} + +// SetDeveloperFees sets the developerFees +func (sd *ShardData) SetDeveloperFees(fees *big.Int) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + if fees == nil { + return data.ErrInvalidValue + } + if sd.DeveloperFees == nil { + sd.DeveloperFees = big.NewInt(0) + } + + sd.DeveloperFees.Set(fees) + + return nil +} + +// SetNumPendingMiniBlocks sets the number of pending miniBlocks +func (sd *ShardData) SetNumPendingMiniBlocks(num uint32) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.NumPendingMiniBlocks = num + + return nil +} + +// SetLastIncludedMetaNonce sets the last included metaBlock nonce +func (sd *ShardData) SetLastIncludedMetaNonce(nonce uint64) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.LastIncludedMetaNonce = nonce + + return nil +} + +// SetShardID sets the shardID +func (sd *ShardData) SetShardID(shardID uint32) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.ShardID = shardID + + return nil +} + +// SetTxCount sets the transaction count +func (sd *ShardData) SetTxCount(txCount uint32) error { + if sd == nil { + return data.ErrNilPointerReceiver + } + + sd.TxCount = txCount + + return nil +} + +// ShallowClone creates and returns a shallow clone of shardData +func (sd *ShardData) ShallowClone() data.ShardDataHandler { + if sd == nil { + return nil + } + + shardDataCopy := *sd + + return &shardDataCopy +} diff --git a/data/errors.go b/data/errors.go index 191a9cb0e..790a430f5 100644 --- a/data/errors.go +++ b/data/errors.go @@ -60,3 +60,18 @@ var ErrNilRcvAddr = errors.New("nil receiver address") // ErrNilSndAddr signals that an operation has been attempted to or with a nil sender address var ErrNilSndAddr = errors.New("nil sender address") + +// ErrNilPointerReceiver signals that a nil pointer receiver was used +var ErrNilPointerReceiver = errors.New("nil pointer receiver") + +// ErrNilPointerDereference signals that a nil pointer dereference was detected and avoided +var ErrNilPointerDereference = errors.New("nil pointer dereference") + +// ErrInvalidTypeAssertion signals an invalid type assertion +var ErrInvalidTypeAssertion = errors.New("invalid type assertion") + +// ErrNilScheduledRootHash signals that a nil scheduled root hash was used +var ErrNilScheduledRootHash = errors.New("scheduled root hash is nil") + +// ErrScheduledRootHashNotSupported signals that a scheduled root hash is not supported +var ErrScheduledRootHashNotSupported = errors.New("scheduled root hash is not supported") diff --git a/data/headerVersionData/shardHeader.go b/data/headerVersionData/shardHeader.go new file mode 100644 index 000000000..0570b9dc9 --- /dev/null +++ b/data/headerVersionData/shardHeader.go @@ -0,0 +1,28 @@ +package headerVersionData + +// HeaderAdditionalData holds getters for the additional version related header data for new versions +// for future versions this interface can grow +type HeaderAdditionalData interface { + GetScheduledRootHash() []byte + IsInterfaceNil() bool +} + +// AdditionalData holds the additional version related header data +// for future header versions this structure can grow +type AdditionalData struct { + ScheduledRootHash []byte +} + +// GetScheduledRootHash returns the scheduled RootHash +func (ad *AdditionalData) GetScheduledRootHash() []byte { + if ad == nil { + return nil + } + + return ad.ScheduledRootHash +} + +// IsInterfaceNil returns true if there is no value under the interface +func (ad *AdditionalData) IsInterfaceNil() bool { + return ad == nil +} diff --git a/data/interface.go b/data/interface.go index cbe1d3f12..712c4339e 100644 --- a/data/interface.go +++ b/data/interface.go @@ -2,6 +2,8 @@ package data import ( "math/big" + + "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" ) // HeaderHandler defines getters and setters for header data holder @@ -11,7 +13,6 @@ type HeaderHandler interface { GetEpoch() uint32 GetRound() uint64 GetRootHash() []byte - GetValidatorStatsRootHash() []byte GetPrevHash() []byte GetPrevRandSeed() []byte GetRandSeed() []byte @@ -25,35 +26,177 @@ type HeaderHandler interface { GetReceiptsHash() []byte GetAccumulatedFees() *big.Int GetDeveloperFees() *big.Int - GetEpochStartMetaHash() []byte GetReserved() []byte - - SetAccumulatedFees(value *big.Int) - SetDeveloperFees(value *big.Int) - SetShardID(shId uint32) - SetNonce(n uint64) - SetEpoch(e uint32) - SetRound(r uint64) - SetTimeStamp(ts uint64) - SetRootHash(rHash []byte) - SetValidatorStatsRootHash(rHash []byte) - SetPrevHash(pvHash []byte) - SetPrevRandSeed(pvRandSeed []byte) - SetRandSeed(randSeed []byte) - SetPubKeysBitmap(pkbm []byte) - SetSignature(sg []byte) - SetLeaderSignature(sg []byte) - SetChainID(chainID []byte) - SetSoftwareVersion(version []byte) - SetTxCount(txCount uint32) - - IsStartOfEpochBlock() bool GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32 GetOrderedCrossMiniblocksWithDst(destId uint32) []*MiniBlockInfo GetMiniBlockHeadersHashes() [][]byte + GetMiniBlockHeaderHandlers() []MiniBlockHeaderHandler + HasScheduledSupport() bool + SetAccumulatedFees(value *big.Int) error + SetDeveloperFees(value *big.Int) error + SetShardID(shId uint32) error + SetNonce(n uint64) error + SetEpoch(e uint32) error + SetRound(r uint64) error + SetTimeStamp(ts uint64) error + SetRootHash(rHash []byte) error + SetPrevHash(pvHash []byte) error + SetPrevRandSeed(pvRandSeed []byte) error + SetRandSeed(randSeed []byte) error + SetPubKeysBitmap(pkbm []byte) error + SetSignature(sg []byte) error + SetLeaderSignature(sg []byte) error + SetChainID(chainID []byte) error + SetSoftwareVersion(version []byte) error + SetTxCount(txCount uint32) error + SetMiniBlockHeaderHandlers(mbHeaderHandlers []MiniBlockHeaderHandler) error + SetReceiptsHash(hash []byte) error + SetScheduledRootHash(rootHash []byte) error + ValidateHeaderVersion() error + SetAdditionalData(headerVersionData headerVersionData.HeaderAdditionalData) error + IsStartOfEpochBlock() bool + ShallowClone() HeaderHandler IsInterfaceNil() bool - Clone() HeaderHandler +} + +// ShardHeaderHandler defines getters and setters for the shard block header +type ShardHeaderHandler interface { + HeaderHandler + GetMetaBlockHashes() [][]byte + GetEpochStartMetaHash() []byte + SetEpochStartMetaHash(hash []byte) error + GetBlockBodyTypeInt32() int32 + SetMetaBlockHashes(hashes [][]byte) error + MapMiniBlockHashesToShards() map[string]uint32 +} + +// MetaHeaderHandler defines getters and setters for the meta block header +type MetaHeaderHandler interface { + HeaderHandler + GetValidatorStatsRootHash() []byte + GetEpochStartHandler() EpochStartHandler + GetDevFeesInEpoch() *big.Int + GetShardInfoHandlers() []ShardDataHandler + SetValidatorStatsRootHash(rHash []byte) error + SetDevFeesInEpoch(value *big.Int) error + SetShardInfoHandlers(shardInfo []ShardDataHandler) error + SetAccumulatedFeesInEpoch(value *big.Int) error +} + +// MiniBlockHeaderHandler defines setters and getters for miniBlock headers +type MiniBlockHeaderHandler interface { + GetHash() []byte + GetSenderShardID() uint32 + GetReceiverShardID() uint32 + GetTxCount() uint32 + GetTypeInt32() int32 + GetReserved() []byte + + SetHash(hash []byte) error + SetSenderShardID(shardID uint32) error + SetReceiverShardID(shardID uint32) error + SetTxCount(count uint32) error + SetTypeInt32(t int32) error + SetReserved(reserved []byte) error + ShallowClone() MiniBlockHeaderHandler +} + +// PeerChangeHandler defines setters and getters for PeerChange +type PeerChangeHandler interface { + GetPubKey() []byte + GetShardIdDest() uint32 + + SetPubKey(pubKey []byte) error + SetShardIdDest(shardID uint32) error +} + +// ShardDataHandler defines setters and getters for ShardDataHandler +type ShardDataHandler interface { + GetHeaderHash() []byte + GetShardMiniBlockHeaderHandlers() []MiniBlockHeaderHandler + GetPrevRandSeed() []byte + GetPubKeysBitmap() []byte + GetSignature() []byte + GetRound() uint64 + GetPrevHash() []byte + GetNonce() uint64 + GetAccumulatedFees() *big.Int + GetDeveloperFees() *big.Int + GetNumPendingMiniBlocks() uint32 + GetLastIncludedMetaNonce() uint64 + GetShardID() uint32 + GetTxCount() uint32 + + SetHeaderHash(hash []byte) error + SetShardMiniBlockHeaderHandlers(mbHeaderHandlers []MiniBlockHeaderHandler) error + SetPrevRandSeed(prevRandSeed []byte) error + SetPubKeysBitmap(pubKeysBitmap []byte) error + SetSignature(signature []byte) error + SetRound(round uint64) error + SetPrevHash(prevHash []byte) error + SetNonce(nonce uint64) error + SetAccumulatedFees(fees *big.Int) error + SetDeveloperFees(fees *big.Int) error + SetNumPendingMiniBlocks(num uint32) error + SetLastIncludedMetaNonce(nonce uint64) error + SetShardID(shardID uint32) error + SetTxCount(txCount uint32) error + + ShallowClone() ShardDataHandler +} + +// EpochStartShardDataHandler defines setters and getters for EpochStartShardData +type EpochStartShardDataHandler interface { + GetShardID() uint32 + GetEpoch() uint32 + GetRound() uint64 + GetNonce() uint64 + GetHeaderHash() []byte + GetRootHash() []byte + GetFirstPendingMetaBlock() []byte + GetLastFinishedMetaBlock() []byte + GetPendingMiniBlockHeaderHandlers() []MiniBlockHeaderHandler + + SetShardID(uint32) error + SetEpoch(uint32) error + SetRound(uint64) error + SetNonce(uint64) error + SetHeaderHash([]byte) error + SetRootHash([]byte) error + SetFirstPendingMetaBlock([]byte) error + SetLastFinishedMetaBlock([]byte) error + SetPendingMiniBlockHeaders([]MiniBlockHeaderHandler) error +} + +// EconomicHandler defines setters and getters for Economics +type EconomicsHandler interface { + GetTotalSupply() *big.Int + GetTotalToDistribute() *big.Int + GetTotalNewlyMinted() *big.Int + GetRewardsPerBlock() *big.Int + GetRewardsForProtocolSustainability() *big.Int + GetNodePrice() *big.Int + GetPrevEpochStartRound() uint64 + GetPrevEpochStartHash() []byte + + SetTotalSupply(totalSupply *big.Int) error + SetTotalToDistribute(totalToDistribute *big.Int) error + SetTotalNewlyMinted(totalNewlyMinted *big.Int) error + SetRewardsPerBlock(rewardsPerBlock *big.Int) error + SetRewardsForProtocolSustainability(rewardsForProtocolSustainability *big.Int) error + SetNodePrice(nodePrice *big.Int) error + SetPrevEpochStartRound(prevEpochStartRound uint64) error + SetPrevEpochStartHash(prevEpochStartHash []byte) error +} + +// EpochStartHandler defines setters and getters for EpochStart +type EpochStartHandler interface { + GetLastFinalizedHeaderHandlers() []EpochStartShardDataHandler + GetEconomicsHandler() EconomicsHandler + + SetLastFinalizedHeaders(epochStartShardDataHandlers []EpochStartShardDataHandler) error + SetEconomics(economicsHandler EconomicsHandler) error } // BodyHandler interface for a block body diff --git a/data/receipt/receipt.pb.go b/data/receipt/receipt.pb.go index 30ffacdb4..93238c104 100644 --- a/data/receipt/receipt.pb.go +++ b/data/receipt/receipt.pb.go @@ -6,7 +6,7 @@ package receipt import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -99,27 +99,27 @@ func init() { func init() { proto.RegisterFile("receipt.proto", fileDescriptor_ace1d6eb38fad2c8) } var fileDescriptor_ace1d6eb38fad2c8 = []byte{ - // 313 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xbd, 0x4e, 0xf3, 0x30, - 0x18, 0x85, 0xed, 0xef, 0xeb, 0x8f, 0x64, 0x01, 0x83, 0xa7, 0x88, 0xe1, 0x0d, 0xaa, 0x10, 0x62, - 0xa0, 0xc9, 0xc0, 0xc8, 0xd4, 0x02, 0x12, 0x5d, 0x3a, 0x04, 0xc4, 0xc0, 0xe6, 0xd4, 0xc6, 0x8d, - 0x68, 0xe2, 0xca, 0x7d, 0xcb, 0xcf, 0xc6, 0x25, 0x70, 0x19, 0x88, 0x2b, 0x61, 0xec, 0xd8, 0xa9, - 0x10, 0x77, 0x41, 0x9d, 0x7a, 0x09, 0xa8, 0x6e, 0x11, 0x4c, 0xf6, 0x39, 0xc7, 0x7e, 0x8e, 0x74, - 0xd8, 0xb6, 0x55, 0x3d, 0x95, 0x0d, 0x31, 0x1a,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0x3a, - 0x75, 0x40, 0x3f, 0x1d, 0xd0, 0x2f, 0x07, 0x64, 0xe9, 0x80, 0xbe, 0xcc, 0x81, 0x4c, 0xe6, 0x40, - 0xa6, 0x73, 0x20, 0x37, 0xf5, 0xcd, 0xc4, 0x69, 0xcd, 0xaf, 0x75, 0xfc, 0x1d, 0x00, 0x00, 0xff, - 0xff, 0x92, 0x61, 0x03, 0x72, 0x74, 0x01, 0x00, 0x00, + // 318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x50, 0xbd, 0x4e, 0x33, 0x31, + 0x10, 0x3c, 0x7f, 0x5f, 0x7e, 0x24, 0x0b, 0x28, 0x5c, 0x9d, 0x28, 0xf6, 0x50, 0x84, 0x10, 0x05, + 0xb9, 0x2b, 0x28, 0xa9, 0x12, 0x7e, 0x44, 0x1a, 0x8a, 0x0b, 0xa2, 0xa0, 0xf3, 0xc5, 0xc6, 0xb1, + 0xc8, 0x9d, 0x23, 0x67, 0xc3, 0x4f, 0xc7, 0x23, 0xf0, 0x18, 0x88, 0x27, 0xa1, 0x4c, 0x99, 0x2a, + 0x10, 0x47, 0x42, 0x28, 0x55, 0x1e, 0x01, 0xc5, 0x09, 0x82, 0x6a, 0x77, 0x66, 0x76, 0x67, 0xa4, + 0xa1, 0x9b, 0x56, 0x76, 0xa4, 0xee, 0x63, 0xdc, 0xb7, 0x06, 0x0d, 0x2b, 0xfb, 0xb1, 0x5d, 0x57, + 0x1a, 0xbb, 0xc3, 0x2c, 0xee, 0x98, 0x3c, 0x51, 0x46, 0x99, 0xc4, 0xd3, 0xd9, 0xf0, 0xc6, 0x23, + 0x0f, 0xfc, 0xb6, 0xfa, 0xaa, 0x7d, 0x12, 0x5a, 0x4d, 0x57, 0x3e, 0x4c, 0xd3, 0xf2, 0x15, 0xef, + 0x0d, 0x65, 0x48, 0x76, 0xc8, 0xfe, 0x46, 0xb3, 0x3d, 0x9f, 0x44, 0xe5, 0xbb, 0x25, 0xf1, 0xfa, + 0x1e, 0x9d, 0xe5, 0x1c, 0xbb, 0x49, 0xa6, 0x55, 0xdc, 0x2a, 0xf0, 0xe8, 0x4f, 0xc6, 0x69, 0xcf, + 0x9a, 0x42, 0x5c, 0x48, 0xbc, 0x37, 0xf6, 0x36, 0x91, 0x1e, 0xd5, 0x95, 0xa9, 0x77, 0x8c, 0x95, + 0x89, 0xe0, 0xc8, 0xe3, 0xa6, 0x56, 0xad, 0x02, 0x8f, 0xf9, 0x00, 0xa5, 0x4d, 0x57, 0x09, 0x6c, + 0x97, 0x56, 0xdb, 0x85, 0x68, 0x08, 0x61, 0xc3, 0x7f, 0x3e, 0x8c, 0xce, 0x27, 0x51, 0x65, 0x20, + 0x0b, 0x21, 0x6d, 0xfa, 0x23, 0xb1, 0x3d, 0x5a, 0x3a, 0xe1, 0xc8, 0xc3, 0xff, 0xfe, 0x84, 0xcd, + 0x27, 0xd1, 0xd6, 0xd2, 0xf1, 0xc0, 0xe4, 0x1a, 0x65, 0xde, 0xc7, 0xc7, 0xd4, 0xeb, 0xac, 0x46, + 0x2b, 0x97, 0x0f, 0xe7, 0x7c, 0xd0, 0x0d, 0x4b, 0xbf, 0x66, 0xe8, 0x99, 0x74, 0xad, 0x34, 0x1b, + 0xa3, 0x29, 0x04, 0xe3, 0x29, 0x04, 0x8b, 0x29, 0x90, 0x27, 0x07, 0xe4, 0xc5, 0x01, 0x79, 0x73, + 0x40, 0x46, 0x0e, 0xc8, 0xd8, 0x01, 0xf9, 0x70, 0x40, 0xbe, 0x1c, 0x04, 0x0b, 0x07, 0xe4, 0x79, + 0x06, 0xc1, 0x68, 0x06, 0xc1, 0x78, 0x06, 0xc1, 0x75, 0x75, 0xdd, 0x73, 0x56, 0xf1, 0x95, 0x1d, + 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x65, 0xec, 0xc7, 0x7c, 0x79, 0x01, 0x00, 0x00, } func (this *Receipt) Equal(that interface{}) bool { @@ -142,7 +142,7 @@ func (this *Receipt) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.Value, that1.Value) { return false } @@ -221,7 +221,7 @@ func (m *Receipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.Value) i -= size if _, err := __caster.MarshalTo(m.Value, dAtA[i:]); err != nil { @@ -252,7 +252,7 @@ func (m *Receipt) Size() (n int) { var l int _ = l { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.Value) n += 1 + l + sovReceipt(uint64(l)) } @@ -357,7 +357,7 @@ func (m *Receipt) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { diff --git a/data/rewardTx/rewardTx.go b/data/rewardTx/rewardTx.go index 0f2cdee4e..0dfee0789 100644 --- a/data/rewardTx/rewardTx.go +++ b/data/rewardTx/rewardTx.go @@ -20,32 +20,32 @@ func (rtx *RewardTx) SetValue(value *big.Int) { } // GetNonce returns 0 as reward transactions do not have a nonce -func (_ *RewardTx) GetNonce() uint64 { +func (rtx *RewardTx) GetNonce() uint64 { return 0 } // GetData returns the data of the reward transaction -func (_ *RewardTx) GetData() []byte { +func (rtx *RewardTx) GetData() []byte { return []byte("") } // GetSndAddr returns the sender address from the reward transaction -func (_ *RewardTx) GetSndAddr() []byte { +func (rtx *RewardTx) GetSndAddr() []byte { return nil } // GetGasLimit returns the gas limit of the smart reward transaction -func (_ *RewardTx) GetGasLimit() uint64 { +func (rtx *RewardTx) GetGasLimit() uint64 { return 0 } // GetGasPrice returns the gas price of the smart reward transaction -func (_ *RewardTx) GetGasPrice() uint64 { +func (rtx *RewardTx) GetGasPrice() uint64 { return 0 } // SetData sets the data of the reward transaction -func (_ *RewardTx) SetData(data []byte) { +func (rtx *RewardTx) SetData(_ []byte) { } // SetRcvAddr sets the receiver address of the reward transaction @@ -54,11 +54,11 @@ func (rtx *RewardTx) SetRcvAddr(addr []byte) { } // SetSndAddr sets the sender address of the reward transaction -func (_ *RewardTx) SetSndAddr(addr []byte) { +func (rtx *RewardTx) SetSndAddr(_ []byte) { } // GetRcvUserName returns the receiver user name from the reward transaction -func (_ *RewardTx) GetRcvUserName() []byte { +func (rtx *RewardTx) GetRcvUserName() []byte { return nil } diff --git a/data/rewardTx/rewardTx.pb.go b/data/rewardTx/rewardTx.pb.go index eb8d4042a..7eae9cabf 100644 --- a/data/rewardTx/rewardTx.pb.go +++ b/data/rewardTx/rewardTx.pb.go @@ -6,7 +6,7 @@ package rewardTx import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -140,33 +140,33 @@ func init() { func init() { proto.RegisterFile("rewardTx.proto", fileDescriptor_25dbfb608d6baddf) } var fileDescriptor_25dbfb608d6baddf = []byte{ - // 406 bytes of a gzipped FileDescriptorProto + // 409 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xc1, 0x8a, 0xd3, 0x40, 0x1c, 0xc6, 0x33, 0xbb, 0xc9, 0x9a, 0x1d, 0x5a, 0x89, 0x03, 0x42, 0x10,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d, 0xb6, 0xbe, 0xba, 0xfd, 0xb9, 0xb3, 0x33, 0x73, 0xb1, 0xd7, 0xff, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xcf, 0xe7, 0x20, 0x17, 0x01, 0x02, 0x00, 0x00, } func (x Type) String() string { @@ -199,7 +199,7 @@ func (this *RewardTx) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.Value, that1.Value) { return false } @@ -261,7 +261,7 @@ func (m *RewardTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.Value) i -= size if _, err := __caster.MarshalTo(m.Value, dAtA[i:]); err != nil { @@ -308,7 +308,7 @@ func (m *RewardTx) Size() (n int) { n += 1 + sovRewardTx(uint64(m.Epoch)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.Value) n += 1 + l + sovRewardTx(uint64(l)) } @@ -443,7 +443,7 @@ func (m *RewardTx) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { diff --git a/data/smartContractResult/proto/smartContractResult.proto b/data/smartContractResult/proto/smartContractResult.proto index 6ce33ae0d..e04d5aa96 100644 --- a/data/smartContractResult/proto/smartContractResult.proto +++ b/data/smartContractResult/proto/smartContractResult.proto @@ -21,7 +21,7 @@ message SmartContractResult { bytes OriginalTxHash = 10 [(gogoproto.jsontag) = "originalTxHash"]; uint64 GasLimit = 11 [(gogoproto.jsontag) = "gasLimit"]; uint64 GasPrice = 12 [(gogoproto.jsontag) = "gasPrice"]; - int64 CallType = 13 [(gogoproto.jsontag) = "callType", (gogoproto.casttype) = "github.com/ElrondNetwork/elrond-vm-common/vmcommon.CallType"]; + int64 CallType = 13 [(gogoproto.jsontag) = "callType", (gogoproto.casttype) = "github.com/ElrondNetwork/elrond-vm-common.CallType"]; bytes CodeMetadata = 14 [(gogoproto.jsontag) = "codeMetadata,omitempty"]; bytes ReturnMessage = 15 [(gogoproto.jsontag) = "returnMessage,omitempty"]; bytes OriginalSender = 16 [(gogoproto.jsontag) = "originalSender,omitempty"]; diff --git a/data/smartContractResult/smartContractResult.pb.go b/data/smartContractResult/smartContractResult.pb.go index bfbd9f790..dcbcef3c6 100644 --- a/data/smartContractResult/smartContractResult.pb.go +++ b/data/smartContractResult/smartContractResult.pb.go @@ -6,8 +6,8 @@ package smartContractResult import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" - github_com_ElrondNetwork_elrond_vm_common_vmcommon "github.com/ElrondNetwork/elrond-vm-common" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_vm_common "github.com/ElrondNetwork/elrond-vm-common" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -30,22 +30,22 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type SmartContractResult struct { - Nonce uint64 `protobuf:"varint,1,opt,name=Nonce,proto3" json:"nonce"` - Value *math_big.Int `protobuf:"bytes,2,opt,name=Value,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"value"` - RcvAddr []byte `protobuf:"bytes,3,opt,name=RcvAddr,proto3" json:"receiver"` - SndAddr []byte `protobuf:"bytes,4,opt,name=SndAddr,proto3" json:"sender"` - RelayerAddr []byte `protobuf:"bytes,5,opt,name=RelayerAddr,proto3" json:"relayer"` - RelayedValue *math_big.Int `protobuf:"bytes,6,opt,name=RelayedValue,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"relayedValue"` - Code []byte `protobuf:"bytes,7,opt,name=Code,proto3" json:"code,omitempty"` - Data []byte `protobuf:"bytes,8,opt,name=Data,proto3" json:"data,omitempty"` - PrevTxHash []byte `protobuf:"bytes,9,opt,name=PrevTxHash,proto3" json:"prevTxHash"` - OriginalTxHash []byte `protobuf:"bytes,10,opt,name=OriginalTxHash,proto3" json:"originalTxHash"` - GasLimit uint64 `protobuf:"varint,11,opt,name=GasLimit,proto3" json:"gasLimit"` - GasPrice uint64 `protobuf:"varint,12,opt,name=GasPrice,proto3" json:"gasPrice"` - CallType github_com_ElrondNetwork_elrond_vm_common_vmcommon.CallType `protobuf:"varint,13,opt,name=CallType,proto3,casttype=github.com/ElrondNetwork/elrond-vm-common/vmcommon.CallType" json:"callType"` - CodeMetadata []byte `protobuf:"bytes,14,opt,name=CodeMetadata,proto3" json:"codeMetadata,omitempty"` - ReturnMessage []byte `protobuf:"bytes,15,opt,name=ReturnMessage,proto3" json:"returnMessage,omitempty"` - OriginalSender []byte `protobuf:"bytes,16,opt,name=OriginalSender,proto3" json:"originalSender,omitempty"` + Nonce uint64 `protobuf:"varint,1,opt,name=Nonce,proto3" json:"nonce"` + Value *math_big.Int `protobuf:"bytes,2,opt,name=Value,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"value"` + RcvAddr []byte `protobuf:"bytes,3,opt,name=RcvAddr,proto3" json:"receiver"` + SndAddr []byte `protobuf:"bytes,4,opt,name=SndAddr,proto3" json:"sender"` + RelayerAddr []byte `protobuf:"bytes,5,opt,name=RelayerAddr,proto3" json:"relayer"` + RelayedValue *math_big.Int `protobuf:"bytes,6,opt,name=RelayedValue,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"relayedValue"` + Code []byte `protobuf:"bytes,7,opt,name=Code,proto3" json:"code,omitempty"` + Data []byte `protobuf:"bytes,8,opt,name=Data,proto3" json:"data,omitempty"` + PrevTxHash []byte `protobuf:"bytes,9,opt,name=PrevTxHash,proto3" json:"prevTxHash"` + OriginalTxHash []byte `protobuf:"bytes,10,opt,name=OriginalTxHash,proto3" json:"originalTxHash"` + GasLimit uint64 `protobuf:"varint,11,opt,name=GasLimit,proto3" json:"gasLimit"` + GasPrice uint64 `protobuf:"varint,12,opt,name=GasPrice,proto3" json:"gasPrice"` + CallType github_com_ElrondNetwork_elrond_vm_common.CallType `protobuf:"varint,13,opt,name=CallType,proto3,casttype=github.com/ElrondNetwork/elrond-vm-common.CallType" json:"callType"` + CodeMetadata []byte `protobuf:"bytes,14,opt,name=CodeMetadata,proto3" json:"codeMetadata,omitempty"` + ReturnMessage []byte `protobuf:"bytes,15,opt,name=ReturnMessage,proto3" json:"returnMessage,omitempty"` + OriginalSender []byte `protobuf:"bytes,16,opt,name=OriginalSender,proto3" json:"originalSender,omitempty"` } func (m *SmartContractResult) Reset() { *m = SmartContractResult{} } @@ -160,7 +160,7 @@ func (m *SmartContractResult) GetGasPrice() uint64 { return 0 } -func (m *SmartContractResult) GetCallType() github_com_ElrondNetwork_elrond_vm_common_vmcommon.CallType { +func (m *SmartContractResult) GetCallType() github_com_ElrondNetwork_elrond_vm_common.CallType { if m != nil { return m.CallType } @@ -195,46 +195,46 @@ func init() { func init() { proto.RegisterFile("smartContractResult.proto", fileDescriptor_edc1605de0d3d805) } var fileDescriptor_edc1605de0d3d805 = []byte{ - // 614 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x31, 0x6f, 0xd3, 0x4e, - 0x18, 0xc6, 0x73, 0xff, 0x36, 0x4d, 0x7a, 0x4d, 0xf3, 0x47, 0x57,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, 0x34, - 0xce, 0x33, 0x02, 0x3e, 0x9e, 0x91, 0xc6, 0xf1, 0x19, 0x69, 0x9c, 0x9c, 0x91, 0xc6, 0xeb, 0xb5, - 0x3f, 0xdc, 0x31, 0xa3, 0x25, 0x73, 0x5d, 0xdc, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x8f, - 0x69, 0xc7, 0x81, 0x04, 0x00, 0x00, + // 616 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x6b, 0xb6, 0xae, 0x9d, 0xd7, 0x15, 0xe4, 0x49, 0x60, 0x06, 0xb2, 0x27, 0x84, 0xa6, + 0x1e, 0x68, 0x2a, 0xc1, 0x0d, 0x24, 0xa4, 0xa5, 0xe3, 0xcf, 0x24, 0x36, 0x26, 0x77, 0xe2, 0xb0, + 0x03, 0x92, 0x9b, 0x98, 0x2c, 0x22, 0x89, 0x2b, 0xc7, 0x2d, 0xec, 0x82, 0xf8, 0x08, 0x7c, 0x0c, + 0xc4, 0x27, 0xe1, 0xb8, 0x1b, 0x3b, 0x05, 0x96, 0x5d, 0x50, 0x4e, 0x3b, 0x73, 0x42, 0x71, 0xba, + 0x2e, 0x19, 0x48, 0x5c, 0x38, 0xb5, 0xef, 0xf3, 0xfc, 0xde, 0xe7, 0xad, 0xdf, 0x5a, 0x86, 0x37, + 0xe3, 0x90, 0x2b, 0xdd, 0x97, 0x91, 0x56, 0xdc, 0xd1, 0x4c, 0xc4, 0xe3, 0x40, 0x5b, 0x23, 0x25, + 0xb5, 0x44, 0x75, 0xf3, 0xb1, 0xda, 0xf5, 0x7c, 0x7d, 0x30, 0x1e, 0x5a, 0x8e, 0x0c, 0x7b, 0x9e, + 0xf4, 0x64, 0xcf, 0xc8, 0xc3, 0xf1, 0x1b, 0x53, 0x99, 0xc2, 0x7c, 0x2b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x56, 0xd1, 0xb6, 0x88, 0x63, 0xee, 0x09, 0x7c, 0xd5, + 0x04, 0xdc, 0xca, 0x12, 0x7a, 0x43, 0x95, 0x8d, 0x52, 0x42, 0xb5, 0x03, 0x6d, 0x5e, 0xac, 0x7c, + 0x60, 0x2e, 0x2f, 0xbe, 0x66, 0x32, 0x6e, 0x67, 0x09, 0xc5, 0xb2, 0xe2, 0x94, 0x42, 0x2e, 0xf5, + 0xd8, 0xdb, 0x47, 0x27, 0xa4, 0x76, 0x7c, 0x42, 0x6a, 0x67, 0x27, 0x04, 0x7c, 0x4c, 0x09, 0xf8, + 0x9c, 0x12, 0xf0, 0x35, 0x25, 0xe0, 0x28, 0x25, 0xe0, 0x38, 0x25, 0xe0, 0x47, 0x4a, 0xc0, 0xcf, + 0x94, 0xd4, 0xce, 0x52, 0x02, 0x3e, 0x9d, 0x92, 0xda, 0xd1, 0x29, 0xa9, 0x1d, 0x9f, 0x92, 0xda, + 0xfe, 0xca, 0x5f, 0x1e, 0x99, 0xe1, 0x82, 0x79, 0x2f, 0x1e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, + 0x26, 0x31, 0x3a, 0xbd, 0x82, 0x04, 0x00, 0x00, } func (this *SmartContractResult) Equal(that interface{}) bool { @@ -260,7 +260,7 @@ func (this *SmartContractResult) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.Value, that1.Value) { return false } @@ -275,7 +275,7 @@ func (this *SmartContractResult) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.RelayedValue, that1.RelayedValue) { return false } @@ -432,7 +432,7 @@ func (m *SmartContractResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.RelayedValue) i -= size if _, err := __caster.MarshalTo(m.RelayedValue, dAtA[i:]); err != nil { @@ -464,7 +464,7 @@ func (m *SmartContractResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.Value) i -= size if _, err := __caster.MarshalTo(m.Value, dAtA[i:]); err != nil { @@ -503,7 +503,7 @@ func (m *SmartContractResult) Size() (n int) { n += 1 + sovSmartContractResult(uint64(m.Nonce)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.Value) n += 1 + l + sovSmartContractResult(uint64(l)) } @@ -520,7 +520,7 @@ func (m *SmartContractResult) Size() (n int) { n += 1 + l + sovSmartContractResult(uint64(l)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.RelayedValue) n += 1 + l + sovSmartContractResult(uint64(l)) } @@ -681,7 +681,7 @@ func (m *SmartContractResult) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -821,7 +821,7 @@ func (m *SmartContractResult) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { @@ -1017,7 +1017,7 @@ func (m *SmartContractResult) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CallType |= github_com_ElrondNetwork_elrond_vm_common_vmcommon.CallType(b&0x7F) << shift + m.CallType |= github_com_ElrondNetwork_elrond_vm_common.CallType(b&0x7F) << shift if b < 0x80 { break } diff --git a/data/transaction/transaction.pb.go b/data/transaction/transaction.pb.go index 8825188b4..199cb8d35 100644 --- a/data/transaction/transaction.pb.go +++ b/data/transaction/transaction.pb.go @@ -6,7 +6,7 @@ package transaction import ( bytes "bytes" fmt "fmt" - github_com_ElrondNetwork_elrond_go_data "github.com/ElrondNetwork/elrond-go-core/data" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -171,40 +171,40 @@ func init() { func init() { proto.RegisterFile("transaction.proto", fileDescriptor_2cc4e03d2c28c490) } var fileDescriptor_2cc4e03d2c28c490 = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x1c, 0xc6, 0x63, 0x58, 0x96, 0xd5, 0xed, 0x90, 0x66, 0x34, 0x30, 0x1c, 0xec, 0x0a, 0xc1, 0xd4, - 0x03, 0x6b, 0x24, 0x10, 0xa7, 0x9d, 0xd6, 0x6d, 0x42, 0x95, 0x50, 0x41, 0x29, 0xec, 0xc0, 0xcd, - 0x4d, 0x4c, 0x6a, 0xb1, 0xd8, 0x95, 0xe3, 0x16, 0x71, 0xe3, 0x11, 0x78, 0x06, 0x4e, 0x88, 0x27, - 0xe1, 0xd8, 0x63, 0x4f, 0x81, 0xa6, 0x17, 0x94, 0xd3, 0x1e, 0x01, 0xc5, 0x69, 0xd7, 0xc0, 0xa9, - 0xf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, 0x8d, 0xab, 0x77, 0x31, - 0x5f, 0x12, 0x67, 0xb1, 0x24, 0xce, 0xf5, 0x92, 0x80, 0x2f, 0x39, 0x01, 0xdf, 0x73, 0x02, 0x7e, - 0xe6, 0x04, 0xcc, 0x73, 0x02, 0x16, 0x39, 0x01, 0xbf, 0x73, 0x02, 0xfe, 0xe4, 0xc4, 0xb9, 0xce, - 0x09, 0xf8, 0xba, 0x22, 0xce, 0x7c, 0x45, 0x9c, 0xc5, 0x8a, 0x38, 0xef, 0x9b, 0xb5, 0xef, 0x64, - 0xb4, 0x6b, 0x9f, 0xfc, 0xf3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x36, 0xda, 0x4b, 0xdc, 0x3d, - 0x03, 0x00, 0x00, + // 516 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x93, 0xb1, 0x8e, 0xd3, 0x30, + 0x1c, 0xc6, 0x63, 0x68, 0x9a, 0xd6, 0xed, 0x21, 0x9d, 0xd1, 0x41, 0x60, 0xb0, 0x2b, 0x04, 0xa7, + 0x0e, 0xb4, 0x91, 0x40, 0x4c, 0x37, 0xd1, 0xbb, 0x03, 0x55, 0x42, 0x05, 0xa5, 0x70, 0x03, 0x9b, + 0x9b, 0x98, 0xd4, 0xe2, 0x62, 0x57, 0x8e, 0x5b, 0xc4, 0xc6, 0x23, 0xf0, 0x16, 0x20, 0x9e, 0x84, + 0xb1, 0x63, 0xa7, 0x40, 0xd3, 0x05, 0x65, 0xba, 0x47, 0x40, 0x71, 0xda, 0x6b, 0x60, 0x6a, 0xfd, + 0xfb, 0xff, 0x3e, 0x7f, 0x96, 0xe5, 0xc0, 0x43, 0xad, 0xa8, 0x48, 0x68, 0xa0, 0xb9, 0x14, 0xfd, + 0x99, 0x92, 0x5a, 0x22, 0xdb, 0xfc, 0xdc, 0xef, 0x45, 0x5c, 0x4f, 0xe7, 0x93, 0x7e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, 0x77, 0x86, 0xc1, 0x9f, 0x0c, 0x5b, + 0x57, 0x19, 0x06, 0x5f, 0x37, 0xd8, 0x5a, 0x6e, 0xb0, 0xb5, 0xda, 0x60, 0xeb, 0x7d, 0xab, 0xf2, + 0xb1, 0x4c, 0xea, 0xe6, 0xdd, 0x3f, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xec, 0xb4, 0x83, 0x7f, + 0x42, 0x03, 0x00, 0x00, } func (this *Transaction) Equal(that interface{}) bool { @@ -230,7 +230,7 @@ func (this *Transaction) Equal(that interface{}) bool { return false } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if !__caster.Equal(this.Value, that1.Value) { return false } @@ -390,7 +390,7 @@ func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.Value) i -= size if _, err := __caster.MarshalTo(m.Value, dAtA[i:]); err != nil { @@ -429,7 +429,7 @@ func (m *Transaction) Size() (n int) { n += 1 + sovTransaction(uint64(m.Nonce)) } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} l = __caster.Size(m.Value) n += 1 + l + sovTransaction(uint64(l)) } @@ -590,7 +590,7 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } { - __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } else { diff --git a/go.mod b/go.mod index 57a8cc83b..e6ff29e5a 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/pelletier/go-toml v1.9.3 github.com/pkg/errors v0.9.1 - github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada + github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada // indirect github.com/stretchr/testify v1.7.0 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 ) diff --git a/go.sum b/go.sum index 60478afb1..754246669 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ github.com/ElrondNetwork/elrond-go-core v0.0.1/go.mod h1:cNsmRhhHPyT55lH4T/3vzDCxTbTx8BMrBhc/pvnKiec= +github.com/ElrondNetwork/elrond-go-logger v1.0.4 h1:i5Yu4qyjTZDwvBY/ykbNpp2SP9jxwk/QTivRwSZSTAQ= github.com/ElrondNetwork/elrond-go-logger v1.0.4/go.mod h1:e5D+c97lKUfFdAzFX7rrI2Igl/z4Y0RkKYKWyzprTGk= github.com/ElrondNetwork/elrond-vm-common v1.1.0 h1:zSIXrNbIb/SyKB2+JIOWenUSky5+NgEr0iQtFiWp17o= github.com/ElrondNetwork/elrond-vm-common v1.1.0/go.mod h1:w3i6f8uiuRkE68Ie/gebRcLgTuHqvruJSYrFyZWuLrE= @@ -8,16 +9,24 @@ github.com/ElrondNetwork/protobuf v1.3.2 h1:qoCSYiO+8GtXBEZWEjw0WPcZfM3g7QuuJrwp github.com/ElrondNetwork/protobuf v1.3.2/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd h1:qdGvebPBDuYDPGi1WCPjy1tGyMpmDK8IEapSsszn7HE= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723 h1:ZA/jbKoGcVAnER6pCHPEkGdZOV7U1oLUedErBHCUMs0= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -25,6 +34,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ= github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= @@ -35,17 +45,26 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89 h1:12K8AlpT0/6QUXSfV0yi4Q0jkbq8NDtIKFtF61AoqV0= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -57,6 +76,7 @@ github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada h1:WokF3GuxBeL+n4L github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -69,7 +89,9 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -77,10 +99,13 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563 h1:NIou6eNFigscvKJmsbyez16S2cIS6idossORlFtSt2E= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -89,9 +114,12 @@ google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/l google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 105827d135b184b0b95d474dc9de08229bd5e110 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Fri, 23 Jul 2021 14:28:24 +0300 Subject: [PATCH 02/32] remove proto folders and move proto files one level up - for schema import --- data/batch/batch.go | 2 +- data/batch/{proto => }/batch.proto | 0 data/block/block.go | 2 +- data/block/{proto => }/block.proto | 0 data/block/blockV2.go | 2 +- data/block/{proto => }/blockV2.proto | 0 data/block/metaBlock.go | 2 +- data/block/{proto => }/metaBlock.proto | 0 data/metrics/metrics.go | 2 +- data/metrics/{proto => }/metrics.proto | 0 data/receipt/receipt.go | 2 +- data/receipt/{proto => }/receipt.proto | 0 data/rewardTx/rewardTx.go | 2 +- data/rewardTx/{proto => }/rewardTx.proto | 0 data/smartContractResult/smartContractResult.go | 2 +- data/smartContractResult/{proto => }/smartContractResult.proto | 0 data/transaction/log.go | 2 +- data/transaction/{proto => }/log.proto | 0 data/transaction/transaction.go | 2 +- data/transaction/{proto => }/transaction.proto | 0 marshal/testSizeCheckUnmarshal/{proto => }/testStruct.proto | 0 marshal/testSizeCheckUnmarshal/testStructs_test.go | 2 +- 22 files changed, 11 insertions(+), 11 deletions(-) rename data/batch/{proto => }/batch.proto (100%) rename data/block/{proto => }/block.proto (100%) rename data/block/{proto => }/blockV2.proto (100%) rename data/block/{proto => }/metaBlock.proto (100%) rename data/metrics/{proto => }/metrics.proto (100%) rename data/receipt/{proto => }/receipt.proto (100%) rename data/rewardTx/{proto => }/rewardTx.proto (100%) rename data/smartContractResult/{proto => }/smartContractResult.proto (100%) rename data/transaction/{proto => }/log.proto (100%) rename data/transaction/{proto => }/transaction.proto (100%) rename marshal/testSizeCheckUnmarshal/{proto => }/testStruct.proto (100%) diff --git a/data/batch/batch.go b/data/batch/batch.go index 28601c5df..6bcb7d228 100644 --- a/data/batch/batch.go +++ b/data/batch/batch.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. batch.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. batch.proto package batch // New returns a new batch from given buffers diff --git a/data/batch/proto/batch.proto b/data/batch/batch.proto similarity index 100% rename from data/batch/proto/batch.proto rename to data/batch/batch.proto diff --git a/data/block/block.go b/data/block/block.go index c2d98eb44..46cb7c30c 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. block.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. block.proto package block import ( diff --git a/data/block/proto/block.proto b/data/block/block.proto similarity index 100% rename from data/block/proto/block.proto rename to data/block/block.proto diff --git a/data/block/blockV2.go b/data/block/blockV2.go index b3c380a0f..65e0976c5 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. blockV2.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. blockV2.proto package block import ( diff --git a/data/block/proto/blockV2.proto b/data/block/blockV2.proto similarity index 100% rename from data/block/proto/blockV2.proto rename to data/block/blockV2.proto diff --git a/data/block/metaBlock.go b/data/block/metaBlock.go index 370cd5142..dc5d4ec88 100644 --- a/data/block/metaBlock.go +++ b/data/block/metaBlock.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. metaBlock.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. metaBlock.proto package block import ( diff --git a/data/block/proto/metaBlock.proto b/data/block/metaBlock.proto similarity index 100% rename from data/block/proto/metaBlock.proto rename to data/block/metaBlock.proto diff --git a/data/metrics/metrics.go b/data/metrics/metrics.go index 7857a8658..50bd26191 100644 --- a/data/metrics/metrics.go +++ b/data/metrics/metrics.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. metrics.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. metrics.proto package metrics // ListFromMap returns a list of values from the provided map diff --git a/data/metrics/proto/metrics.proto b/data/metrics/metrics.proto similarity index 100% rename from data/metrics/proto/metrics.proto rename to data/metrics/metrics.proto diff --git a/data/receipt/receipt.go b/data/receipt/receipt.go index ed2729cf1..d96bef783 100644 --- a/data/receipt/receipt.go +++ b/data/receipt/receipt.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. receipt.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. receipt.proto package receipt import ( diff --git a/data/receipt/proto/receipt.proto b/data/receipt/receipt.proto similarity index 100% rename from data/receipt/proto/receipt.proto rename to data/receipt/receipt.proto diff --git a/data/rewardTx/rewardTx.go b/data/rewardTx/rewardTx.go index 0dfee0789..024fc4fcf 100644 --- a/data/rewardTx/rewardTx.go +++ b/data/rewardTx/rewardTx.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. rewardTx.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. rewardTx.proto package rewardTx import ( diff --git a/data/rewardTx/proto/rewardTx.proto b/data/rewardTx/rewardTx.proto similarity index 100% rename from data/rewardTx/proto/rewardTx.proto rename to data/rewardTx/rewardTx.proto diff --git a/data/smartContractResult/smartContractResult.go b/data/smartContractResult/smartContractResult.go index 87a6253c0..22ca32668 100644 --- a/data/smartContractResult/smartContractResult.go +++ b/data/smartContractResult/smartContractResult.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. smartContractResult.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. smartContractResult.proto package smartContractResult import ( diff --git a/data/smartContractResult/proto/smartContractResult.proto b/data/smartContractResult/smartContractResult.proto similarity index 100% rename from data/smartContractResult/proto/smartContractResult.proto rename to data/smartContractResult/smartContractResult.proto diff --git a/data/transaction/log.go b/data/transaction/log.go index e58274eb6..2bd9b6d17 100644 --- a/data/transaction/log.go +++ b/data/transaction/log.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. log.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. log.proto package transaction import ( diff --git a/data/transaction/proto/log.proto b/data/transaction/log.proto similarity index 100% rename from data/transaction/proto/log.proto rename to data/transaction/log.proto diff --git a/data/transaction/transaction.go b/data/transaction/transaction.go index eb0801640..951b10cf8 100644 --- a/data/transaction/transaction.go +++ b/data/transaction/transaction.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. transaction.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. transaction.proto package transaction import ( diff --git a/data/transaction/proto/transaction.proto b/data/transaction/transaction.proto similarity index 100% rename from data/transaction/proto/transaction.proto rename to data/transaction/transaction.proto diff --git a/marshal/testSizeCheckUnmarshal/proto/testStruct.proto b/marshal/testSizeCheckUnmarshal/testStruct.proto similarity index 100% rename from marshal/testSizeCheckUnmarshal/proto/testStruct.proto rename to marshal/testSizeCheckUnmarshal/testStruct.proto diff --git a/marshal/testSizeCheckUnmarshal/testStructs_test.go b/marshal/testSizeCheckUnmarshal/testStructs_test.go index efb404cf7..fbe2a92c2 100644 --- a/marshal/testSizeCheckUnmarshal/testStructs_test.go +++ b/marshal/testSizeCheckUnmarshal/testStructs_test.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. testStruct.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. testStruct.proto package testSizeCheckUnmarshal From eaba7da05e19f328cbf5505c1432a4eb96520bd2 Mon Sep 17 00:00:00 2001 From: Sebastian Marian Date: Mon, 26 Jul 2021 17:06:24 +0300 Subject: [PATCH 03/32] * Added scheduled protobuf structure * Added GetAdditionalData method in HeaderHandler interface * Removed unused CreateNewHeader method from ChainHandler interface --- data/block/block.go | 7 +- data/block/blockV2.go | 12 + data/block/metaBlock.go | 6 + data/interface.go | 2 +- data/scheduled/scheduled.go | 2 + data/scheduled/scheduled.pb.go | 452 +++++++++++++++++++++++++++++++++ data/scheduled/scheduled.proto | 16 ++ 7 files changed, 495 insertions(+), 2 deletions(-) create mode 100644 data/scheduled/scheduled.go create mode 100644 data/scheduled/scheduled.pb.go create mode 100644 data/scheduled/scheduled.proto diff --git a/data/block/block.go b/data/block/block.go index 46cb7c30c..f8167b95d 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -77,7 +77,6 @@ func (h *Header) GetValidatorStatsRootHash() []byte { return []byte{} } - // SetPrevRandSeed sets previous random seed func (h *Header) SetPrevRandSeed(pvRandSeed []byte) error { if h == nil { @@ -448,3 +447,9 @@ func (h *Header) SetAdditionalData(_ headerVersionData.HeaderAdditionalData) err func (h *Header) HasScheduledSupport() bool { return false } + +// GetAdditionalData gets the additional version-related data for the header +func (h *Header) GetAdditionalData() headerVersionData.HeaderAdditionalData { + // no extra data for the initial version of shard block header + return nil +} diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 65e0976c5..254c0fa8a 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -509,3 +509,15 @@ func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.Heade } return hv2.SetScheduledRootHash(headerVersionData.GetScheduledRootHash()) } + +// GetAdditionalData gets the additional version related data for the header +func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData { + if hv2 == nil { + return nil + } + + additionalVersionData := &headerVersionData.AdditionalData{ + ScheduledRootHash: hv2.GetScheduledRootHash(), + } + return additionalVersionData +} diff --git a/data/block/metaBlock.go b/data/block/metaBlock.go index dc5d4ec88..27be3b167 100644 --- a/data/block/metaBlock.go +++ b/data/block/metaBlock.go @@ -500,3 +500,9 @@ func (m *MetaBlock) SetAdditionalData(_ headerVersionData.HeaderAdditionalData) // no extra data for the initial version metaBlock header return nil } + +// GetAdditionalData gets the additional version-related data for the header +func (m *MetaBlock) GetAdditionalData() headerVersionData.HeaderAdditionalData { + // no extra data for the initial version of meta block header + return nil +} diff --git a/data/interface.go b/data/interface.go index 712c4339e..9eaaba90d 100644 --- a/data/interface.go +++ b/data/interface.go @@ -32,6 +32,7 @@ type HeaderHandler interface { GetMiniBlockHeadersHashes() [][]byte GetMiniBlockHeaderHandlers() []MiniBlockHeaderHandler HasScheduledSupport() bool + GetAdditionalData() headerVersionData.HeaderAdditionalData SetAccumulatedFees(value *big.Int) error SetDeveloperFees(value *big.Int) error @@ -219,7 +220,6 @@ type ChainHandler interface { GetCurrentBlockHeaderHash() []byte SetCurrentBlockHeaderHash(hash []byte) IsInterfaceNil() bool - CreateNewHeader() HeaderHandler } // TransactionHandler defines the type of executable transaction diff --git a/data/scheduled/scheduled.go b/data/scheduled/scheduled.go new file mode 100644 index 000000000..bd1b53a24 --- /dev/null +++ b/data/scheduled/scheduled.go @@ -0,0 +1,2 @@ +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. scheduled.proto +package scheduled diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go new file mode 100644 index 000000000..06abd7663 --- /dev/null +++ b/data/scheduled/scheduled.pb.go @@ -0,0 +1,452 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: scheduled.proto + +package scheduled + +import ( + fmt "fmt" + smartContractResult "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// ScheduledSCRs holds information about scheduled SCRs per block type +type ScheduledSCRs struct { + BlockType int32 `protobuf:"varint,1,opt,name=BlockType,proto3" json:"BlockType,omitempty"` + TxHandlers []smartContractResult.SmartContractResult `protobuf:"bytes,2,rep,name=TxHandlers,proto3" json:"TxHandlers"` +} + +func (m *ScheduledSCRs) Reset() { *m = ScheduledSCRs{} } +func (*ScheduledSCRs) ProtoMessage() {} +func (*ScheduledSCRs) Descriptor() ([]byte, []int) { + return fileDescriptor_f80076f37bd30c16, []int{0} +} +func (m *ScheduledSCRs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ScheduledSCRs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ScheduledSCRs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ScheduledSCRs.Merge(m, src) +} +func (m *ScheduledSCRs) XXX_Size() int { + return m.Size() +} +func (m *ScheduledSCRs) XXX_DiscardUnknown() { + xxx_messageInfo_ScheduledSCRs.DiscardUnknown(m) +} + +var xxx_messageInfo_ScheduledSCRs proto.InternalMessageInfo + +func (m *ScheduledSCRs) GetBlockType() int32 { + if m != nil { + return m.BlockType + } + return 0 +} + +func (m *ScheduledSCRs) GetTxHandlers() []smartContractResult.SmartContractResult { + if m != nil { + return m.TxHandlers + } + return nil +} + +func init() { + proto.RegisterType((*ScheduledSCRs)(nil), "proto.ScheduledSCRs") +} + +func init() { proto.RegisterFile("scheduled.proto", fileDescriptor_f80076f37bd30c16) } + +var fileDescriptor_f80076f37bd30c16 = []byte{ + // 275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4e, 0xce, 0x48, + 0x4d, 0x29, 0xcd, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x52, + 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0x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 0xc9, 0x31, 0xbe, 0x78, 0x24, 0xc7, 0xf0, 0xe1, 0x91, 0x1c, 0xe3, 0x84, + 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xc5, 0x09, 0x0f, 0xcd, + 0x24, 0x36, 0xb0, 0x8d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xca, 0xa3, 0x63, 0x6f, 0x61, + 0x01, 0x00, 0x00, +} + +func (this *ScheduledSCRs) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ScheduledSCRs) + if !ok { + that2, ok := that.(ScheduledSCRs) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BlockType != that1.BlockType { + return false + } + if len(this.TxHandlers) != len(that1.TxHandlers) { + return false + } + for i := range this.TxHandlers { + if !this.TxHandlers[i].Equal(&that1.TxHandlers[i]) { + return false + } + } + return true +} +func (this *ScheduledSCRs) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&scheduled.ScheduledSCRs{") + s = append(s, "BlockType: "+fmt.Sprintf("%#v", this.BlockType)+",\n") + if this.TxHandlers != nil { + vs := make([]smartContractResult.SmartContractResult, len(this.TxHandlers)) + for i := range vs { + vs[i] = this.TxHandlers[i] + } + s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", vs)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringScheduled(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *ScheduledSCRs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScheduledSCRs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHandlers) > 0 { + for iNdEx := len(m.TxHandlers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxHandlers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScheduled(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.BlockType != 0 { + i = encodeVarintScheduled(dAtA, i, uint64(m.BlockType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintScheduled(dAtA []byte, offset int, v uint64) int { + offset -= sovScheduled(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ScheduledSCRs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockType != 0 { + n += 1 + sovScheduled(uint64(m.BlockType)) + } + if len(m.TxHandlers) > 0 { + for _, e := range m.TxHandlers { + l = e.Size() + n += 1 + l + sovScheduled(uint64(l)) + } + } + return n +} + +func sovScheduled(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozScheduled(x uint64) (n int) { + return sovScheduled(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ScheduledSCRs) String() string { + if this == nil { + return "nil" + } + repeatedStringForTxHandlers := "[]SmartContractResult{" + for _, f := range this.TxHandlers { + repeatedStringForTxHandlers += fmt.Sprintf("%v", f) + "," + } + repeatedStringForTxHandlers += "}" + s := strings.Join([]string{`&ScheduledSCRs{`, + `BlockType:` + fmt.Sprintf("%v", this.BlockType) + `,`, + `TxHandlers:` + repeatedStringForTxHandlers + `,`, + `}`, + }, "") + return s +} +func valueToStringScheduled(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ScheduledSCRs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ScheduledSCRs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockType", wireType) + } + m.BlockType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockType |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHandlers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHandlers = append(m.TxHandlers, smartContractResult.SmartContractResult{}) + if err := m.TxHandlers[len(m.TxHandlers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScheduled(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipScheduled(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowScheduled + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowScheduled + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowScheduled + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthScheduled + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupScheduled + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthScheduled + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthScheduled = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowScheduled = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupScheduled = fmt.Errorf("proto: unexpected end of group") +) diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto new file mode 100644 index 000000000..3eb4bb3f3 --- /dev/null +++ b/data/scheduled/scheduled.proto @@ -0,0 +1,16 @@ + +syntax = "proto3"; + +package proto; + +option go_package = "scheduled"; +option (gogoproto.stable_marshaler_all) = true; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult/smartContractResult.proto"; + +// ScheduledSCRs holds information about scheduled SCRs per block type +message ScheduledSCRs { + int32 BlockType = 1; + repeated SmartContractResult TxHandlers = 2 [(gogoproto.nullable) = false]; +} From d5d42d175b9d7b2364ba86653bdade334935f2a6 Mon Sep 17 00:00:00 2001 From: Sebastian Marian Date: Mon, 9 Aug 2021 09:25:28 +0300 Subject: [PATCH 04/32] * Merged dev in feat/scheduled-sc-execution --- .../smartContractResult.pb.go | 80 +++++++++---------- go.sum | 23 ------ 2 files changed, 40 insertions(+), 63 deletions(-) diff --git a/data/smartContractResult/smartContractResult.pb.go b/data/smartContractResult/smartContractResult.pb.go index e02413719..7d21b11ea 100644 --- a/data/smartContractResult/smartContractResult.pb.go +++ b/data/smartContractResult/smartContractResult.pb.go @@ -195,46 +195,46 @@ func init() { func init() { proto.RegisterFile("smartContractResult.proto", fileDescriptor_edc1605de0d3d805) } var fileDescriptor_edc1605de0d3d805 = []byte{ - // 616 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x6b, 0xb6, 0xae, 0x9d, 0xd7, 0x15, 0xe4, 0x49, 0x60, 0x06, 0xb2, 0x27, 0x84, 0xa6, - 0x1e, 0x68, 0x2a, 0xc1, 0x0d, 0x24, 0xa4, 0xa5, 0xe3, 0xcf, 0x24,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9f, 0x92, 0xda, - 0xfe, 0xca, 0x5f, 0x1e, 0x99, 0xe1, 0x82, 0x79, 0x2f, 0x1e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, - 0x26, 0x31, 0x3a, 0xbd, 0x82, 0x04, 0x00, 0x00, + // 610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0x6b, 0xb6, 0xae, 0x9d, 0xd7, 0x15, 0xe4, 0x49, 0x60, 0x06, 0xb2, 0x27, 0x84, 0xa6, + 0x1e, 0x68, 0x72, 0xe0, 0x82, 0x40, 0x42, 0x5a, 0x3b, 0x60, 0x93, 0xd8, 0x98, 0xdc, 0x89, 0xc3, + 0x6e, 0x6e, 0x62, 0xb2, 0x88, 0x24, 0xae, 0x1c, 0xb7, 0xb0, 0x0b, 0xe2, 0x23, 0xf0, 0x31, 0x10, + 0x9f, 0x84, 0xe3, 0x8e, 0xbb, 0x10, 0x58, 0x76, 0x41, 0x39, 0xed, 0xcc, 0x09, 0xc5, 0xe9, 0xba, + 0x64, 0x70, 0x41, 0xe2, 0xd4, 0xbe, 0xff, 0xff, 0xf7, 0xfe, 0xaf, 0x7e, 0xb5, 0x0c, 0x6f, 0xc7, + 0x21, 0x57, 0xba, 0x2f, 0x23, 0xad, 0xb8, 0xa3, 0x99, 0x88, 0xc7, 0x81, 0xb6, 0x46, 0x4a, 0x6a, + 0x89, 0xea, 0xe6, 0x63, 0xb5, 0xeb, 0xf9, 0xfa, 0x70, 0x3c, 0xb4, 0x1c, 0x19, 0xda, 0x9e, 0xf4, + 0xa4, 0x6d, 0xe4, 0xe1, 0xf8, 0x8d, 0xa9, 0x4c, 0x61, 0xbe, 0x15, 0x5d, 0xf7, 0xbe, 0x35, 0xe0, + 0xca, 0xe0, 0xcf, 0x4c, 0x44, 0x61, 0x7d, 0x57, 0x46, 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, 0x2f, 0x17, 0x3f, 0x30, 0x57, 0x18, 0xdf, 0x30, 0x19, + 0x77, 0xb3, 0x84, 0x62, 0x59, 0x71, 0x4a, 0x21, 0x57, 0x7a, 0x7a, 0x3b, 0xc7, 0xa7, 0xa4, 0x76, + 0x72, 0x4a, 0x6a, 0xe7, 0xa7, 0x04, 0x7c, 0x4c, 0x09, 0xf8, 0x9c, 0x12, 0xf0, 0x35, 0x25, 0xe0, + 0x38, 0x25, 0xe0, 0x24, 0x25, 0xe0, 0x47, 0x4a, 0xc0, 0xcf, 0x94, 0xd4, 0xce, 0x53, 0x02, 0x3e, + 0x9d, 0x91, 0xda, 0xf1, 0x19, 0xa9, 0x9d, 0x9c, 0x91, 0xda, 0xc1, 0xca, 0x5f, 0x9e, 0x9a, 0xe1, + 0x82, 0x79, 0x35, 0x1e, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x81, 0x4c, 0xd3, 0x88, 0x04, + 0x00, 0x00, } func (this *SmartContractResult) Equal(that interface{}) bool { diff --git a/go.sum b/go.sum index d455da9f7..e89e5e79d 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,21 @@ github.com/ElrondNetwork/protobuf v1.3.2 h1:qoCSYiO+8GtXBEZWEjw0WPcZfM3g7QuuJrwpN+y6Mvg= github.com/ElrondNetwork/protobuf v1.3.2/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd h1:qdGvebPBDuYDPGi1WCPjy1tGyMpmDK8IEapSsszn7HE= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723 h1:ZA/jbKoGcVAnER6pCHPEkGdZOV7U1oLUedErBHCUMs0= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ= github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -31,24 +23,16 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89 h1:12K8AlpT0/6QUXSfV0yi4Q0jkbq8NDtIKFtF61AoqV0= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -66,9 +50,7 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -76,13 +58,10 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563 h1:NIou6eNFigscvKJmsbyez16S2cIS6idossORlFtSt2E= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -91,9 +70,7 @@ google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/l google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= From fbd5380ee433883d6ceb8a6c5dd5a08eacf5cf84 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 12:31:18 +0300 Subject: [PATCH 05/32] add trigger proto schema and generated code --- data/block/blockV2.go | 2 + data/block/trigger.pb.go | 1326 ++++++++++++++++++++++++++++++++++++++ data/block/trigger.proto | 34 + 3 files changed, 1362 insertions(+) create mode 100644 data/block/trigger.pb.go create mode 100644 data/block/trigger.proto diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 254c0fa8a..20ea7ba78 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -1,4 +1,6 @@ //go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. blockV2.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. trigger.proto + package block import ( diff --git a/data/block/trigger.pb.go b/data/block/trigger.pb.go new file mode 100644 index 000000000..950bfabcb --- /dev/null +++ b/data/block/trigger.pb.go @@ -0,0 +1,1326 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: trigger.proto + +package block + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type TriggerRegistry struct { + IsEpochStart bool `protobuf:"varint,1,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` + NewEpochHeaderReceived bool `protobuf:"varint,2,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` + Epoch uint32 `protobuf:"varint,3,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + MetaEpoch uint32 `protobuf:"varint,4,opt,name=MetaEpoch,proto3" json:"MetaEpoch,omitempty"` + CurrentRoundIndex int64 `protobuf:"varint,5,opt,name=CurrentRoundIndex,proto3" json:"CurrentRoundIndex,omitempty"` + EpochStartRound uint64 `protobuf:"varint,6,opt,name=EpochStartRound,proto3" json:"EpochStartRound,omitempty"` + EpochFinalityAttestingRound uint64 `protobuf:"varint,7,opt,name=EpochFinalityAttestingRound,proto3" json:"EpochFinalityAttestingRound,omitempty"` + EpochMetaBlockHash []byte `protobuf:"bytes,8,opt,name=EpochMetaBlockHash,proto3" json:"EpochMetaBlockHash,omitempty"` + EpochStartShardHeader *Header `protobuf:"bytes,9,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` +} + +func (m *TriggerRegistry) Reset() { *m = TriggerRegistry{} } +func (*TriggerRegistry) ProtoMessage() {} +func (*TriggerRegistry) Descriptor() ([]byte, []int) { + return fileDescriptor_8c31e6d8b4368946, []int{0} +} +func (m *TriggerRegistry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TriggerRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TriggerRegistry) XXX_Merge(src proto.Message) { + xxx_messageInfo_TriggerRegistry.Merge(m, src) +} +func (m *TriggerRegistry) XXX_Size() int { + return m.Size() +} +func (m *TriggerRegistry) XXX_DiscardUnknown() { + xxx_messageInfo_TriggerRegistry.DiscardUnknown(m) +} + +var xxx_messageInfo_TriggerRegistry proto.InternalMessageInfo + +func (m *TriggerRegistry) GetIsEpochStart() bool { + if m != nil { + return m.IsEpochStart + } + return false +} + +func (m *TriggerRegistry) GetNewEpochHeaderReceived() bool { + if m != nil { + return m.NewEpochHeaderReceived + } + return false +} + +func (m *TriggerRegistry) GetEpoch() uint32 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *TriggerRegistry) GetMetaEpoch() uint32 { + if m != nil { + return m.MetaEpoch + } + return 0 +} + +func (m *TriggerRegistry) GetCurrentRoundIndex() int64 { + if m != nil { + return m.CurrentRoundIndex + } + return 0 +} + +func (m *TriggerRegistry) GetEpochStartRound() uint64 { + if m != nil { + return m.EpochStartRound + } + return 0 +} + +func (m *TriggerRegistry) GetEpochFinalityAttestingRound() uint64 { + if m != nil { + return m.EpochFinalityAttestingRound + } + return 0 +} + +func (m *TriggerRegistry) GetEpochMetaBlockHash() []byte { + if m != nil { + return m.EpochMetaBlockHash + } + return nil +} + +func (m *TriggerRegistry) GetEpochStartShardHeader() *Header { + if m != nil { + return m.EpochStartShardHeader + } + return nil +} + +type TriggerRegistryV2 struct { + IsEpochStart bool `protobuf:"varint,1,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` + NewEpochHeaderReceived bool `protobuf:"varint,2,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` + Epoch uint32 `protobuf:"varint,3,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + MetaEpoch uint32 `protobuf:"varint,4,opt,name=MetaEpoch,proto3" json:"MetaEpoch,omitempty"` + CurrentRoundIndex int64 `protobuf:"varint,5,opt,name=CurrentRoundIndex,proto3" json:"CurrentRoundIndex,omitempty"` + EpochStartRound uint64 `protobuf:"varint,6,opt,name=EpochStartRound,proto3" json:"EpochStartRound,omitempty"` + EpochFinalityAttestingRound uint64 `protobuf:"varint,7,opt,name=EpochFinalityAttestingRound,proto3" json:"EpochFinalityAttestingRound,omitempty"` + EpochMetaBlockHash []byte `protobuf:"bytes,8,opt,name=EpochMetaBlockHash,proto3" json:"EpochMetaBlockHash,omitempty"` + EpochStartShardHeader *HeaderV2 `protobuf:"bytes,9,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` +} + +func (m *TriggerRegistryV2) Reset() { *m = TriggerRegistryV2{} } +func (*TriggerRegistryV2) ProtoMessage() {} +func (*TriggerRegistryV2) Descriptor() ([]byte, []int) { + return fileDescriptor_8c31e6d8b4368946, []int{1} +} +func (m *TriggerRegistryV2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TriggerRegistryV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TriggerRegistryV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_TriggerRegistryV2.Merge(m, src) +} +func (m *TriggerRegistryV2) XXX_Size() int { + return m.Size() +} +func (m *TriggerRegistryV2) XXX_DiscardUnknown() { + xxx_messageInfo_TriggerRegistryV2.DiscardUnknown(m) +} + +var xxx_messageInfo_TriggerRegistryV2 proto.InternalMessageInfo + +func (m *TriggerRegistryV2) GetIsEpochStart() bool { + if m != nil { + return m.IsEpochStart + } + return false +} + +func (m *TriggerRegistryV2) GetNewEpochHeaderReceived() bool { + if m != nil { + return m.NewEpochHeaderReceived + } + return false +} + +func (m *TriggerRegistryV2) GetEpoch() uint32 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *TriggerRegistryV2) GetMetaEpoch() uint32 { + if m != nil { + return m.MetaEpoch + } + return 0 +} + +func (m *TriggerRegistryV2) GetCurrentRoundIndex() int64 { + if m != nil { + return m.CurrentRoundIndex + } + return 0 +} + +func (m *TriggerRegistryV2) GetEpochStartRound() uint64 { + if m != nil { + return m.EpochStartRound + } + return 0 +} + +func (m *TriggerRegistryV2) GetEpochFinalityAttestingRound() uint64 { + if m != nil { + return m.EpochFinalityAttestingRound + } + return 0 +} + +func (m *TriggerRegistryV2) GetEpochMetaBlockHash() []byte { + if m != nil { + return m.EpochMetaBlockHash + } + return nil +} + +func (m *TriggerRegistryV2) GetEpochStartShardHeader() *HeaderV2 { + if m != nil { + return m.EpochStartShardHeader + } + return nil +} + +func init() { + proto.RegisterType((*TriggerRegistry)(nil), "proto.TriggerRegistry") + proto.RegisterType((*TriggerRegistryV2)(nil), "proto.TriggerRegistryV2") +} + +func init() { proto.RegisterFile("trigger.proto", fileDescriptor_8c31e6d8b4368946) } + +var fileDescriptor_8c31e6d8b4368946 = []byte{ + // 410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x93, 0xbf, 0x8e, 0xd3, 0x40, + 0x10, 0xc6, 0xbd, 0xf8, 0x7c, 0xdc, 0xed, 0x9d, 0x15, 0xdd, 0x0a, 0x90, 0x15, 0xd0, 0xca, 0x4a, + 0xe5, 0x02, 0x1c, 0xc9, 0x48, 0xb4, 0x40, 0xa2, 0xa0, 0xa4, 0x80, 0xc2, 0x41, 0x29, 0xe8, 0xfc, + 0x67, 0xb1, 0x2d, 0x82, 0x37, 0x5a, 0xaf, 0x81, 0x74, 0x3c, 0x02, 0x8f, 0x41, 0x49, 0xc1, 0x43, + 0x50, 0xa6, 0x4c, 0x49, 0x36, 0x0d, 0x65, 0x1e, 0x01, 0x65, 0x36, 0x52, 0x94, 0x90, 0xa4, 0xa3, + 0xbb, 0xca, 0xfe, 0x7e, 0xdf, 0x8c, 0x66, 0x34, 0x9f, 0x16, 0xdb, 0x52, 0x14, 0x59, 0xc6, 0x84, + 0x3f, 0x11, 0x5c, 0x72, 0x62, 0xc1, 0xa7, 0xf9, 0x24, 0x2b, 0x64, 0x5e, 0xc7, 0x7e, 0xc2, 0x3f, + 0xb6, 0x33, 0x9e, 0xf1, 0x36, 0xe0, 0xb8, 0x7e, 0x0f, 0x0a, 0x04, 0xfc, 0xe9, 0xae, 0xe6, 0x55, + 0x3c, 0xe6, 0xc9, 0x87, 0x8d, 0xb0, 0x41, 0x8c, 0x02, 0x2d, 0x5b, 0x3f, 0x4c, 0xdc, 0x78, 0xab, + 0x67, 0x84, 0x2c, 0x2b, 0x2a, 0x29, 0xa6, 0xa4, 0x85, 0xaf, 0x07, 0x55, 0x6f, 0xc2, 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, 0x46, 0xc1, 0x91, 0xd8, 0x3a, 0xcf, 0x67, 0x0b, 0x6a, 0xcc, 0x17, 0xd4, 0x58, + 0x2d, 0x28, 0xfa, 0xaa, 0x28, 0xfa, 0xae, 0x28, 0xfa, 0xa5, 0x28, 0x9a, 0x29, 0x8a, 0xe6, 0x8a, + 0xa2, 0xdf, 0x8a, 0xa2, 0x3f, 0x8a, 0x1a, 0x2b, 0x45, 0xd1, 0xb7, 0x25, 0x35, 0x66, 0x4b, 0x6a, + 0xcc, 0x97, 0xd4, 0x78, 0x67, 0xc1, 0x93, 0x8d, 0xcf, 0x61, 0xce, 0xd3, 0xbf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xe5, 0x72, 0x75, 0xcc, 0x14, 0x04, 0x00, 0x00, +} + +func (this *TriggerRegistry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TriggerRegistry) + if !ok { + that2, ok := that.(TriggerRegistry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IsEpochStart != that1.IsEpochStart { + return false + } + if this.NewEpochHeaderReceived != that1.NewEpochHeaderReceived { + return false + } + if this.Epoch != that1.Epoch { + return false + } + if this.MetaEpoch != that1.MetaEpoch { + return false + } + if this.CurrentRoundIndex != that1.CurrentRoundIndex { + return false + } + if this.EpochStartRound != that1.EpochStartRound { + return false + } + if this.EpochFinalityAttestingRound != that1.EpochFinalityAttestingRound { + return false + } + if !bytes.Equal(this.EpochMetaBlockHash, that1.EpochMetaBlockHash) { + return false + } + if !this.EpochStartShardHeader.Equal(that1.EpochStartShardHeader) { + return false + } + return true +} +func (this *TriggerRegistryV2) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TriggerRegistryV2) + if !ok { + that2, ok := that.(TriggerRegistryV2) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IsEpochStart != that1.IsEpochStart { + return false + } + if this.NewEpochHeaderReceived != that1.NewEpochHeaderReceived { + return false + } + if this.Epoch != that1.Epoch { + return false + } + if this.MetaEpoch != that1.MetaEpoch { + return false + } + if this.CurrentRoundIndex != that1.CurrentRoundIndex { + return false + } + if this.EpochStartRound != that1.EpochStartRound { + return false + } + if this.EpochFinalityAttestingRound != that1.EpochFinalityAttestingRound { + return false + } + if !bytes.Equal(this.EpochMetaBlockHash, that1.EpochMetaBlockHash) { + return false + } + if !this.EpochStartShardHeader.Equal(that1.EpochStartShardHeader) { + return false + } + return true +} +func (this *TriggerRegistry) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 13) + s = append(s, "&block.TriggerRegistry{") + s = append(s, "IsEpochStart: "+fmt.Sprintf("%#v", this.IsEpochStart)+",\n") + s = append(s, "NewEpochHeaderReceived: "+fmt.Sprintf("%#v", this.NewEpochHeaderReceived)+",\n") + s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") + s = append(s, "MetaEpoch: "+fmt.Sprintf("%#v", this.MetaEpoch)+",\n") + s = append(s, "CurrentRoundIndex: "+fmt.Sprintf("%#v", this.CurrentRoundIndex)+",\n") + s = append(s, "EpochStartRound: "+fmt.Sprintf("%#v", this.EpochStartRound)+",\n") + s = append(s, "EpochFinalityAttestingRound: "+fmt.Sprintf("%#v", this.EpochFinalityAttestingRound)+",\n") + s = append(s, "EpochMetaBlockHash: "+fmt.Sprintf("%#v", this.EpochMetaBlockHash)+",\n") + if this.EpochStartShardHeader != nil { + s = append(s, "EpochStartShardHeader: "+fmt.Sprintf("%#v", this.EpochStartShardHeader)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *TriggerRegistryV2) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 13) + s = append(s, "&block.TriggerRegistryV2{") + s = append(s, "IsEpochStart: "+fmt.Sprintf("%#v", this.IsEpochStart)+",\n") + s = append(s, "NewEpochHeaderReceived: "+fmt.Sprintf("%#v", this.NewEpochHeaderReceived)+",\n") + s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") + s = append(s, "MetaEpoch: "+fmt.Sprintf("%#v", this.MetaEpoch)+",\n") + s = append(s, "CurrentRoundIndex: "+fmt.Sprintf("%#v", this.CurrentRoundIndex)+",\n") + s = append(s, "EpochStartRound: "+fmt.Sprintf("%#v", this.EpochStartRound)+",\n") + s = append(s, "EpochFinalityAttestingRound: "+fmt.Sprintf("%#v", this.EpochFinalityAttestingRound)+",\n") + s = append(s, "EpochMetaBlockHash: "+fmt.Sprintf("%#v", this.EpochMetaBlockHash)+",\n") + if this.EpochStartShardHeader != nil { + s = append(s, "EpochStartShardHeader: "+fmt.Sprintf("%#v", this.EpochStartShardHeader)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringTrigger(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *TriggerRegistry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TriggerRegistry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TriggerRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochStartShardHeader != nil { + { + size, err := m.EpochStartShardHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrigger(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if len(m.EpochMetaBlockHash) > 0 { + i -= len(m.EpochMetaBlockHash) + copy(dAtA[i:], m.EpochMetaBlockHash) + i = encodeVarintTrigger(dAtA, i, uint64(len(m.EpochMetaBlockHash))) + i-- + dAtA[i] = 0x42 + } + if m.EpochFinalityAttestingRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.EpochFinalityAttestingRound)) + i-- + dAtA[i] = 0x38 + } + if m.EpochStartRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.EpochStartRound)) + i-- + dAtA[i] = 0x30 + } + if m.CurrentRoundIndex != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.CurrentRoundIndex)) + i-- + dAtA[i] = 0x28 + } + if m.MetaEpoch != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.MetaEpoch)) + i-- + dAtA[i] = 0x20 + } + if m.Epoch != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x18 + } + if m.NewEpochHeaderReceived { + i-- + if m.NewEpochHeaderReceived { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.IsEpochStart { + i-- + if m.IsEpochStart { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TriggerRegistryV2) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TriggerRegistryV2) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochStartShardHeader != nil { + { + size, err := m.EpochStartShardHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrigger(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if len(m.EpochMetaBlockHash) > 0 { + i -= len(m.EpochMetaBlockHash) + copy(dAtA[i:], m.EpochMetaBlockHash) + i = encodeVarintTrigger(dAtA, i, uint64(len(m.EpochMetaBlockHash))) + i-- + dAtA[i] = 0x42 + } + if m.EpochFinalityAttestingRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.EpochFinalityAttestingRound)) + i-- + dAtA[i] = 0x38 + } + if m.EpochStartRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.EpochStartRound)) + i-- + dAtA[i] = 0x30 + } + if m.CurrentRoundIndex != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.CurrentRoundIndex)) + i-- + dAtA[i] = 0x28 + } + if m.MetaEpoch != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.MetaEpoch)) + i-- + dAtA[i] = 0x20 + } + if m.Epoch != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x18 + } + if m.NewEpochHeaderReceived { + i-- + if m.NewEpochHeaderReceived { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.IsEpochStart { + i-- + if m.IsEpochStart { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTrigger(dAtA []byte, offset int, v uint64) int { + offset -= sovTrigger(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TriggerRegistry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsEpochStart { + n += 2 + } + if m.NewEpochHeaderReceived { + n += 2 + } + if m.Epoch != 0 { + n += 1 + sovTrigger(uint64(m.Epoch)) + } + if m.MetaEpoch != 0 { + n += 1 + sovTrigger(uint64(m.MetaEpoch)) + } + if m.CurrentRoundIndex != 0 { + n += 1 + sovTrigger(uint64(m.CurrentRoundIndex)) + } + if m.EpochStartRound != 0 { + n += 1 + sovTrigger(uint64(m.EpochStartRound)) + } + if m.EpochFinalityAttestingRound != 0 { + n += 1 + sovTrigger(uint64(m.EpochFinalityAttestingRound)) + } + l = len(m.EpochMetaBlockHash) + if l > 0 { + n += 1 + l + sovTrigger(uint64(l)) + } + if m.EpochStartShardHeader != nil { + l = m.EpochStartShardHeader.Size() + n += 1 + l + sovTrigger(uint64(l)) + } + return n +} + +func (m *TriggerRegistryV2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsEpochStart { + n += 2 + } + if m.NewEpochHeaderReceived { + n += 2 + } + if m.Epoch != 0 { + n += 1 + sovTrigger(uint64(m.Epoch)) + } + if m.MetaEpoch != 0 { + n += 1 + sovTrigger(uint64(m.MetaEpoch)) + } + if m.CurrentRoundIndex != 0 { + n += 1 + sovTrigger(uint64(m.CurrentRoundIndex)) + } + if m.EpochStartRound != 0 { + n += 1 + sovTrigger(uint64(m.EpochStartRound)) + } + if m.EpochFinalityAttestingRound != 0 { + n += 1 + sovTrigger(uint64(m.EpochFinalityAttestingRound)) + } + l = len(m.EpochMetaBlockHash) + if l > 0 { + n += 1 + l + sovTrigger(uint64(l)) + } + if m.EpochStartShardHeader != nil { + l = m.EpochStartShardHeader.Size() + n += 1 + l + sovTrigger(uint64(l)) + } + return n +} + +func sovTrigger(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTrigger(x uint64) (n int) { + return sovTrigger(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *TriggerRegistry) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TriggerRegistry{`, + `IsEpochStart:` + fmt.Sprintf("%v", this.IsEpochStart) + `,`, + `NewEpochHeaderReceived:` + fmt.Sprintf("%v", this.NewEpochHeaderReceived) + `,`, + `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, + `MetaEpoch:` + fmt.Sprintf("%v", this.MetaEpoch) + `,`, + `CurrentRoundIndex:` + fmt.Sprintf("%v", this.CurrentRoundIndex) + `,`, + `EpochStartRound:` + fmt.Sprintf("%v", this.EpochStartRound) + `,`, + `EpochFinalityAttestingRound:` + fmt.Sprintf("%v", this.EpochFinalityAttestingRound) + `,`, + `EpochMetaBlockHash:` + fmt.Sprintf("%v", this.EpochMetaBlockHash) + `,`, + `EpochStartShardHeader:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartShardHeader), "Header", "Header", 1) + `,`, + `}`, + }, "") + return s +} +func (this *TriggerRegistryV2) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TriggerRegistryV2{`, + `IsEpochStart:` + fmt.Sprintf("%v", this.IsEpochStart) + `,`, + `NewEpochHeaderReceived:` + fmt.Sprintf("%v", this.NewEpochHeaderReceived) + `,`, + `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, + `MetaEpoch:` + fmt.Sprintf("%v", this.MetaEpoch) + `,`, + `CurrentRoundIndex:` + fmt.Sprintf("%v", this.CurrentRoundIndex) + `,`, + `EpochStartRound:` + fmt.Sprintf("%v", this.EpochStartRound) + `,`, + `EpochFinalityAttestingRound:` + fmt.Sprintf("%v", this.EpochFinalityAttestingRound) + `,`, + `EpochMetaBlockHash:` + fmt.Sprintf("%v", this.EpochMetaBlockHash) + `,`, + `EpochStartShardHeader:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartShardHeader), "HeaderV2", "HeaderV2", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringTrigger(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *TriggerRegistry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TriggerRegistry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TriggerRegistry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsEpochStart", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsEpochStart = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewEpochHeaderReceived", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NewEpochHeaderReceived = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaEpoch", wireType) + } + m.MetaEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MetaEpoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRoundIndex", wireType) + } + m.CurrentRoundIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentRoundIndex |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartRound", wireType) + } + m.EpochStartRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochStartRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochFinalityAttestingRound", wireType) + } + m.EpochFinalityAttestingRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochFinalityAttestingRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochMetaBlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochMetaBlockHash = append(m.EpochMetaBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.EpochMetaBlockHash == nil { + m.EpochMetaBlockHash = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartShardHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EpochStartShardHeader == nil { + m.EpochStartShardHeader = &Header{} + } + if err := m.EpochStartShardHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTrigger(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TriggerRegistryV2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TriggerRegistryV2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsEpochStart", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsEpochStart = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewEpochHeaderReceived", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NewEpochHeaderReceived = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaEpoch", wireType) + } + m.MetaEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MetaEpoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRoundIndex", wireType) + } + m.CurrentRoundIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentRoundIndex |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartRound", wireType) + } + m.EpochStartRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochStartRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochFinalityAttestingRound", wireType) + } + m.EpochFinalityAttestingRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochFinalityAttestingRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochMetaBlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochMetaBlockHash = append(m.EpochMetaBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.EpochMetaBlockHash == nil { + m.EpochMetaBlockHash = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartShardHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EpochStartShardHeader == nil { + m.EpochStartShardHeader = &HeaderV2{} + } + if err := m.EpochStartShardHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTrigger(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTrigger(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTrigger + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTrigger + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTrigger + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTrigger + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTrigger + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTrigger + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTrigger = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTrigger = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTrigger = fmt.Errorf("proto: unexpected end of group") +) diff --git a/data/block/trigger.proto b/data/block/trigger.proto new file mode 100644 index 000000000..850fa88c7 --- /dev/null +++ b/data/block/trigger.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package proto; + +option go_package = "block"; +option (gogoproto.stable_marshaler_all) = true; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "block.proto"; +import "blockV2.proto"; + +message TriggerRegistry { + bool IsEpochStart = 1; + bool NewEpochHeaderReceived = 2; + uint32 Epoch = 3; + uint32 MetaEpoch = 4; + int64 CurrentRoundIndex = 5; + uint64 EpochStartRound = 6; + uint64 EpochFinalityAttestingRound = 7; + bytes EpochMetaBlockHash = 8; + Header EpochStartShardHeader = 9; +} + +message TriggerRegistryV2 { + bool IsEpochStart = 1; + bool NewEpochHeaderReceived = 2; + uint32 Epoch = 3; + uint32 MetaEpoch = 4; + int64 CurrentRoundIndex = 5; + uint64 EpochStartRound = 6; + uint64 EpochFinalityAttestingRound = 7; + bytes EpochMetaBlockHash = 8; + HeaderV2 EpochStartShardHeader = 9; +} From 775e928b3d3d409bbe396a7582278007fd8ec3f4 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 12:59:56 +0300 Subject: [PATCH 06/32] add trigger registry handler --- data/block/blockV2.go | 2 -- data/block/trigger.go | 14 ++++++++++++++ data/interface.go | 12 ++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 data/block/trigger.go diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 20ea7ba78..254c0fa8a 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -1,6 +1,4 @@ //go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. blockV2.proto -//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. trigger.proto - package block import ( diff --git a/data/block/trigger.go b/data/block/trigger.go new file mode 100644 index 000000000..9dc4681eb --- /dev/null +++ b/data/block/trigger.go @@ -0,0 +1,14 @@ +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. trigger.proto +package block + +import "github.com/ElrondNetwork/elrond-go-core/data" + +// GetEpochStartHeaderHandler returns the epoch start headerHandler +func (tr *TriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler { + return tr.GetEpochStartShardHeader() +} + +// GetEpochStartHeaderHandler returns the epoch start headerHandler +func (trV2 *TriggerRegistryV2) GetEpochStartHeaderHandler() data.HeaderHandler { + return trV2.GetEpochStartShardHeader() +} diff --git a/data/interface.go b/data/interface.go index 805885dfb..0aa51a4b5 100644 --- a/data/interface.go +++ b/data/interface.go @@ -6,6 +6,18 @@ import ( "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" ) +type TriggerRegistryHandler interface { + GetIsEpochStart() bool + GetNewEpochHeaderReceived() bool + GetEpoch() uint32 + GetMetaEpoch() uint32 + GetCurrentRoundIndex() int64 + GetEpochStartRound() uint64 + GetEpochFinalityAttestingRound() uint64 + GetEpochMetaBlockHash() []byte + GetHeaderHandler() HeaderHandler +} + // HeaderHandler defines getters and setters for header data holder type HeaderHandler interface { GetShardID() uint32 From 54593a32a84f6ce24eacd0a00b1a6ee4e78ab9be Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 13:06:43 +0300 Subject: [PATCH 07/32] fix trigger registry handler --- data/interface.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/interface.go b/data/interface.go index 0aa51a4b5..e22e7ef4a 100644 --- a/data/interface.go +++ b/data/interface.go @@ -15,7 +15,7 @@ type TriggerRegistryHandler interface { GetEpochStartRound() uint64 GetEpochFinalityAttestingRound() uint64 GetEpochMetaBlockHash() []byte - GetHeaderHandler() HeaderHandler + GetEpochStartHeaderHandler() HeaderHandler } // HeaderHandler defines getters and setters for header data holder From 0f4b9ca7c2e47549b8a6ec02bda180158b3aa2a2 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 14:37:22 +0300 Subject: [PATCH 08/32] add setter methods for the versioned trigger registry handler --- data/block/trigger.go | 179 ++++++++++++++++++++++++++++++++++++++++++ data/interface.go | 10 +++ 2 files changed, 189 insertions(+) diff --git a/data/block/trigger.go b/data/block/trigger.go index 9dc4681eb..b352b0b79 100644 --- a/data/block/trigger.go +++ b/data/block/trigger.go @@ -5,10 +5,189 @@ import "github.com/ElrondNetwork/elrond-go-core/data" // GetEpochStartHeaderHandler returns the epoch start headerHandler func (tr *TriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler { + if tr == nil { + return nil + } return tr.GetEpochStartShardHeader() } +// SetIsEpochStart sets the isEpochStart flag +func (tr *TriggerRegistry) SetIsEpochStart(isEpochStart bool) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + + tr.IsEpochStart = isEpochStart + return nil +} + +// SetNewEpochHeaderReceived sets the newEpochHeaderReceived flag +func (tr *TriggerRegistry) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.NewEpochHeaderReceived = newEpochHeaderReceived + return nil +} + +// SetEpoch sets the epoch +func (tr *TriggerRegistry) SetEpoch(epoch uint32) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.Epoch = epoch + return nil +} + +// SetMetaEpoch Sets the metaChain epoch +func (tr *TriggerRegistry) SetMetaEpoch(metaEpoch uint32) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.MetaEpoch = metaEpoch + return nil +} + +// SetCurrentRoundIndex sets the current round index +func (tr *TriggerRegistry) SetCurrentRoundIndex(roundIndex int64) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.CurrentRoundIndex = roundIndex + return nil +} + +// SetEpochStartRound sets the epoch start round +func (tr *TriggerRegistry) SetEpochStartRound(startRound uint64) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.EpochStartRound = startRound + return nil +} + +// SetEpochFinalityAttestingRound sets the epoch finality attesting round +func (tr *TriggerRegistry) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.EpochFinalityAttestingRound = finalityAttestingRound + return nil +} + +// SetEpochMetaBlockHash sets the epoch metaChain block hash +func (tr *TriggerRegistry) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + tr.EpochMetaBlockHash = epochMetaBlockHash + return nil +} + +// SetEpochStartHeaderHandler sets the epoch start header +func (tr *TriggerRegistry) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { + if tr == nil { + return data.ErrNilPointerReceiver + } + + var ok bool + tr.EpochStartShardHeader, ok = epochStartHeaderHandler.(*Header) + if !ok { + return data.ErrInvalidTypeAssertion + } + return nil +} + // GetEpochStartHeaderHandler returns the epoch start headerHandler func (trV2 *TriggerRegistryV2) GetEpochStartHeaderHandler() data.HeaderHandler { + if trV2 == nil { + return nil + } return trV2.GetEpochStartShardHeader() } + +// SetIsEpochStart sets the isEpochStart flag +func (trV2 *TriggerRegistryV2) SetIsEpochStart(isEpochStart bool) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.IsEpochStart = isEpochStart + return nil +} + +// SetNewEpochHeaderReceived sets the neeEpochHeaderReceived flag +func (trV2 *TriggerRegistryV2) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.NewEpochHeaderReceived = newEpochHeaderReceived + return nil +} + +// SetEpoch sets the epoch +func (trV2 *TriggerRegistryV2) SetEpoch(epoch uint32) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.Epoch = epoch + return nil +} + +// SetMetaEpoch sets the metaChain epoch +func (trV2 *TriggerRegistryV2) SetMetaEpoch(metaEpoch uint32) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.MetaEpoch = metaEpoch + return nil +} + +// SetCurrentRoundIndex sets the current round index +func (trV2 *TriggerRegistryV2) SetCurrentRoundIndex(roundIndex int64) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.CurrentRoundIndex = roundIndex + return nil +} + +// SetEpochStartRound sets the epoch start round +func (trV2 *TriggerRegistryV2) SetEpochStartRound(startRound uint64) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.EpochStartRound = startRound + return nil +} + +// SetEpochFinalityAttestingRound sets the epoch finality attesting round +func (trV2 *TriggerRegistryV2) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.EpochFinalityAttestingRound = finalityAttestingRound + return nil +} + +// SetEpochMetaBlockHash sets the epoch metaChain block hash +func (trV2 *TriggerRegistryV2) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + trV2.EpochMetaBlockHash = epochMetaBlockHash + return nil +} + +// SetEpochStartHeaderHandler sets the epoch start header +func (trV2 *TriggerRegistryV2) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { + if trV2 == nil { + return data.ErrNilPointerReceiver + } + + var ok bool + trV2.EpochStartShardHeader, ok = epochStartHeaderHandler.(*HeaderV2) + if !ok { + return data.ErrInvalidTypeAssertion + } + return nil +} diff --git a/data/interface.go b/data/interface.go index e22e7ef4a..2ff9a4027 100644 --- a/data/interface.go +++ b/data/interface.go @@ -16,6 +16,16 @@ type TriggerRegistryHandler interface { GetEpochFinalityAttestingRound() uint64 GetEpochMetaBlockHash() []byte GetEpochStartHeaderHandler() HeaderHandler + + SetIsEpochStart(isEpochStart bool) error + SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error + SetEpoch(epoch uint32) error + SetMetaEpoch(metaEpoch uint32) error + SetCurrentRoundIndex(roundIndex int64) error + SetEpochStartRound(startRound uint64) error + SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error + SetEpochMetaBlockHash(epochMetaBlockHash []byte) error + SetEpochStartHeaderHandler(epochStartHeaderHandler HeaderHandler) error } // HeaderHandler defines getters and setters for header data holder From 2634925963c48d2e410d9ee81558c6ac0d63bd64 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 14:40:42 +0300 Subject: [PATCH 09/32] add missing comment --- data/interface.go | 1 + 1 file changed, 1 insertion(+) diff --git a/data/interface.go b/data/interface.go index 2ff9a4027..d7eb22c9e 100644 --- a/data/interface.go +++ b/data/interface.go @@ -6,6 +6,7 @@ import ( "github.com/ElrondNetwork/elrond-go-core/data/headerVersionData" ) +// TriggerRegistryHandler defines getters and setters for the trigger registry type TriggerRegistryHandler interface { GetIsEpochStart() bool GetNewEpochHeaderReceived() bool From e9d19e7a84c174832b5c840dcbf5ad9ff5610a7a Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 10 Aug 2021 19:05:13 +0300 Subject: [PATCH 10/32] fix alignment --- data/block/trigger.proto | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/data/block/trigger.proto b/data/block/trigger.proto index 850fa88c7..42679f872 100644 --- a/data/block/trigger.proto +++ b/data/block/trigger.proto @@ -10,25 +10,25 @@ import "block.proto"; import "blockV2.proto"; message TriggerRegistry { - bool IsEpochStart = 1; - bool NewEpochHeaderReceived = 2; - uint32 Epoch = 3; - uint32 MetaEpoch = 4; - int64 CurrentRoundIndex = 5; - uint64 EpochStartRound = 6; - uint64 EpochFinalityAttestingRound = 7; - bytes EpochMetaBlockHash = 8; - Header EpochStartShardHeader = 9; + bool IsEpochStart = 1; + bool NewEpochHeaderReceived = 2; + uint32 Epoch = 3; + uint32 MetaEpoch = 4; + int64 CurrentRoundIndex = 5; + uint64 EpochStartRound = 6; + uint64 EpochFinalityAttestingRound = 7; + bytes EpochMetaBlockHash = 8; + Header EpochStartShardHeader = 9; } message TriggerRegistryV2 { - bool IsEpochStart = 1; - bool NewEpochHeaderReceived = 2; - uint32 Epoch = 3; - uint32 MetaEpoch = 4; - int64 CurrentRoundIndex = 5; - uint64 EpochStartRound = 6; - uint64 EpochFinalityAttestingRound = 7; - bytes EpochMetaBlockHash = 8; - HeaderV2 EpochStartShardHeader = 9; + bool IsEpochStart = 1; + bool NewEpochHeaderReceived = 2; + uint32 Epoch = 3; + uint32 MetaEpoch = 4; + int64 CurrentRoundIndex = 5; + uint64 EpochStartRound = 6; + uint64 EpochFinalityAttestingRound = 7; + bytes EpochMetaBlockHash = 8; + HeaderV2 EpochStartShardHeader = 9; } From e5cdc697842e97b18d4219f32b666c0c3962d956 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 11 Aug 2021 10:28:15 +0300 Subject: [PATCH 11/32] change fields order for trigger registry --- data/block/trigger.pb.go | 236 ++++++++++++++++++++------------------- data/block/trigger.proto | 18 +-- 2 files changed, 128 insertions(+), 126 deletions(-) diff --git a/data/block/trigger.pb.go b/data/block/trigger.pb.go index 950bfabcb..d3be854f9 100644 --- a/data/block/trigger.pb.go +++ b/data/block/trigger.pb.go @@ -130,15 +130,15 @@ func (m *TriggerRegistry) GetEpochStartShardHeader() *Header { } type TriggerRegistryV2 struct { - IsEpochStart bool `protobuf:"varint,1,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` - NewEpochHeaderReceived bool `protobuf:"varint,2,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` - Epoch uint32 `protobuf:"varint,3,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - MetaEpoch uint32 `protobuf:"varint,4,opt,name=MetaEpoch,proto3" json:"MetaEpoch,omitempty"` - CurrentRoundIndex int64 `protobuf:"varint,5,opt,name=CurrentRoundIndex,proto3" json:"CurrentRoundIndex,omitempty"` - EpochStartRound uint64 `protobuf:"varint,6,opt,name=EpochStartRound,proto3" json:"EpochStartRound,omitempty"` - EpochFinalityAttestingRound uint64 `protobuf:"varint,7,opt,name=EpochFinalityAttestingRound,proto3" json:"EpochFinalityAttestingRound,omitempty"` - EpochMetaBlockHash []byte `protobuf:"bytes,8,opt,name=EpochMetaBlockHash,proto3" json:"EpochMetaBlockHash,omitempty"` - EpochStartShardHeader *HeaderV2 `protobuf:"bytes,9,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` + EpochStartShardHeader *HeaderV2 `protobuf:"bytes,1,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` + IsEpochStart bool `protobuf:"varint,2,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` + NewEpochHeaderReceived bool `protobuf:"varint,3,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` + Epoch uint32 `protobuf:"varint,4,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + MetaEpoch uint32 `protobuf:"varint,5,opt,name=MetaEpoch,proto3" json:"MetaEpoch,omitempty"` + CurrentRoundIndex int64 `protobuf:"varint,6,opt,name=CurrentRoundIndex,proto3" json:"CurrentRoundIndex,omitempty"` + EpochStartRound uint64 `protobuf:"varint,7,opt,name=EpochStartRound,proto3" json:"EpochStartRound,omitempty"` + EpochFinalityAttestingRound uint64 `protobuf:"varint,8,opt,name=EpochFinalityAttestingRound,proto3" json:"EpochFinalityAttestingRound,omitempty"` + EpochMetaBlockHash []byte `protobuf:"bytes,9,opt,name=EpochMetaBlockHash,proto3" json:"EpochMetaBlockHash,omitempty"` } func (m *TriggerRegistryV2) Reset() { *m = TriggerRegistryV2{} } @@ -169,6 +169,13 @@ func (m *TriggerRegistryV2) XXX_DiscardUnknown() { var xxx_messageInfo_TriggerRegistryV2 proto.InternalMessageInfo +func (m *TriggerRegistryV2) GetEpochStartShardHeader() *HeaderV2 { + if m != nil { + return m.EpochStartShardHeader + } + return nil +} + func (m *TriggerRegistryV2) GetIsEpochStart() bool { if m != nil { return m.IsEpochStart @@ -225,13 +232,6 @@ func (m *TriggerRegistryV2) GetEpochMetaBlockHash() []byte { return nil } -func (m *TriggerRegistryV2) GetEpochStartShardHeader() *HeaderV2 { - if m != nil { - return m.EpochStartShardHeader - } - return nil -} - func init() { proto.RegisterType((*TriggerRegistry)(nil), "proto.TriggerRegistry") proto.RegisterType((*TriggerRegistryV2)(nil), "proto.TriggerRegistryV2") @@ -240,33 +240,35 @@ func init() { func init() { proto.RegisterFile("trigger.proto", fileDescriptor_8c31e6d8b4368946) } var fileDescriptor_8c31e6d8b4368946 = []byte{ - // 410 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x93, 0xbf, 0x8e, 0xd3, 0x40, - 0x10, 0xc6, 0xbd, 0xf8, 0x7c, 0xdc, 0xed, 0x9d, 0x15, 0xdd, 0x0a, 0x90, 0x15, 0xd0, 0xca, 0x4a, - 0xe5, 0x02, 0x1c, 0xc9, 0x48, 0xb4, 0x40, 0xa2, 0xa0, 0xa4, 0x80, 0xc2, 0x41, 0x29, 0xe8, 0xfc, - 0x67, 0xb1, 0x2d, 0x82, 0x37, 0x5a, 0xaf, 0x81, 0x74, 0x3c, 0x02, 0x8f, 0x41, 0x49, 0xc1, 0x43, - 0x50, 0xa6, 0x4c, 0x49, 0x36, 0x0d, 0x65, 0x1e, 0x01, 0x65, 0x36, 0x52, 0x94, 0x90, 0xa4, 0xa3, - 0xbb, 0xca, 0xfe, 0x7e, 0xdf, 0x8c, 0x66, 0x34, 0x9f, 0x16, 0xdb, 0x52, 0x14, 0x59, 0xc6, 0x84, - 0x3f, 0x11, 0x5c, 0x72, 0x62, 0xc1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0xbb, 0xf6, 0xa3, 0x2a, 0x77, - 0x2e, 0x5c, 0xe4, 0x5d, 0x87, 0x07, 0x1c, 0xd2, 0xc5, 0xf7, 0xb7, 0x4b, 0x0c, 0xf3, 0x48, 0xa4, - 0xfa, 0x3c, 0xce, 0xa5, 0x8b, 0xbc, 0xab, 0xc0, 0xd6, 0xa1, 0xf8, 0x9b, 0x9b, 0x1d, 0xae, 0x6d, - 0xfd, 0x34, 0xf1, 0xcd, 0x5e, 0x64, 0xa3, 0xe0, 0x36, 0xb4, 0xff, 0x16, 0x5a, 0xef, 0x74, 0x68, - 0x8d, 0x9d, 0xd0, 0x46, 0xc1, 0x91, 0xd8, 0x3a, 0xcf, 0x67, 0x0b, 0x6a, 0xcc, 0x17, 0xd4, 0x58, - 0x2d, 0x28, 0xfa, 0xaa, 0x28, 0xfa, 0xae, 0x28, 0xfa, 0xa5, 0x28, 0x9a, 0x29, 0x8a, 0xe6, 0x8a, - 0xa2, 0xdf, 0x8a, 0xa2, 0x3f, 0x8a, 0x1a, 0x2b, 0x45, 0xd1, 0xb7, 0x25, 0x35, 0x66, 0x4b, 0x6a, - 0xcc, 0x97, 0xd4, 0x78, 0x67, 0xc1, 0x93, 0x8d, 0xcf, 0x61, 0xce, 0xd3, 0xbf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xe5, 0x72, 0x75, 0xcc, 0x14, 0x04, 0x00, 0x00, + // 437 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0x6e, 0xd4, 0x40, + 0x10, 0xc6, 0x3d, 0xf1, 0xf9, 0x72, 0xb7, 0x89, 0x75, 0xca, 0x0a, 0x90, 0x15, 0xd0, 0xca, 0xba, + 0xca, 0x05, 0x38, 0x92, 0x91, 0x68, 0x81, 0x44, 0x41, 0x49, 0x01, 0x85, 0x83, 0xae, 0xa0, 0xf3, + 0x9f, 0xc5, 0xb6, 0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0x59, 0x1f, + 0x1c, 0xfc, 0x65, 0xd3, 0x3e, 0x12, 0x7c, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x6d, 0x96, + 0x7e, 0x14, 0x04, 0x00, 0x00, } func (this *TriggerRegistry) Equal(that interface{}) bool { @@ -336,6 +338,9 @@ func (this *TriggerRegistryV2) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.EpochStartShardHeader.Equal(that1.EpochStartShardHeader) { + return false + } if this.IsEpochStart != that1.IsEpochStart { return false } @@ -360,9 +365,6 @@ func (this *TriggerRegistryV2) Equal(that interface{}) bool { if !bytes.Equal(this.EpochMetaBlockHash, that1.EpochMetaBlockHash) { return false } - if !this.EpochStartShardHeader.Equal(that1.EpochStartShardHeader) { - return false - } return true } func (this *TriggerRegistry) GoString() string { @@ -391,6 +393,9 @@ func (this *TriggerRegistryV2) GoString() string { } s := make([]string, 0, 13) s = append(s, "&block.TriggerRegistryV2{") + if this.EpochStartShardHeader != nil { + s = append(s, "EpochStartShardHeader: "+fmt.Sprintf("%#v", this.EpochStartShardHeader)+",\n") + } s = append(s, "IsEpochStart: "+fmt.Sprintf("%#v", this.IsEpochStart)+",\n") s = append(s, "NewEpochHeaderReceived: "+fmt.Sprintf("%#v", this.NewEpochHeaderReceived)+",\n") s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") @@ -399,9 +404,6 @@ func (this *TriggerRegistryV2) GoString() string { s = append(s, "EpochStartRound: "+fmt.Sprintf("%#v", this.EpochStartRound)+",\n") s = append(s, "EpochFinalityAttestingRound: "+fmt.Sprintf("%#v", this.EpochFinalityAttestingRound)+",\n") s = append(s, "EpochMetaBlockHash: "+fmt.Sprintf("%#v", this.EpochMetaBlockHash)+",\n") - if this.EpochStartShardHeader != nil { - s = append(s, "EpochStartShardHeader: "+fmt.Sprintf("%#v", this.EpochStartShardHeader)+",\n") - } s = append(s, "}") return strings.Join(s, "") } @@ -520,49 +522,37 @@ func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.EpochStartShardHeader != nil { - { - size, err := m.EpochStartShardHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTrigger(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } if len(m.EpochMetaBlockHash) > 0 { i -= len(m.EpochMetaBlockHash) copy(dAtA[i:], m.EpochMetaBlockHash) i = encodeVarintTrigger(dAtA, i, uint64(len(m.EpochMetaBlockHash))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if m.EpochFinalityAttestingRound != 0 { i = encodeVarintTrigger(dAtA, i, uint64(m.EpochFinalityAttestingRound)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x40 } if m.EpochStartRound != 0 { i = encodeVarintTrigger(dAtA, i, uint64(m.EpochStartRound)) i-- - dAtA[i] = 0x30 + dAtA[i] = 0x38 } if m.CurrentRoundIndex != 0 { i = encodeVarintTrigger(dAtA, i, uint64(m.CurrentRoundIndex)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x30 } if m.MetaEpoch != 0 { i = encodeVarintTrigger(dAtA, i, uint64(m.MetaEpoch)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.Epoch != 0 { i = encodeVarintTrigger(dAtA, i, uint64(m.Epoch)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if m.NewEpochHeaderReceived { i-- @@ -572,7 +562,7 @@ func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if m.IsEpochStart { i-- @@ -582,7 +572,19 @@ func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x8 + dAtA[i] = 0x10 + } + if m.EpochStartShardHeader != nil { + { + size, err := m.EpochStartShardHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrigger(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -642,6 +644,10 @@ func (m *TriggerRegistryV2) Size() (n int) { } var l int _ = l + if m.EpochStartShardHeader != nil { + l = m.EpochStartShardHeader.Size() + n += 1 + l + sovTrigger(uint64(l)) + } if m.IsEpochStart { n += 2 } @@ -667,10 +673,6 @@ func (m *TriggerRegistryV2) Size() (n int) { if l > 0 { n += 1 + l + sovTrigger(uint64(l)) } - if m.EpochStartShardHeader != nil { - l = m.EpochStartShardHeader.Size() - n += 1 + l + sovTrigger(uint64(l)) - } return n } @@ -703,6 +705,7 @@ func (this *TriggerRegistryV2) String() string { return "nil" } s := strings.Join([]string{`&TriggerRegistryV2{`, + `EpochStartShardHeader:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartShardHeader), "HeaderV2", "HeaderV2", 1) + `,`, `IsEpochStart:` + fmt.Sprintf("%v", this.IsEpochStart) + `,`, `NewEpochHeaderReceived:` + fmt.Sprintf("%v", this.NewEpochHeaderReceived) + `,`, `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, @@ -711,7 +714,6 @@ func (this *TriggerRegistryV2) String() string { `EpochStartRound:` + fmt.Sprintf("%v", this.EpochStartRound) + `,`, `EpochFinalityAttestingRound:` + fmt.Sprintf("%v", this.EpochFinalityAttestingRound) + `,`, `EpochMetaBlockHash:` + fmt.Sprintf("%v", this.EpochMetaBlockHash) + `,`, - `EpochStartShardHeader:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartShardHeader), "HeaderV2", "HeaderV2", 1) + `,`, `}`, }, "") return s @@ -1012,6 +1014,42 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartShardHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EpochStartShardHeader == nil { + m.EpochStartShardHeader = &HeaderV2{} + } + if err := m.EpochStartShardHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IsEpochStart", wireType) } @@ -1031,7 +1069,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { } } m.IsEpochStart = bool(v != 0) - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NewEpochHeaderReceived", wireType) } @@ -1051,7 +1089,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { } } m.NewEpochHeaderReceived = bool(v != 0) - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) } @@ -1070,7 +1108,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MetaEpoch", wireType) } @@ -1089,7 +1127,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { break } } - case 5: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CurrentRoundIndex", wireType) } @@ -1108,7 +1146,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { break } } - case 6: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EpochStartRound", wireType) } @@ -1127,7 +1165,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { break } } - case 7: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EpochFinalityAttestingRound", wireType) } @@ -1146,7 +1184,7 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { break } } - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EpochMetaBlockHash", wireType) } @@ -1180,42 +1218,6 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { m.EpochMetaBlockHash = []byte{} } iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochStartShardHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTrigger - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTrigger - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTrigger - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EpochStartShardHeader == nil { - m.EpochStartShardHeader = &HeaderV2{} - } - if err := m.EpochStartShardHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTrigger(dAtA[iNdEx:]) diff --git a/data/block/trigger.proto b/data/block/trigger.proto index 42679f872..a47e36992 100644 --- a/data/block/trigger.proto +++ b/data/block/trigger.proto @@ -22,13 +22,13 @@ message TriggerRegistry { } message TriggerRegistryV2 { - bool IsEpochStart = 1; - bool NewEpochHeaderReceived = 2; - uint32 Epoch = 3; - uint32 MetaEpoch = 4; - int64 CurrentRoundIndex = 5; - uint64 EpochStartRound = 6; - uint64 EpochFinalityAttestingRound = 7; - bytes EpochMetaBlockHash = 8; - HeaderV2 EpochStartShardHeader = 9; + HeaderV2 EpochStartShardHeader = 1; + bool IsEpochStart = 2; + bool NewEpochHeaderReceived = 3; + uint32 Epoch = 4; + uint32 MetaEpoch = 5; + int64 CurrentRoundIndex = 6; + uint64 EpochStartRound = 7; + uint64 EpochFinalityAttestingRound = 8; + bytes EpochMetaBlockHash = 9; } From 1b2779f540a019f4491cc997723be1a7c9a94981 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 11 Aug 2021 11:51:49 +0300 Subject: [PATCH 12/32] add proto schema for metachain epoch start trigger --- data/block/trigger.go | 120 +++---- data/block/trigger.pb.go | 689 +++++++++++++++++++++++++++++++++------ data/block/trigger.proto | 15 +- 3 files changed, 661 insertions(+), 163 deletions(-) diff --git a/data/block/trigger.go b/data/block/trigger.go index b352b0b79..2a9a6dacf 100644 --- a/data/block/trigger.go +++ b/data/block/trigger.go @@ -4,94 +4,94 @@ package block import "github.com/ElrondNetwork/elrond-go-core/data" // GetEpochStartHeaderHandler returns the epoch start headerHandler -func (tr *TriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler { - if tr == nil { +func (str *ShardTriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler { + if str == nil { return nil } - return tr.GetEpochStartShardHeader() + return str.GetEpochStartShardHeader() } // SetIsEpochStart sets the isEpochStart flag -func (tr *TriggerRegistry) SetIsEpochStart(isEpochStart bool) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetIsEpochStart(isEpochStart bool) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.IsEpochStart = isEpochStart + str.IsEpochStart = isEpochStart return nil } // SetNewEpochHeaderReceived sets the newEpochHeaderReceived flag -func (tr *TriggerRegistry) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.NewEpochHeaderReceived = newEpochHeaderReceived + str.NewEpochHeaderReceived = newEpochHeaderReceived return nil } // SetEpoch sets the epoch -func (tr *TriggerRegistry) SetEpoch(epoch uint32) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetEpoch(epoch uint32) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.Epoch = epoch + str.Epoch = epoch return nil } // SetMetaEpoch Sets the metaChain epoch -func (tr *TriggerRegistry) SetMetaEpoch(metaEpoch uint32) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetMetaEpoch(metaEpoch uint32) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.MetaEpoch = metaEpoch + str.MetaEpoch = metaEpoch return nil } // SetCurrentRoundIndex sets the current round index -func (tr *TriggerRegistry) SetCurrentRoundIndex(roundIndex int64) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetCurrentRoundIndex(roundIndex int64) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.CurrentRoundIndex = roundIndex + str.CurrentRoundIndex = roundIndex return nil } // SetEpochStartRound sets the epoch start round -func (tr *TriggerRegistry) SetEpochStartRound(startRound uint64) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetEpochStartRound(startRound uint64) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.EpochStartRound = startRound + str.EpochStartRound = startRound return nil } // SetEpochFinalityAttestingRound sets the epoch finality attesting round -func (tr *TriggerRegistry) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.EpochFinalityAttestingRound = finalityAttestingRound + str.EpochFinalityAttestingRound = finalityAttestingRound return nil } // SetEpochMetaBlockHash sets the epoch metaChain block hash -func (tr *TriggerRegistry) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { + if str == nil { return data.ErrNilPointerReceiver } - tr.EpochMetaBlockHash = epochMetaBlockHash + str.EpochMetaBlockHash = epochMetaBlockHash return nil } // SetEpochStartHeaderHandler sets the epoch start header -func (tr *TriggerRegistry) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { - if tr == nil { +func (str *ShardTriggerRegistry) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { + if str == nil { return data.ErrNilPointerReceiver } var ok bool - tr.EpochStartShardHeader, ok = epochStartHeaderHandler.(*Header) + str.EpochStartShardHeader, ok = epochStartHeaderHandler.(*Header) if !ok { return data.ErrInvalidTypeAssertion } @@ -99,93 +99,93 @@ func (tr *TriggerRegistry) SetEpochStartHeaderHandler(epochStartHeaderHandler da } // GetEpochStartHeaderHandler returns the epoch start headerHandler -func (trV2 *TriggerRegistryV2) GetEpochStartHeaderHandler() data.HeaderHandler { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) GetEpochStartHeaderHandler() data.HeaderHandler { + if strV2 == nil { return nil } - return trV2.GetEpochStartShardHeader() + return strV2.GetEpochStartShardHeader() } // SetIsEpochStart sets the isEpochStart flag -func (trV2 *TriggerRegistryV2) SetIsEpochStart(isEpochStart bool) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetIsEpochStart(isEpochStart bool) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.IsEpochStart = isEpochStart + strV2.IsEpochStart = isEpochStart return nil } // SetNewEpochHeaderReceived sets the neeEpochHeaderReceived flag -func (trV2 *TriggerRegistryV2) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetNewEpochHeaderReceived(newEpochHeaderReceived bool) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.NewEpochHeaderReceived = newEpochHeaderReceived + strV2.NewEpochHeaderReceived = newEpochHeaderReceived return nil } // SetEpoch sets the epoch -func (trV2 *TriggerRegistryV2) SetEpoch(epoch uint32) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetEpoch(epoch uint32) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.Epoch = epoch + strV2.Epoch = epoch return nil } // SetMetaEpoch sets the metaChain epoch -func (trV2 *TriggerRegistryV2) SetMetaEpoch(metaEpoch uint32) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetMetaEpoch(metaEpoch uint32) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.MetaEpoch = metaEpoch + strV2.MetaEpoch = metaEpoch return nil } // SetCurrentRoundIndex sets the current round index -func (trV2 *TriggerRegistryV2) SetCurrentRoundIndex(roundIndex int64) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetCurrentRoundIndex(roundIndex int64) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.CurrentRoundIndex = roundIndex + strV2.CurrentRoundIndex = roundIndex return nil } // SetEpochStartRound sets the epoch start round -func (trV2 *TriggerRegistryV2) SetEpochStartRound(startRound uint64) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetEpochStartRound(startRound uint64) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.EpochStartRound = startRound + strV2.EpochStartRound = startRound return nil } // SetEpochFinalityAttestingRound sets the epoch finality attesting round -func (trV2 *TriggerRegistryV2) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetEpochFinalityAttestingRound(finalityAttestingRound uint64) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.EpochFinalityAttestingRound = finalityAttestingRound + strV2.EpochFinalityAttestingRound = finalityAttestingRound return nil } // SetEpochMetaBlockHash sets the epoch metaChain block hash -func (trV2 *TriggerRegistryV2) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetEpochMetaBlockHash(epochMetaBlockHash []byte) error { + if strV2 == nil { return data.ErrNilPointerReceiver } - trV2.EpochMetaBlockHash = epochMetaBlockHash + strV2.EpochMetaBlockHash = epochMetaBlockHash return nil } // SetEpochStartHeaderHandler sets the epoch start header -func (trV2 *TriggerRegistryV2) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { - if trV2 == nil { +func (strV2 *ShardTriggerRegistryV2) SetEpochStartHeaderHandler(epochStartHeaderHandler data.HeaderHandler) error { + if strV2 == nil { return data.ErrNilPointerReceiver } var ok bool - trV2.EpochStartShardHeader, ok = epochStartHeaderHandler.(*HeaderV2) + strV2.EpochStartShardHeader, ok = epochStartHeaderHandler.(*HeaderV2) if !ok { return data.ErrInvalidTypeAssertion } diff --git a/data/block/trigger.pb.go b/data/block/trigger.pb.go index d3be854f9..3db9b3312 100644 --- a/data/block/trigger.pb.go +++ b/data/block/trigger.pb.go @@ -26,7 +26,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type TriggerRegistry struct { +type ShardTriggerRegistry struct { IsEpochStart bool `protobuf:"varint,1,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` NewEpochHeaderReceived bool `protobuf:"varint,2,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` Epoch uint32 `protobuf:"varint,3,opt,name=Epoch,proto3" json:"Epoch,omitempty"` @@ -38,15 +38,15 @@ type TriggerRegistry struct { EpochStartShardHeader *Header `protobuf:"bytes,9,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` } -func (m *TriggerRegistry) Reset() { *m = TriggerRegistry{} } -func (*TriggerRegistry) ProtoMessage() {} -func (*TriggerRegistry) Descriptor() ([]byte, []int) { +func (m *ShardTriggerRegistry) Reset() { *m = ShardTriggerRegistry{} } +func (*ShardTriggerRegistry) ProtoMessage() {} +func (*ShardTriggerRegistry) Descriptor() ([]byte, []int) { return fileDescriptor_8c31e6d8b4368946, []int{0} } -func (m *TriggerRegistry) XXX_Unmarshal(b []byte) error { +func (m *ShardTriggerRegistry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TriggerRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ShardTriggerRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -54,82 +54,82 @@ func (m *TriggerRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, err } return b[:n], nil } -func (m *TriggerRegistry) XXX_Merge(src proto.Message) { - xxx_messageInfo_TriggerRegistry.Merge(m, src) +func (m *ShardTriggerRegistry) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShardTriggerRegistry.Merge(m, src) } -func (m *TriggerRegistry) XXX_Size() int { +func (m *ShardTriggerRegistry) XXX_Size() int { return m.Size() } -func (m *TriggerRegistry) XXX_DiscardUnknown() { - xxx_messageInfo_TriggerRegistry.DiscardUnknown(m) +func (m *ShardTriggerRegistry) XXX_DiscardUnknown() { + xxx_messageInfo_ShardTriggerRegistry.DiscardUnknown(m) } -var xxx_messageInfo_TriggerRegistry proto.InternalMessageInfo +var xxx_messageInfo_ShardTriggerRegistry proto.InternalMessageInfo -func (m *TriggerRegistry) GetIsEpochStart() bool { +func (m *ShardTriggerRegistry) GetIsEpochStart() bool { if m != nil { return m.IsEpochStart } return false } -func (m *TriggerRegistry) GetNewEpochHeaderReceived() bool { +func (m *ShardTriggerRegistry) GetNewEpochHeaderReceived() bool { if m != nil { return m.NewEpochHeaderReceived } return false } -func (m *TriggerRegistry) GetEpoch() uint32 { +func (m *ShardTriggerRegistry) GetEpoch() uint32 { if m != nil { return m.Epoch } return 0 } -func (m *TriggerRegistry) GetMetaEpoch() uint32 { +func (m *ShardTriggerRegistry) GetMetaEpoch() uint32 { if m != nil { return m.MetaEpoch } return 0 } -func (m *TriggerRegistry) GetCurrentRoundIndex() int64 { +func (m *ShardTriggerRegistry) GetCurrentRoundIndex() int64 { if m != nil { return m.CurrentRoundIndex } return 0 } -func (m *TriggerRegistry) GetEpochStartRound() uint64 { +func (m *ShardTriggerRegistry) GetEpochStartRound() uint64 { if m != nil { return m.EpochStartRound } return 0 } -func (m *TriggerRegistry) GetEpochFinalityAttestingRound() uint64 { +func (m *ShardTriggerRegistry) GetEpochFinalityAttestingRound() uint64 { if m != nil { return m.EpochFinalityAttestingRound } return 0 } -func (m *TriggerRegistry) GetEpochMetaBlockHash() []byte { +func (m *ShardTriggerRegistry) GetEpochMetaBlockHash() []byte { if m != nil { return m.EpochMetaBlockHash } return nil } -func (m *TriggerRegistry) GetEpochStartShardHeader() *Header { +func (m *ShardTriggerRegistry) GetEpochStartShardHeader() *Header { if m != nil { return m.EpochStartShardHeader } return nil } -type TriggerRegistryV2 struct { +type ShardTriggerRegistryV2 struct { EpochStartShardHeader *HeaderV2 `protobuf:"bytes,1,opt,name=EpochStartShardHeader,proto3" json:"EpochStartShardHeader,omitempty"` IsEpochStart bool `protobuf:"varint,2,opt,name=IsEpochStart,proto3" json:"IsEpochStart,omitempty"` NewEpochHeaderReceived bool `protobuf:"varint,3,opt,name=NewEpochHeaderReceived,proto3" json:"NewEpochHeaderReceived,omitempty"` @@ -141,15 +141,15 @@ type TriggerRegistryV2 struct { EpochMetaBlockHash []byte `protobuf:"bytes,9,opt,name=EpochMetaBlockHash,proto3" json:"EpochMetaBlockHash,omitempty"` } -func (m *TriggerRegistryV2) Reset() { *m = TriggerRegistryV2{} } -func (*TriggerRegistryV2) ProtoMessage() {} -func (*TriggerRegistryV2) Descriptor() ([]byte, []int) { +func (m *ShardTriggerRegistryV2) Reset() { *m = ShardTriggerRegistryV2{} } +func (*ShardTriggerRegistryV2) ProtoMessage() {} +func (*ShardTriggerRegistryV2) Descriptor() ([]byte, []int) { return fileDescriptor_8c31e6d8b4368946, []int{1} } -func (m *TriggerRegistryV2) XXX_Unmarshal(b []byte) error { +func (m *ShardTriggerRegistryV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TriggerRegistryV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ShardTriggerRegistryV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -157,128 +157,222 @@ func (m *TriggerRegistryV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, e } return b[:n], nil } -func (m *TriggerRegistryV2) XXX_Merge(src proto.Message) { - xxx_messageInfo_TriggerRegistryV2.Merge(m, src) +func (m *ShardTriggerRegistryV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShardTriggerRegistryV2.Merge(m, src) } -func (m *TriggerRegistryV2) XXX_Size() int { +func (m *ShardTriggerRegistryV2) XXX_Size() int { return m.Size() } -func (m *TriggerRegistryV2) XXX_DiscardUnknown() { - xxx_messageInfo_TriggerRegistryV2.DiscardUnknown(m) +func (m *ShardTriggerRegistryV2) XXX_DiscardUnknown() { + xxx_messageInfo_ShardTriggerRegistryV2.DiscardUnknown(m) } -var xxx_messageInfo_TriggerRegistryV2 proto.InternalMessageInfo +var xxx_messageInfo_ShardTriggerRegistryV2 proto.InternalMessageInfo -func (m *TriggerRegistryV2) GetEpochStartShardHeader() *HeaderV2 { +func (m *ShardTriggerRegistryV2) GetEpochStartShardHeader() *HeaderV2 { if m != nil { return m.EpochStartShardHeader } return nil } -func (m *TriggerRegistryV2) GetIsEpochStart() bool { +func (m *ShardTriggerRegistryV2) GetIsEpochStart() bool { if m != nil { return m.IsEpochStart } return false } -func (m *TriggerRegistryV2) GetNewEpochHeaderReceived() bool { +func (m *ShardTriggerRegistryV2) GetNewEpochHeaderReceived() bool { if m != nil { return m.NewEpochHeaderReceived } return false } -func (m *TriggerRegistryV2) GetEpoch() uint32 { +func (m *ShardTriggerRegistryV2) GetEpoch() uint32 { if m != nil { return m.Epoch } return 0 } -func (m *TriggerRegistryV2) GetMetaEpoch() uint32 { +func (m *ShardTriggerRegistryV2) GetMetaEpoch() uint32 { if m != nil { return m.MetaEpoch } return 0 } -func (m *TriggerRegistryV2) GetCurrentRoundIndex() int64 { +func (m *ShardTriggerRegistryV2) GetCurrentRoundIndex() int64 { if m != nil { return m.CurrentRoundIndex } return 0 } -func (m *TriggerRegistryV2) GetEpochStartRound() uint64 { +func (m *ShardTriggerRegistryV2) GetEpochStartRound() uint64 { if m != nil { return m.EpochStartRound } return 0 } -func (m *TriggerRegistryV2) GetEpochFinalityAttestingRound() uint64 { +func (m *ShardTriggerRegistryV2) GetEpochFinalityAttestingRound() uint64 { if m != nil { return m.EpochFinalityAttestingRound } return 0 } -func (m *TriggerRegistryV2) GetEpochMetaBlockHash() []byte { +func (m *ShardTriggerRegistryV2) GetEpochMetaBlockHash() []byte { if m != nil { return m.EpochMetaBlockHash } return nil } +type MetaTriggerRegistry struct { + Epoch uint32 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + CurrentRound uint64 `protobuf:"varint,2,opt,name=CurrentRound,proto3" json:"CurrentRound,omitempty"` + EpochFinalityAttestingRound uint64 `protobuf:"varint,3,opt,name=EpochFinalityAttestingRound,proto3" json:"EpochFinalityAttestingRound,omitempty"` + CurrEpochStartRound uint64 `protobuf:"varint,4,opt,name=CurrEpochStartRound,proto3" json:"CurrEpochStartRound,omitempty"` + PrevEpochStartRound uint64 `protobuf:"varint,5,opt,name=PrevEpochStartRound,proto3" json:"PrevEpochStartRound,omitempty"` + EpochStartMetaHash []byte `protobuf:"bytes,6,opt,name=EpochStartMetaHash,proto3" json:"EpochStartMetaHash,omitempty"` + EpochStartMeta *MetaBlock `protobuf:"bytes,7,opt,name=EpochStartMeta,proto3" json:"EpochStartMeta,omitempty"` +} + +func (m *MetaTriggerRegistry) Reset() { *m = MetaTriggerRegistry{} } +func (*MetaTriggerRegistry) ProtoMessage() {} +func (*MetaTriggerRegistry) Descriptor() ([]byte, []int) { + return fileDescriptor_8c31e6d8b4368946, []int{2} +} +func (m *MetaTriggerRegistry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetaTriggerRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MetaTriggerRegistry) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetaTriggerRegistry.Merge(m, src) +} +func (m *MetaTriggerRegistry) XXX_Size() int { + return m.Size() +} +func (m *MetaTriggerRegistry) XXX_DiscardUnknown() { + xxx_messageInfo_MetaTriggerRegistry.DiscardUnknown(m) +} + +var xxx_messageInfo_MetaTriggerRegistry proto.InternalMessageInfo + +func (m *MetaTriggerRegistry) GetEpoch() uint32 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *MetaTriggerRegistry) GetCurrentRound() uint64 { + if m != nil { + return m.CurrentRound + } + return 0 +} + +func (m *MetaTriggerRegistry) GetEpochFinalityAttestingRound() uint64 { + if m != nil { + return m.EpochFinalityAttestingRound + } + return 0 +} + +func (m *MetaTriggerRegistry) GetCurrEpochStartRound() uint64 { + if m != nil { + return m.CurrEpochStartRound + } + return 0 +} + +func (m *MetaTriggerRegistry) GetPrevEpochStartRound() uint64 { + if m != nil { + return m.PrevEpochStartRound + } + return 0 +} + +func (m *MetaTriggerRegistry) GetEpochStartMetaHash() []byte { + if m != nil { + return m.EpochStartMetaHash + } + return nil +} + +func (m *MetaTriggerRegistry) GetEpochStartMeta() *MetaBlock { + if m != nil { + return m.EpochStartMeta + } + return nil +} + func init() { - proto.RegisterType((*TriggerRegistry)(nil), "proto.TriggerRegistry") - proto.RegisterType((*TriggerRegistryV2)(nil), "proto.TriggerRegistryV2") + proto.RegisterType((*ShardTriggerRegistry)(nil), "proto.ShardTriggerRegistry") + proto.RegisterType((*ShardTriggerRegistryV2)(nil), "proto.ShardTriggerRegistryV2") + proto.RegisterType((*MetaTriggerRegistry)(nil), "proto.MetaTriggerRegistry") } func init() { proto.RegisterFile("trigger.proto", fileDescriptor_8c31e6d8b4368946) } var fileDescriptor_8c31e6d8b4368946 = []byte{ - // 437 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf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, 0x36, 0x67, 0xd6, 0xd9, 0x9c, 0xc1, 0x77, - 0xcd, 0xe0, 0xa7, 0x66, 0xf0, 0x47, 0x33, 0x98, 0x6a, 0x06, 0x33, 0xcd, 0xe0, 0xaf, 0x66, 0xf0, - 0x4f, 0x33, 0xeb, 0x4c, 0x33, 0xf8, 0xb1, 0x60, 0xd6, 0x74, 0xc1, 0xac, 0xd9, 0x82, 0x59, 0x1f, - 0x1c, 0xfc, 0x65, 0xd3, 0x3e, 0x12, 0x7c, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x6d, 0x96, - 0x7e, 0x14, 0x04, 0x00, 0x00, + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xf5, 0xc4, 0x76, 0x9a, 0x4c, 0x12, 0x02, 0xd3, 0x52, 0x59, 0x05, 0x8d, 0x2c, 0xaf, 0xbc, + 0x80, 0x14, 0x19, 0x09, 0xb1, 0x03, 0x5a, 0x15, 0xb5, 0x8b, 0x22, 0x34, 0x45, 0x59, 0xb0, 0x73, + 0xe2, 0xc1, 0xb1, 0x68, 0xed, 0x6a, 0x32, 0x29, 0x74, 0xc7, 0x27, 0xf0, 0x19, 0xfc, 0x00, 0x0b, + 0xfe, 0x80, 0x65, 0x96, 0xd9, 0x41, 0x9c, 0x0d, 0xcb, 0x7e, 0x02, 0xf2, 0x75, 0x48, 0x62, 0xd7, + 0xa6, 0x8f, 0x55, 0x72, 0xcf, 0xb9, 0xe7, 0xce, 0xcc, 0xb9, 0x27, 0xc1, 0x2d, 0x29, 0x02, 0xdf, + 0xe7, 0xa2, 0x73, 0x2a, 0x22, 0x19, 0x11, 0x1d, 0x3e, 0xb6, 0x1e, 0xfb, 0x81, 0x1c, 0x8c, 0x7a, + 0x9d, 0x7e, 0x74, 0xb2, 0xed, 0x47, 0x7e,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x34, 0x8e, 0x29, 0x9a, 0xc4, 0x14, 0xfd, 0x8e, 0x29, 0xfa, 0x13, 0x53, + 0xe5, 0x22, 0xa6, 0xe8, 0xeb, 0x8c, 0x2a, 0xe3, 0x19, 0x55, 0x26, 0x33, 0xaa, 0xbc, 0xd7, 0xe1, + 0xff, 0xb2, 0x57, 0x85, 0x13, 0x9e, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x15, 0x5a, 0xda, 0x3b, + 0x91, 0x05, 0x00, 0x00, } -func (this *TriggerRegistry) Equal(that interface{}) bool { +func (this *ShardTriggerRegistry) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*TriggerRegistry) + that1, ok := that.(*ShardTriggerRegistry) if !ok { - that2, ok := that.(TriggerRegistry) + that2, ok := that.(ShardTriggerRegistry) if ok { that1 = &that2 } else { @@ -319,14 +413,14 @@ func (this *TriggerRegistry) Equal(that interface{}) bool { } return true } -func (this *TriggerRegistryV2) Equal(that interface{}) bool { +func (this *ShardTriggerRegistryV2) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*TriggerRegistryV2) + that1, ok := that.(*ShardTriggerRegistryV2) if !ok { - that2, ok := that.(TriggerRegistryV2) + that2, ok := that.(ShardTriggerRegistryV2) if ok { that1 = &that2 } else { @@ -367,12 +461,54 @@ func (this *TriggerRegistryV2) Equal(that interface{}) bool { } return true } -func (this *TriggerRegistry) GoString() string { +func (this *MetaTriggerRegistry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MetaTriggerRegistry) + if !ok { + that2, ok := that.(MetaTriggerRegistry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Epoch != that1.Epoch { + return false + } + if this.CurrentRound != that1.CurrentRound { + return false + } + if this.EpochFinalityAttestingRound != that1.EpochFinalityAttestingRound { + return false + } + if this.CurrEpochStartRound != that1.CurrEpochStartRound { + return false + } + if this.PrevEpochStartRound != that1.PrevEpochStartRound { + return false + } + if !bytes.Equal(this.EpochStartMetaHash, that1.EpochStartMetaHash) { + return false + } + if !this.EpochStartMeta.Equal(that1.EpochStartMeta) { + return false + } + return true +} +func (this *ShardTriggerRegistry) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 13) - s = append(s, "&block.TriggerRegistry{") + s = append(s, "&block.ShardTriggerRegistry{") s = append(s, "IsEpochStart: "+fmt.Sprintf("%#v", this.IsEpochStart)+",\n") s = append(s, "NewEpochHeaderReceived: "+fmt.Sprintf("%#v", this.NewEpochHeaderReceived)+",\n") s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") @@ -387,12 +523,12 @@ func (this *TriggerRegistry) GoString() string { s = append(s, "}") return strings.Join(s, "") } -func (this *TriggerRegistryV2) GoString() string { +func (this *ShardTriggerRegistryV2) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 13) - s = append(s, "&block.TriggerRegistryV2{") + s = append(s, "&block.ShardTriggerRegistryV2{") if this.EpochStartShardHeader != nil { s = append(s, "EpochStartShardHeader: "+fmt.Sprintf("%#v", this.EpochStartShardHeader)+",\n") } @@ -407,6 +543,24 @@ func (this *TriggerRegistryV2) GoString() string { s = append(s, "}") return strings.Join(s, "") } +func (this *MetaTriggerRegistry) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&block.MetaTriggerRegistry{") + s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") + s = append(s, "CurrentRound: "+fmt.Sprintf("%#v", this.CurrentRound)+",\n") + s = append(s, "EpochFinalityAttestingRound: "+fmt.Sprintf("%#v", this.EpochFinalityAttestingRound)+",\n") + s = append(s, "CurrEpochStartRound: "+fmt.Sprintf("%#v", this.CurrEpochStartRound)+",\n") + s = append(s, "PrevEpochStartRound: "+fmt.Sprintf("%#v", this.PrevEpochStartRound)+",\n") + s = append(s, "EpochStartMetaHash: "+fmt.Sprintf("%#v", this.EpochStartMetaHash)+",\n") + if this.EpochStartMeta != nil { + s = append(s, "EpochStartMeta: "+fmt.Sprintf("%#v", this.EpochStartMeta)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} func valueToGoStringTrigger(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -415,7 +569,7 @@ func valueToGoStringTrigger(v interface{}, typ string) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } -func (m *TriggerRegistry) Marshal() (dAtA []byte, err error) { +func (m *ShardTriggerRegistry) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -425,12 +579,12 @@ func (m *TriggerRegistry) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TriggerRegistry) MarshalTo(dAtA []byte) (int, error) { +func (m *ShardTriggerRegistry) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TriggerRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ShardTriggerRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -502,7 +656,7 @@ func (m *TriggerRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *TriggerRegistryV2) Marshal() (dAtA []byte, err error) { +func (m *ShardTriggerRegistryV2) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -512,12 +666,12 @@ func (m *TriggerRegistryV2) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TriggerRegistryV2) MarshalTo(dAtA []byte) (int, error) { +func (m *ShardTriggerRegistryV2) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ShardTriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -589,6 +743,73 @@ func (m *TriggerRegistryV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MetaTriggerRegistry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MetaTriggerRegistry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetaTriggerRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochStartMeta != nil { + { + size, err := m.EpochStartMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTrigger(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.EpochStartMetaHash) > 0 { + i -= len(m.EpochStartMetaHash) + copy(dAtA[i:], m.EpochStartMetaHash) + i = encodeVarintTrigger(dAtA, i, uint64(len(m.EpochStartMetaHash))) + i-- + dAtA[i] = 0x32 + } + if m.PrevEpochStartRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.PrevEpochStartRound)) + i-- + dAtA[i] = 0x28 + } + if m.CurrEpochStartRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.CurrEpochStartRound)) + i-- + dAtA[i] = 0x20 + } + if m.EpochFinalityAttestingRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.EpochFinalityAttestingRound)) + i-- + dAtA[i] = 0x18 + } + if m.CurrentRound != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.CurrentRound)) + i-- + dAtA[i] = 0x10 + } + if m.Epoch != 0 { + i = encodeVarintTrigger(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTrigger(dAtA []byte, offset int, v uint64) int { offset -= sovTrigger(v) base := offset @@ -600,7 +821,7 @@ func encodeVarintTrigger(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TriggerRegistry) Size() (n int) { +func (m *ShardTriggerRegistry) Size() (n int) { if m == nil { return 0 } @@ -638,7 +859,7 @@ func (m *TriggerRegistry) Size() (n int) { return n } -func (m *TriggerRegistryV2) Size() (n int) { +func (m *ShardTriggerRegistryV2) Size() (n int) { if m == nil { return 0 } @@ -676,17 +897,49 @@ func (m *TriggerRegistryV2) Size() (n int) { return n } +func (m *MetaTriggerRegistry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovTrigger(uint64(m.Epoch)) + } + if m.CurrentRound != 0 { + n += 1 + sovTrigger(uint64(m.CurrentRound)) + } + if m.EpochFinalityAttestingRound != 0 { + n += 1 + sovTrigger(uint64(m.EpochFinalityAttestingRound)) + } + if m.CurrEpochStartRound != 0 { + n += 1 + sovTrigger(uint64(m.CurrEpochStartRound)) + } + if m.PrevEpochStartRound != 0 { + n += 1 + sovTrigger(uint64(m.PrevEpochStartRound)) + } + l = len(m.EpochStartMetaHash) + if l > 0 { + n += 1 + l + sovTrigger(uint64(l)) + } + if m.EpochStartMeta != nil { + l = m.EpochStartMeta.Size() + n += 1 + l + sovTrigger(uint64(l)) + } + return n +} + func sovTrigger(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTrigger(x uint64) (n int) { return sovTrigger(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *TriggerRegistry) String() string { +func (this *ShardTriggerRegistry) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&TriggerRegistry{`, + s := strings.Join([]string{`&ShardTriggerRegistry{`, `IsEpochStart:` + fmt.Sprintf("%v", this.IsEpochStart) + `,`, `NewEpochHeaderReceived:` + fmt.Sprintf("%v", this.NewEpochHeaderReceived) + `,`, `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, @@ -700,11 +953,11 @@ func (this *TriggerRegistry) String() string { }, "") return s } -func (this *TriggerRegistryV2) String() string { +func (this *ShardTriggerRegistryV2) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&TriggerRegistryV2{`, + s := strings.Join([]string{`&ShardTriggerRegistryV2{`, `EpochStartShardHeader:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartShardHeader), "HeaderV2", "HeaderV2", 1) + `,`, `IsEpochStart:` + fmt.Sprintf("%v", this.IsEpochStart) + `,`, `NewEpochHeaderReceived:` + fmt.Sprintf("%v", this.NewEpochHeaderReceived) + `,`, @@ -718,6 +971,22 @@ func (this *TriggerRegistryV2) String() string { }, "") return s } +func (this *MetaTriggerRegistry) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetaTriggerRegistry{`, + `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, + `CurrentRound:` + fmt.Sprintf("%v", this.CurrentRound) + `,`, + `EpochFinalityAttestingRound:` + fmt.Sprintf("%v", this.EpochFinalityAttestingRound) + `,`, + `CurrEpochStartRound:` + fmt.Sprintf("%v", this.CurrEpochStartRound) + `,`, + `PrevEpochStartRound:` + fmt.Sprintf("%v", this.PrevEpochStartRound) + `,`, + `EpochStartMetaHash:` + fmt.Sprintf("%v", this.EpochStartMetaHash) + `,`, + `EpochStartMeta:` + strings.Replace(fmt.Sprintf("%v", this.EpochStartMeta), "MetaBlock", "MetaBlock", 1) + `,`, + `}`, + }, "") + return s +} func valueToStringTrigger(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -726,7 +995,7 @@ func valueToStringTrigger(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *TriggerRegistry) Unmarshal(dAtA []byte) error { +func (m *ShardTriggerRegistry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -749,10 +1018,10 @@ func (m *TriggerRegistry) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TriggerRegistry: wiretype end group for non-group") + return fmt.Errorf("proto: ShardTriggerRegistry: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TriggerRegistry: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ShardTriggerRegistry: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -984,7 +1253,7 @@ func (m *TriggerRegistry) Unmarshal(dAtA []byte) error { } return nil } -func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { +func (m *ShardTriggerRegistryV2) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1007,10 +1276,10 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TriggerRegistryV2: wiretype end group for non-group") + return fmt.Errorf("proto: ShardTriggerRegistryV2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TriggerRegistryV2: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ShardTriggerRegistryV2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1242,6 +1511,224 @@ func (m *TriggerRegistryV2) Unmarshal(dAtA []byte) error { } return nil } +func (m *MetaTriggerRegistry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MetaTriggerRegistry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetaTriggerRegistry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRound", wireType) + } + m.CurrentRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochFinalityAttestingRound", wireType) + } + m.EpochFinalityAttestingRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochFinalityAttestingRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrEpochStartRound", wireType) + } + m.CurrEpochStartRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrEpochStartRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevEpochStartRound", wireType) + } + m.PrevEpochStartRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrevEpochStartRound |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartMetaHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochStartMetaHash = append(m.EpochStartMetaHash[:0], dAtA[iNdEx:postIndex]...) + if m.EpochStartMetaHash == nil { + m.EpochStartMetaHash = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochStartMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTrigger + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTrigger + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTrigger + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EpochStartMeta == nil { + m.EpochStartMeta = &MetaBlock{} + } + if err := m.EpochStartMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTrigger(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTrigger + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTrigger(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/data/block/trigger.proto b/data/block/trigger.proto index a47e36992..ae590942c 100644 --- a/data/block/trigger.proto +++ b/data/block/trigger.proto @@ -8,8 +8,9 @@ option (gogoproto.stable_marshaler_all) = true; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "block.proto"; import "blockV2.proto"; +import "metaBlock.proto"; -message TriggerRegistry { +message ShardTriggerRegistry { bool IsEpochStart = 1; bool NewEpochHeaderReceived = 2; uint32 Epoch = 3; @@ -21,7 +22,7 @@ message TriggerRegistry { Header EpochStartShardHeader = 9; } -message TriggerRegistryV2 { +message ShardTriggerRegistryV2 { HeaderV2 EpochStartShardHeader = 1; bool IsEpochStart = 2; bool NewEpochHeaderReceived = 3; @@ -32,3 +33,13 @@ message TriggerRegistryV2 { uint64 EpochFinalityAttestingRound = 8; bytes EpochMetaBlockHash = 9; } + +message MetaTriggerRegistry { + uint32 Epoch = 1; + uint64 CurrentRound = 2; + uint64 EpochFinalityAttestingRound = 3; + uint64 CurrEpochStartRound = 4; + uint64 PrevEpochStartRound = 5; + bytes EpochStartMetaHash = 6; + MetaBlock EpochStartMeta = 7; +} From 2ea0c08bdfaf208661921360de5691d321a4b858 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 11 Aug 2021 17:42:32 +0300 Subject: [PATCH 13/32] add unit tests --- data/block/trigger_test.go | 484 +++++++++++++++++++++++++++++++++++++ 1 file changed, 484 insertions(+) create mode 100644 data/block/trigger_test.go diff --git a/data/block/trigger_test.go b/data/block/trigger_test.go new file mode 100644 index 000000000..3bc88a2b5 --- /dev/null +++ b/data/block/trigger_test.go @@ -0,0 +1,484 @@ +package block + +import ( + "testing" + + "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/stretchr/testify/require" +) + +func shouldNotPanic(t *testing.T) { + if r := recover(); r != nil { + require.Fail(t, "should not have panicked") + } +} + +func createDefaultShardTriggerRegistry() *ShardTriggerRegistry { + return &ShardTriggerRegistry{ + IsEpochStart: true, + NewEpochHeaderReceived: true, + Epoch: 10, + MetaEpoch: 11, + CurrentRoundIndex: 10000, + EpochStartRound: 10000, + EpochFinalityAttestingRound: 10002, + EpochMetaBlockHash: []byte("metaBlockHash"), + EpochStartShardHeader: &Header{}, + } +} + +func createDefaultShardTriggerRegistryV2() *ShardTriggerRegistryV2 { + return &ShardTriggerRegistryV2{ + EpochStartShardHeader: &HeaderV2{}, + IsEpochStart: true, + NewEpochHeaderReceived: true, + Epoch: 10, + MetaEpoch: 11, + CurrentRoundIndex: 10000, + EpochStartRound: 10000, + EpochFinalityAttestingRound: 10002, + EpochMetaBlockHash: []byte("metaBlockHash"), + } +} + +func TestShardTriggerRegistry_GetEpochStartHeaderHandlerNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + epochStartHeaderHandler := str.GetEpochStartHeaderHandler() + require.Nil(t, epochStartHeaderHandler) +} + +func TestShardTriggerRegistry_GetEpochStartHeaderHandlerOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + header := &Header{Epoch: 15} + str.EpochStartShardHeader = header + epochStartHeaderHandler := str.GetEpochStartHeaderHandler() + require.Equal(t, header, epochStartHeaderHandler) +} + +func TestShardTriggerRegistry_SetIsEpochStartNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetIsEpochStart(true) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetIsEpochStartOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.IsEpochStart = false + err := str.SetIsEpochStart(true) + require.Nil(t, err) + require.Equal(t, true, str.IsEpochStart) +} + +func TestShardTriggerRegistry_SetNewEpochHeaderReceivedNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetNewEpochHeaderReceived(true) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetNewEpochHeaderReceivedOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.NewEpochHeaderReceived = false + err := str.SetNewEpochHeaderReceived(true) + require.Nil(t, err) + require.Equal(t, true, str.NewEpochHeaderReceived) +} + +func TestShardTriggerRegistry_SetEpochNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetEpoch(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetEpochOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.Epoch = 0 + err := str.SetEpoch(20) + require.Nil(t, err) + require.Equal(t, uint32(20), str.Epoch) +} + +func TestShardTriggerRegistry_SetMetaEpochNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetMetaEpoch(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetMetaEpochOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.MetaEpoch = 0 + err := str.SetMetaEpoch(20) + require.Nil(t, err) + require.Equal(t, uint32(20), str.MetaEpoch) +} + +func TestShardTriggerRegistry_SetCurrentRoundIndexNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetCurrentRoundIndex(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetCurrentRoundIndexOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.CurrentRoundIndex = 0 + err := str.SetCurrentRoundIndex(20) + require.Nil(t, err) + require.Equal(t, int64(20), str.CurrentRoundIndex) +} + +func TestShardTriggerRegistry_SetEpochStartRoundNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetEpochStartRound(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetEpochStartRoundOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.EpochStartRound = 0 + err := str.SetEpochStartRound(20) + require.Nil(t, err) + require.Equal(t, uint64(20), str.EpochStartRound) +} + +func TestShardTriggerRegistry_SetEpochFinalityAttestingRoundNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetEpochFinalityAttestingRound(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetEpochFinalityAttestingRoundOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.EpochFinalityAttestingRound = 0 + err := str.SetEpochFinalityAttestingRound(20) + require.Nil(t, err) + require.Equal(t, uint64(20), str.EpochFinalityAttestingRound) +} + +func TestShardTriggerRegistry_SetEpochMetaBlockHashNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetEpochMetaBlockHash([]byte("meta block hash")) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetEpochMetaBlockHashOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.EpochMetaBlockHash = []byte("hash") + metaBlockHash := []byte("meta block hash") + err := str.SetEpochMetaBlockHash(metaBlockHash) + require.Nil(t, err) + require.Equal(t, metaBlockHash, str.EpochMetaBlockHash) +} + +func TestShardTriggerRegistry_SetEpochStartHeaderHandlerNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistry + err := str.SetEpochStartHeaderHandler(&Header{}) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistry_SetEpochStartHeaderHandlerNilHeaderToSet(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.EpochStartShardHeader = &Header{ + Epoch: 10, + } + setHeader := data.HeaderHandler(nil) + err := str.SetEpochStartHeaderHandler(setHeader) + require.Equal(t, data.ErrInvalidTypeAssertion, err) +} + +func TestShardTriggerRegistry_SetEpochStartHeaderHandlerOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistry() + str.EpochStartShardHeader = &Header{ + Epoch: 10, + } + setHeader := &Header{ + Epoch: 20, + } + err := str.SetEpochStartHeaderHandler(setHeader) + require.Nil(t, err) + require.Equal(t, setHeader, str.EpochStartShardHeader) +} + +func TestShardTriggerRegistryV2_GetEpochStartHeaderHandlerNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + epochStartHeaderHandler := str.GetEpochStartHeaderHandler() + require.Nil(t, epochStartHeaderHandler) +} + +func TestShardTriggerRegistryV2_GetEpochStartHeaderHandlerOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochStartShardHeader = &HeaderV2{ + Header: &Header{}, + ScheduledRootHash: []byte("scheduledRootHash"), + } + epochStartHeaderHandler := str.GetEpochStartHeaderHandler() + require.Equal(t, str.EpochStartShardHeader, epochStartHeaderHandler) +} + +func TestShardTriggerRegistryV2_SetIsEpochStartNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetIsEpochStart(false) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetIsEpochStartOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.IsEpochStart = false + err := str.SetIsEpochStart(true) + require.Nil(t, err) + require.Equal(t, true, str.IsEpochStart) +} + +func TestShardTriggerRegistryV2_SetNewEpochHeaderReceivedNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetNewEpochHeaderReceived(false) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetNewEpochHeaderReceivedOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.NewEpochHeaderReceived = false + err := str.SetNewEpochHeaderReceived(true) + require.Nil(t, err) + require.Equal(t, true, str.NewEpochHeaderReceived) +} + +func TestShardTriggerRegistryV2_SetEpochNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetEpoch(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetEpochOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.Epoch = 0 + err := str.SetEpoch(20) + require.Nil(t, err) + require.Equal(t, uint32(20), str.Epoch) +} + +func TestShardTriggerRegistryV2_SetMetaEpochNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetMetaEpoch(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetMetaEpochOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.Epoch = 0 + err := str.SetMetaEpoch(20) + require.Nil(t, err) + require.Equal(t, uint32(20), str.MetaEpoch) +} + +func TestShardTriggerRegistryV2_SetCurrentRoundIndexNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetCurrentRoundIndex(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetCurrentRoundIndexOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.CurrentRoundIndex = 0 + err := str.SetCurrentRoundIndex(20) + require.Nil(t, err) + require.Equal(t, int64(20), str.CurrentRoundIndex) +} + +func TestShardTriggerRegistryV2_SetEpochStartRoundNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetEpochStartRound(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} +func TestShardTriggerRegistryV2_SetEpochStartRoundOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochStartRound = 0 + err := str.SetEpochStartRound(20) + require.Nil(t, err) + require.Equal(t, uint64(20), str.EpochStartRound) +} + +func TestShardTriggerRegistryV2_SetEpochFinalityAttestingRoundNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetEpochFinalityAttestingRound(20) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetEpochFinalityAttestingRoundOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochFinalityAttestingRound = 0 + err := str.SetEpochFinalityAttestingRound(20) + require.Nil(t, err) + require.Equal(t, uint64(20), str.EpochFinalityAttestingRound) +} + +func TestShardTriggerRegistryV2_SetEpochMetaBlockHashNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetEpochMetaBlockHash([]byte("epoch meta block hash")) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetEpochMetaBlockHashOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochMetaBlockHash = []byte("meta hash") + setMetaBlockHash := []byte("set meta hash") + err := str.SetEpochMetaBlockHash(setMetaBlockHash) + require.Nil(t, err) + require.Equal(t, setMetaBlockHash, str.EpochMetaBlockHash) +} + +func TestShardTriggerRegistryV2_SetEpochStartHeaderHandlerNilShardTriggerRegistry(t *testing.T) { + t.Parallel() + + defer shouldNotPanic(t) + + var str *ShardTriggerRegistryV2 + err := str.SetEpochStartHeaderHandler(&HeaderV2{}) + require.Equal(t, data.ErrNilPointerReceiver, err) +} + +func TestShardTriggerRegistryV2_SetEpochStartHeaderHandlerNilHeaderToSet(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochStartShardHeader = &HeaderV2{ + Header: &Header{}, + ScheduledRootHash: []byte("scheduled root hash"), + } + setHeader := data.HeaderHandler(nil) + err := str.SetEpochStartHeaderHandler(setHeader) + require.Equal(t, data.ErrInvalidTypeAssertion, err) +} + +func TestShardTriggerRegistryV2_SetEpochStartHeaderHandlerOK(t *testing.T) { + t.Parallel() + + str := createDefaultShardTriggerRegistryV2() + str.EpochStartShardHeader = &HeaderV2{ + Header: &Header{Epoch: 1}, + ScheduledRootHash: []byte("scheduled root hash"), + } + + setHeader := &HeaderV2{ + Header: &Header{Epoch: 10}, + ScheduledRootHash: []byte("set scheduled root hash"), + } + + err := str.SetEpochStartHeaderHandler(setHeader) + require.Nil(t, err) + require.Equal(t, setHeader, str.EpochStartShardHeader) +} From 938625a2f15ec8f4cc2a940da9c3c0ad8e3a676b Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 18 Aug 2021 15:42:11 +0300 Subject: [PATCH 14/32] change scheduled SCRs marshalling --- data/scheduled/scheduled.pb.go | 506 +++++++++++++++++++++++++++++---- data/scheduled/scheduled.proto | 10 +- 2 files changed, 449 insertions(+), 67 deletions(-) diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go index 06abd7663..f108c3857 100644 --- a/data/scheduled/scheduled.pb.go +++ b/data/scheduled/scheduled.pb.go @@ -4,10 +4,12 @@ package scheduled import ( + bytes "bytes" fmt "fmt" smartContractResult "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" io "io" math "math" math_bits "math/bits" @@ -26,16 +28,54 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// ScheduledSCRs holds information about scheduled SCRs per block type +type SmartContractResults struct { + TxHandlers []*smartContractResult.SmartContractResult `protobuf:"bytes,1,rep,name=TxHandlers,proto3" json:"TxHandlers,omitempty"` +} + +func (m *SmartContractResults) Reset() { *m = SmartContractResults{} } +func (*SmartContractResults) ProtoMessage() {} +func (*SmartContractResults) Descriptor() ([]byte, []int) { + return fileDescriptor_f80076f37bd30c16, []int{0} +} +func (m *SmartContractResults) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SmartContractResults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SmartContractResults) XXX_Merge(src proto.Message) { + xxx_messageInfo_SmartContractResults.Merge(m, src) +} +func (m *SmartContractResults) XXX_Size() int { + return m.Size() +} +func (m *SmartContractResults) XXX_DiscardUnknown() { + xxx_messageInfo_SmartContractResults.DiscardUnknown(m) +} + +var xxx_messageInfo_SmartContractResults proto.InternalMessageInfo + +func (m *SmartContractResults) GetTxHandlers() []*smartContractResult.SmartContractResult { + if m != nil { + return m.TxHandlers + } + return nil +} + type ScheduledSCRs struct { - BlockType int32 `protobuf:"varint,1,opt,name=BlockType,proto3" json:"BlockType,omitempty"` - TxHandlers []smartContractResult.SmartContractResult `protobuf:"bytes,2,rep,name=TxHandlers,proto3" json:"TxHandlers"` + RootHash [][]byte `protobuf:"bytes,1,rep,name=rootHash,proto3" json:"rootHash,omitempty"` + Scrs map[int32]*SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *ScheduledSCRs) Reset() { *m = ScheduledSCRs{} } func (*ScheduledSCRs) ProtoMessage() {} func (*ScheduledSCRs) Descriptor() ([]byte, []int) { - return fileDescriptor_f80076f37bd30c16, []int{0} + return fileDescriptor_f80076f37bd30c16, []int{1} } func (m *ScheduledSCRs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -60,48 +100,83 @@ func (m *ScheduledSCRs) XXX_DiscardUnknown() { var xxx_messageInfo_ScheduledSCRs proto.InternalMessageInfo -func (m *ScheduledSCRs) GetBlockType() int32 { +func (m *ScheduledSCRs) GetRootHash() [][]byte { if m != nil { - return m.BlockType + return m.RootHash } - return 0 + return nil } -func (m *ScheduledSCRs) GetTxHandlers() []smartContractResult.SmartContractResult { +func (m *ScheduledSCRs) GetScrs() map[int32]*SmartContractResults { if m != nil { - return m.TxHandlers + return m.Scrs } return nil } func init() { + proto.RegisterType((*SmartContractResults)(nil), "proto.SmartContractResults") proto.RegisterType((*ScheduledSCRs)(nil), "proto.ScheduledSCRs") + proto.RegisterMapType((map[int32]*SmartContractResults)(nil), "proto.ScheduledSCRs.ScrsEntry") } func init() { proto.RegisterFile("scheduled.proto", fileDescriptor_f80076f37bd30c16) } var fileDescriptor_f80076f37bd30c16 = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4e, 0xce, 0x48, - 0x4d, 0x29, 0xcd, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x52, - 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, - 0xfa, 0x60, 0xe1, 0xa4, 0xd2, 0x34, 0x30, 0x0f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3, 0x84, - 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xc5, 0x09, 0x0f, 0xcd, - 0x24, 0x36, 0xb0, 0x8d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xca, 0xa3, 0x63, 0x6f, 0x61, - 0x01, 0x00, 0x00, + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x6e, 0xea, 0x30, + 0x14, 0xce, 0x81, 0xcb, 0xd5, 0xc5, 0xdc, 0xab, 0x5b, 0x45, 0x1d, 0xa2, 0x54, 0x3a, 0x42, 0x4c, + 0x2c, 0x24, 0x2a, 0x5d, 0x2a, 0xc6, 0x22, 0x24, 0xa6, 0x0e, 0x0e, 0x13, 0x9b, 0x49, 0xdc, 0x50, + 0x11, 0xe2, 0xca, 0x76, 0xda, 0xb2, 0xf5, 0x11, 0xfa, 0x18, 0x7d, 0x81, 0xbe, 0x43, 0x47, 0x46, + 0xc6, 0x62, 0x96, 0x8e, 0x3c, 0x42, 0x55, 0x47, 0x20, 0xa4, 0xd2, 0xc9, 0xe7, 0xfb, 0xfc, 0xfd, + 0xd8, 0x3a, 0xe4, 0xbf, 0x8a, 0xa7, 0x3c, 0x29, 0x32, 0x9e, 0x04, 0x77, 0x52, 0x68, 0xe1, 0xd6, + 0xec, 0xe1, 0x77, 0xd2, 0x5b, 0x3d, 0x2d, 0x26, 0x41, 0x2c, 0xe6, 0x61, 0x2a, 0x52, 0x11, 0x5a, + 0x7a, 0x52, 0xdc, 0x58, 0x64, 0x81, 0x9d, 0x4a, 0x97, 0x3f, 0x3e, 0x90, 0x0f, 0x32, 0x29, 0xf2, + 0xe4, 0x9a, 0xeb, 0x07, 0x21, 0x67, 0x21, 0xb7, 0xa8, 0x93, 0x8a, 0x4e, 0x2c, 0x24, 0x0f, 0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0xc9, 0x6f, 0xdb, 0x75, 0xf1, 0x19, 0x00, 0x00, 0xff, 0xff, 0x16, 0x5d, + 0xde, 0x8c, 0xfc, 0x01, 0x00, 0x00, } +func (this *SmartContractResults) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SmartContractResults) + if !ok { + that2, ok := that.(SmartContractResults) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.TxHandlers) != len(that1.TxHandlers) { + return false + } + for i := range this.TxHandlers { + if !this.TxHandlers[i].Equal(that1.TxHandlers[i]) { + return false + } + } + return true +} func (this *ScheduledSCRs) Equal(that interface{}) bool { if that == nil { return this == nil @@ -121,32 +196,55 @@ func (this *ScheduledSCRs) Equal(that interface{}) bool { } else if this == nil { return false } - if this.BlockType != that1.BlockType { + if len(this.RootHash) != len(that1.RootHash) { return false } - if len(this.TxHandlers) != len(that1.TxHandlers) { + for i := range this.RootHash { + if !bytes.Equal(this.RootHash[i], that1.RootHash[i]) { + return false + } + } + if len(this.Scrs) != len(that1.Scrs) { return false } - for i := range this.TxHandlers { - if !this.TxHandlers[i].Equal(&that1.TxHandlers[i]) { + for i := range this.Scrs { + if !this.Scrs[i].Equal(that1.Scrs[i]) { return false } } return true } +func (this *SmartContractResults) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&scheduled.SmartContractResults{") + if this.TxHandlers != nil { + s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", this.TxHandlers)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} func (this *ScheduledSCRs) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&scheduled.ScheduledSCRs{") - s = append(s, "BlockType: "+fmt.Sprintf("%#v", this.BlockType)+",\n") - if this.TxHandlers != nil { - vs := make([]smartContractResult.SmartContractResult, len(this.TxHandlers)) - for i := range vs { - vs[i] = this.TxHandlers[i] - } - s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", vs)+",\n") + s = append(s, "RootHash: "+fmt.Sprintf("%#v", this.RootHash)+",\n") + keysForScrs := make([]int32, 0, len(this.Scrs)) + for k, _ := range this.Scrs { + keysForScrs = append(keysForScrs, k) + } + github_com_gogo_protobuf_sortkeys.Int32s(keysForScrs) + mapStringForScrs := "map[int32]*SmartContractResults{" + for _, k := range keysForScrs { + mapStringForScrs += fmt.Sprintf("%#v: %#v,", k, this.Scrs[k]) + } + mapStringForScrs += "}" + if this.Scrs != nil { + s = append(s, "Scrs: "+mapStringForScrs+",\n") } s = append(s, "}") return strings.Join(s, "") @@ -159,7 +257,7 @@ func valueToGoStringScheduled(v interface{}, typ string) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } -func (m *ScheduledSCRs) Marshal() (dAtA []byte, err error) { +func (m *SmartContractResults) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -169,12 +267,12 @@ func (m *ScheduledSCRs) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ScheduledSCRs) MarshalTo(dAtA []byte) (int, error) { +func (m *SmartContractResults) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SmartContractResults) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -190,13 +288,69 @@ func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintScheduled(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ScheduledSCRs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScheduledSCRs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Scrs) > 0 { + keysForScrs := make([]int32, 0, len(m.Scrs)) + for k := range m.Scrs { + keysForScrs = append(keysForScrs, int32(k)) + } + github_com_gogo_protobuf_sortkeys.Int32s(keysForScrs) + for iNdEx := len(keysForScrs) - 1; iNdEx >= 0; iNdEx-- { + v := m.Scrs[int32(keysForScrs[iNdEx])] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScheduled(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i = encodeVarintScheduled(dAtA, i, uint64(keysForScrs[iNdEx])) + i-- + dAtA[i] = 0x8 + i = encodeVarintScheduled(dAtA, i, uint64(baseI-i)) + i-- dAtA[i] = 0x12 } } - if m.BlockType != 0 { - i = encodeVarintScheduled(dAtA, i, uint64(m.BlockType)) - i-- - dAtA[i] = 0x8 + if len(m.RootHash) > 0 { + for iNdEx := len(m.RootHash) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RootHash[iNdEx]) + copy(dAtA[i:], m.RootHash[iNdEx]) + i = encodeVarintScheduled(dAtA, i, uint64(len(m.RootHash[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -212,15 +366,12 @@ func encodeVarintScheduled(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *ScheduledSCRs) Size() (n int) { +func (m *SmartContractResults) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.BlockType != 0 { - n += 1 + sovScheduled(uint64(m.BlockType)) - } if len(m.TxHandlers) > 0 { for _, e := range m.TxHandlers { l = e.Size() @@ -230,28 +381,76 @@ func (m *ScheduledSCRs) Size() (n int) { return n } +func (m *ScheduledSCRs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RootHash) > 0 { + for _, b := range m.RootHash { + l = len(b) + n += 1 + l + sovScheduled(uint64(l)) + } + } + if len(m.Scrs) > 0 { + for k, v := range m.Scrs { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovScheduled(uint64(l)) + } + mapEntrySize := 1 + sovScheduled(uint64(k)) + l + n += mapEntrySize + 1 + sovScheduled(uint64(mapEntrySize)) + } + } + return n +} + func sovScheduled(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozScheduled(x uint64) (n int) { return sovScheduled(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *ScheduledSCRs) String() string { +func (this *SmartContractResults) String() string { if this == nil { return "nil" } - repeatedStringForTxHandlers := "[]SmartContractResult{" + repeatedStringForTxHandlers := "[]*SmartContractResult{" for _, f := range this.TxHandlers { - repeatedStringForTxHandlers += fmt.Sprintf("%v", f) + "," + repeatedStringForTxHandlers += strings.Replace(fmt.Sprintf("%v", f), "SmartContractResult", "smartContractResult.SmartContractResult", 1) + "," } repeatedStringForTxHandlers += "}" - s := strings.Join([]string{`&ScheduledSCRs{`, - `BlockType:` + fmt.Sprintf("%v", this.BlockType) + `,`, + s := strings.Join([]string{`&SmartContractResults{`, `TxHandlers:` + repeatedStringForTxHandlers + `,`, `}`, }, "") return s } +func (this *ScheduledSCRs) String() string { + if this == nil { + return "nil" + } + keysForScrs := make([]int32, 0, len(this.Scrs)) + for k, _ := range this.Scrs { + keysForScrs = append(keysForScrs, k) + } + github_com_gogo_protobuf_sortkeys.Int32s(keysForScrs) + mapStringForScrs := "map[int32]*SmartContractResults{" + for _, k := range keysForScrs { + mapStringForScrs += fmt.Sprintf("%v: %v,", k, this.Scrs[k]) + } + mapStringForScrs += "}" + s := strings.Join([]string{`&ScheduledSCRs{`, + `RootHash:` + fmt.Sprintf("%v", this.RootHash) + `,`, + `Scrs:` + mapStringForScrs + `,`, + `}`, + }, "") + return s +} func valueToStringScheduled(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -260,6 +459,93 @@ func valueToStringScheduled(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } +func (m *SmartContractResults) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SmartContractResults: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SmartContractResults: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHandlers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHandlers = append(m.TxHandlers, &smartContractResult.SmartContractResult{}) + if err := m.TxHandlers[len(m.TxHandlers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipScheduled(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -290,10 +576,10 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockType", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootHash", wireType) } - m.BlockType = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowScheduled @@ -303,14 +589,27 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockType |= int32(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RootHash = append(m.RootHash, make([]byte, postIndex-iNdEx)) + copy(m.RootHash[len(m.RootHash)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHandlers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Scrs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -337,10 +636,91 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxHandlers = append(m.TxHandlers, smartContractResult.SmartContractResult{}) - if err := m.TxHandlers[len(m.TxHandlers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.Scrs == nil { + m.Scrs = make(map[int32]*SmartContractResults) + } + var mapkey int32 + var mapvalue *SmartContractResults + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthScheduled + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthScheduled + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &SmartContractResults{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipScheduled(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } + m.Scrs[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index 3eb4bb3f3..cae991b40 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -9,8 +9,10 @@ option (gogoproto.stable_marshaler_all) = true; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult/smartContractResult.proto"; -// ScheduledSCRs holds information about scheduled SCRs per block type -message ScheduledSCRs { - int32 BlockType = 1; - repeated SmartContractResult TxHandlers = 2 [(gogoproto.nullable) = false]; +message SmartContractResults { + repeated SmartContractResult TxHandlers = 1; } +message ScheduledSCRs { + repeated bytes rootHash = 1; + map scrs = 2; +} \ No newline at end of file From b44ee432f43c0b6a16df4b7a85d98b6ffdf846dd Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 18 Aug 2021 15:43:42 +0300 Subject: [PATCH 15/32] add newline at eof --- data/scheduled/scheduled.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index cae991b40..da799dbb1 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -15,4 +15,4 @@ message SmartContractResults { message ScheduledSCRs { repeated bytes rootHash = 1; map scrs = 2; -} \ No newline at end of file +} From df265e71f42335e7f5a7c7647b90145134d12ecb Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 18 Aug 2021 15:45:19 +0300 Subject: [PATCH 16/32] data: scheduled scrs set nullable false --- data/scheduled/scheduled.pb.go | 64 ++++++++++++++++++---------------- data/scheduled/scheduled.proto | 2 +- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go index f108c3857..638a5bea8 100644 --- a/data/scheduled/scheduled.pb.go +++ b/data/scheduled/scheduled.pb.go @@ -29,7 +29,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type SmartContractResults struct { - TxHandlers []*smartContractResult.SmartContractResult `protobuf:"bytes,1,rep,name=TxHandlers,proto3" json:"TxHandlers,omitempty"` + TxHandlers []smartContractResult.SmartContractResult `protobuf:"bytes,1,rep,name=TxHandlers,proto3" json:"TxHandlers"` } func (m *SmartContractResults) Reset() { *m = SmartContractResults{} } @@ -60,7 +60,7 @@ func (m *SmartContractResults) XXX_DiscardUnknown() { var xxx_messageInfo_SmartContractResults proto.InternalMessageInfo -func (m *SmartContractResults) GetTxHandlers() []*smartContractResult.SmartContractResult { +func (m *SmartContractResults) GetTxHandlers() []smartContractResult.SmartContractResult { if m != nil { return m.TxHandlers } @@ -123,29 +123,29 @@ func init() { func init() { proto.RegisterFile("scheduled.proto", fileDescriptor_f80076f37bd30c16) } var fileDescriptor_f80076f37bd30c16 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x6e, 0xea, 0x30, - 0x14, 0xce, 0x81, 0xcb, 0xd5, 0xc5, 0xdc, 0xab, 0x5b, 0x45, 0x1d, 0xa2, 0x54, 0x3a, 0x42, 0x4c, - 0x2c, 0x24, 0x2a, 0x5d, 0x2a, 0xc6, 0x22, 0x24, 0xa6, 0x0e, 0x0e, 0x13, 0x9b, 0x49, 0xdc, 0x50, - 0x11, 0xe2, 0xca, 0x76, 0xda, 0xb2, 0xf5, 0x11, 0xfa, 0x18, 0x7d, 0x81, 0xbe, 0x43, 0x47, 0x46, - 0xc6, 0x62, 0x96, 0x8e, 0x3c, 0x42, 0x55, 0x47, 0x20, 0xa4, 0xd2, 0xc9, 0xe7, 0xfb, 0xfc, 0xfd, - 0xd8, 0x3a, 0xe4, 0xbf, 0x8a, 0xa7, 0x3c, 0x29, 0x32, 0x9e, 0x04, 0x77, 0x52, 0x68, 0xe1, 0xd6, - 0xec, 0xe1, 0x77, 0xd2, 0x5b, 0x3d, 0x2d, 0x26, 0x41, 0x2c, 0xe6, 0x61, 0x2a, 0x52, 0x11, 0x5a, - 0x7a, 0x52, 0xdc, 0x58, 0x64, 0x81, 0x9d, 0x4a, 0x97, 0x3f, 0x3e, 0x90, 0x0f, 0x32, 0x29, 0xf2, - 0xe4, 0x9a, 0xeb, 0x07, 0x21, 0x67, 0x21, 0xb7, 0xa8, 0x93, 0x8a, 0x4e, 0x2c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, 0xbf, 0xe8, 0xc9, 0x6f, 0xdb, 0x75, 0xf1, 0x19, 0x00, 0x00, 0xff, 0xff, 0x16, 0x5d, - 0xde, 0x8c, 0xfc, 0x01, 0x00, 0x00, + // 352 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4e, 0xf2, 0x40, + 0x14, 0xc5, 0x7b, 0xf9, 0xf3, 0xe5, 0x63, 0xd0, 0x68, 0x1a, 0x17, 0x4d, 0x4d, 0xae, 0x84, 0x15, + 0x1b, 0xda, 0x88, 0x1b, 0xe3, 0xca, 0x40, 0x48, 0x58, 0xb9, 0x68, 0x59, 0x18, 0x76, 0xa5, 0x1d, + 0x8b, 0xa1, 0x74, 0xcc, 0xcc, 0x54, 0x65, 0xe7, 0x23, 0xf8, 0x18, 0xbe, 0x80, 0xef, 0xc0, 0x92, + 0x25, 0x2b, 0x23, 0xc3, 0xc6, 0x25, 0x8f, 0x60, 0x9c, 0x06, 0x42, 0x22, 0xae, 0x7a, 0xcf, 0xe9, + 0xf9, 0xdd, 0x33, 0x93, 0x21, 0x47, 0x22, 0x1c, 0xd1, 0x28, 0x4b, 0x68, 0xe4, 0x3c, 0x70, 0x26, + 0x99, 0x59, 0xd6, 0x1f, 0xbb, 0x19, 0xdf, 0xcb, 0x51, 0x36, 0x74, 0x42, 0x36, 0x71, 0x63, 0x16, + 0x33, 0x57, 0xdb, 0xc3, 0xec, 0x4e, 0x2b, 0x2d, 0xf4, 0x94, 0x53, 0xf6, 0x60, 0x27, 0xde, 0x4d, + 0x38, 0x4b, 0xa3, 0x1b, 0x2a, 0x9f, 0x18, 0x1f, 0xbb, 0x54, 0xab, 0x66, 0xcc, 0x9a, 0x21, 0xe3, + 0xd4, 0x8d, 0x02, 0x19, 0xb8, 0x62, 0x12, 0x70, 0xd9, 0x61, 0xa9, 0xe4, 0x41, 0x28, 0x3d, 0x2a, + 0xb2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xff, 0xff, 0x85, 0x34, 0x09, 0x23, 0x02, 0x02, 0x00, 0x00, } func (this *SmartContractResults) Equal(that interface{}) bool { @@ -171,7 +171,7 @@ func (this *SmartContractResults) Equal(that interface{}) bool { return false } for i := range this.TxHandlers { - if !this.TxHandlers[i].Equal(that1.TxHandlers[i]) { + if !this.TxHandlers[i].Equal(&that1.TxHandlers[i]) { return false } } @@ -221,7 +221,11 @@ func (this *SmartContractResults) GoString() string { s := make([]string, 0, 5) s = append(s, "&scheduled.SmartContractResults{") if this.TxHandlers != nil { - s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", this.TxHandlers)+",\n") + vs := make([]smartContractResult.SmartContractResult, len(this.TxHandlers)) + for i := range vs { + vs[i] = this.TxHandlers[i] + } + s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", vs)+",\n") } s = append(s, "}") return strings.Join(s, "") @@ -419,9 +423,9 @@ func (this *SmartContractResults) String() string { if this == nil { return "nil" } - repeatedStringForTxHandlers := "[]*SmartContractResult{" + repeatedStringForTxHandlers := "[]SmartContractResult{" for _, f := range this.TxHandlers { - repeatedStringForTxHandlers += strings.Replace(fmt.Sprintf("%v", f), "SmartContractResult", "smartContractResult.SmartContractResult", 1) + "," + repeatedStringForTxHandlers += fmt.Sprintf("%v", f) + "," } repeatedStringForTxHandlers += "}" s := strings.Join([]string{`&SmartContractResults{`, @@ -517,7 +521,7 @@ func (m *SmartContractResults) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxHandlers = append(m.TxHandlers, &smartContractResult.SmartContractResult{}) + m.TxHandlers = append(m.TxHandlers, smartContractResult.SmartContractResult{}) if err := m.TxHandlers[len(m.TxHandlers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index da799dbb1..8aff1a05b 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -10,7 +10,7 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult/smartContractResult.proto"; message SmartContractResults { - repeated SmartContractResult TxHandlers = 1; + repeated SmartContractResult TxHandlers = 1 [(gogoproto.nullable) = false]; } message ScheduledSCRs { repeated bytes rootHash = 1; From bc95ecd52addab79502ae5f4317c5e402267a57f Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 18 Aug 2021 15:51:53 +0300 Subject: [PATCH 17/32] data: fix rootHash proto type for scheduled scrs --- data/scheduled/scheduled.pb.go | 47 +++++++++++++++------------------- data/scheduled/scheduled.proto | 2 +- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go index 638a5bea8..5f5a39dab 100644 --- a/data/scheduled/scheduled.pb.go +++ b/data/scheduled/scheduled.pb.go @@ -68,7 +68,7 @@ func (m *SmartContractResults) GetTxHandlers() []smartContractResult.SmartContra } type ScheduledSCRs struct { - RootHash [][]byte `protobuf:"bytes,1,rep,name=rootHash,proto3" json:"rootHash,omitempty"` + RootHash []byte `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` Scrs map[int32]*SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -100,7 +100,7 @@ func (m *ScheduledSCRs) XXX_DiscardUnknown() { var xxx_messageInfo_ScheduledSCRs proto.InternalMessageInfo -func (m *ScheduledSCRs) GetRootHash() [][]byte { +func (m *ScheduledSCRs) GetRootHash() []byte { if m != nil { return m.RootHash } @@ -137,15 +137,15 @@ var fileDescriptor_f80076f37bd30c16 = []byte{ 0xb2, 0x44, 0xee, 0xf3, 0xf2, 0xdd, 0xf5, 0x5b, 0x72, 0xe2, 0xff, 0xfe, 0x29, 0xcc, 0x6b, 0x42, 0xfa, 0xcf, 0xbd, 0x20, 0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, 0x2f, 0x11, 0x5e, 0x14, 0xc2, 0x9b, 0x42, 0x98, 0x29, 0x84, 0xb9, 0x42, 0x58, 0x28, 0x84, 0x4f, 0x85, 0xf0, 0xa5, 0xd0, 0x58, 0x2b, 0x84, 0xd7, 0x15, 0x1a, 0xf3, 0x15, 0x1a, 0x8b, 0x15, 0x1a, 0x83, 0xca, 0xf6, 0xb9, 0x87, 0xff, 0x74, - 0xd7, 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x85, 0x34, 0x09, 0x23, 0x02, 0x02, 0x00, 0x00, + 0xd7, 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xac, 0x0b, 0x9f, 0xe6, 0x02, 0x02, 0x00, 0x00, } func (this *SmartContractResults) Equal(that interface{}) bool { @@ -196,14 +196,9 @@ func (this *ScheduledSCRs) Equal(that interface{}) bool { } else if this == nil { return false } - if len(this.RootHash) != len(that1.RootHash) { + if !bytes.Equal(this.RootHash, that1.RootHash) { return false } - for i := range this.RootHash { - if !bytes.Equal(this.RootHash[i], that1.RootHash[i]) { - return false - } - } if len(this.Scrs) != len(that1.Scrs) { return false } @@ -348,13 +343,11 @@ func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if len(m.RootHash) > 0 { - for iNdEx := len(m.RootHash) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RootHash[iNdEx]) - copy(dAtA[i:], m.RootHash[iNdEx]) - i = encodeVarintScheduled(dAtA, i, uint64(len(m.RootHash[iNdEx]))) - i-- - dAtA[i] = 0xa - } + i -= len(m.RootHash) + copy(dAtA[i:], m.RootHash) + i = encodeVarintScheduled(dAtA, i, uint64(len(m.RootHash))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -391,11 +384,9 @@ func (m *ScheduledSCRs) Size() (n int) { } var l int _ = l - if len(m.RootHash) > 0 { - for _, b := range m.RootHash { - l = len(b) - n += 1 + l + sovScheduled(uint64(l)) - } + l = len(m.RootHash) + if l > 0 { + n += 1 + l + sovScheduled(uint64(l)) } if len(m.Scrs) > 0 { for k, v := range m.Scrs { @@ -608,8 +599,10 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RootHash = append(m.RootHash, make([]byte, postIndex-iNdEx)) - copy(m.RootHash[len(m.RootHash)-1], dAtA[iNdEx:postIndex]) + m.RootHash = append(m.RootHash[:0], dAtA[iNdEx:postIndex]...) + if m.RootHash == nil { + m.RootHash = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index 8aff1a05b..cb98afce9 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -13,6 +13,6 @@ message SmartContractResults { repeated SmartContractResult TxHandlers = 1 [(gogoproto.nullable) = false]; } message ScheduledSCRs { - repeated bytes rootHash = 1; + bytes rootHash = 1; map scrs = 2; } From 29caba40f5982c0901ffcf4c866ed3560678a63d Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 18 Aug 2021 17:58:32 +0300 Subject: [PATCH 18/32] data: scheduled scrs adapters for transaction handlers, fixes and unit tests --- data/scheduled/scheduled.go | 63 +++++++++++++++ data/scheduled/scheduled.pb.go | 112 ++++++++++++-------------- data/scheduled/scheduled.proto | 4 +- data/scheduled/scheduled_test.go | 131 +++++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+), 62 deletions(-) create mode 100644 data/scheduled/scheduled_test.go diff --git a/data/scheduled/scheduled.go b/data/scheduled/scheduled.go index bd1b53a24..e37e83359 100644 --- a/data/scheduled/scheduled.go +++ b/data/scheduled/scheduled.go @@ -1,2 +1,65 @@ //go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. scheduled.proto package scheduled + +import ( + "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/block" + "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult" +) + +// GetTransactionHandlersMap returns the smart contract results as a map of transaction handlers +func (sscr *ScheduledSCRs) GetTransactionHandlersMap() map[block.Type][]data.TransactionHandler { + if sscr == nil { + return nil + } + if len(sscr.Scrs) == 0 { + return nil + } + + result := make(map[block.Type][]data.TransactionHandler) + for i, scrs := range sscr.Scrs { + if len(scrs.TxHandlers) == 0 { + result[block.Type(i)] = nil + continue + } + transactionHandlers := make([]data.TransactionHandler, len(scrs.TxHandlers)) + for j := range scrs.TxHandlers { + transactionHandlers[j] = scrs.TxHandlers[j] + } + result[block.Type(i)] = transactionHandlers + } + + return result +} + +// SetTransactionHandlersMap fills the smart contract results map from the given transaction handlers map +func (sscr *ScheduledSCRs) SetTransactionHandlersMap(txHandlersMap map[block.Type][]data.TransactionHandler) error { + if sscr == nil { + return data.ErrNilPointerReceiver + } + if txHandlersMap == nil { + sscr.Scrs = nil + return nil + } + + sscr.Scrs = make(map[int32]SmartContractResults) + for i, txHandlers := range txHandlersMap { + if len(txHandlers) == 0 { + sscr.Scrs[int32(i)] = SmartContractResults{} + continue + } + scrs := make([]*smartContractResult.SmartContractResult, len(txHandlersMap[i])) + for j := range txHandlers { + scr, ok := txHandlers[j].(*smartContractResult.SmartContractResult) + if !ok { + return data.ErrInvalidTypeAssertion + } + scrs[j] = scr + } + sscr.Scrs[int32(i)] = SmartContractResults{ + TxHandlers: scrs, + } + } + + return nil +} diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go index 5f5a39dab..995a21b00 100644 --- a/data/scheduled/scheduled.pb.go +++ b/data/scheduled/scheduled.pb.go @@ -29,7 +29,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type SmartContractResults struct { - TxHandlers []smartContractResult.SmartContractResult `protobuf:"bytes,1,rep,name=TxHandlers,proto3" json:"TxHandlers"` + TxHandlers []*smartContractResult.SmartContractResult `protobuf:"bytes,1,rep,name=TxHandlers,proto3" json:"TxHandlers,omitempty"` } func (m *SmartContractResults) Reset() { *m = SmartContractResults{} } @@ -60,7 +60,7 @@ func (m *SmartContractResults) XXX_DiscardUnknown() { var xxx_messageInfo_SmartContractResults proto.InternalMessageInfo -func (m *SmartContractResults) GetTxHandlers() []smartContractResult.SmartContractResult { +func (m *SmartContractResults) GetTxHandlers() []*smartContractResult.SmartContractResult { if m != nil { return m.TxHandlers } @@ -68,8 +68,8 @@ func (m *SmartContractResults) GetTxHandlers() []smartContractResult.SmartContra } type ScheduledSCRs struct { - RootHash []byte `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` - Scrs map[int32]*SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RootHash []byte `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` + Scrs map[int32]SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *ScheduledSCRs) Reset() { *m = ScheduledSCRs{} } @@ -107,7 +107,7 @@ func (m *ScheduledSCRs) GetRootHash() []byte { return nil } -func (m *ScheduledSCRs) GetScrs() map[int32]*SmartContractResults { +func (m *ScheduledSCRs) GetScrs() map[int32]SmartContractResults { if m != nil { return m.Scrs } @@ -117,35 +117,35 @@ func (m *ScheduledSCRs) GetScrs() map[int32]*SmartContractResults { func init() { proto.RegisterType((*SmartContractResults)(nil), "proto.SmartContractResults") proto.RegisterType((*ScheduledSCRs)(nil), "proto.ScheduledSCRs") - proto.RegisterMapType((map[int32]*SmartContractResults)(nil), "proto.ScheduledSCRs.ScrsEntry") + proto.RegisterMapType((map[int32]SmartContractResults)(nil), "proto.ScheduledSCRs.ScrsEntry") } func init() { proto.RegisterFile("scheduled.proto", fileDescriptor_f80076f37bd30c16) } var fileDescriptor_f80076f37bd30c16 = []byte{ - // 352 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4e, 0xf2, 0x40, - 0x14, 0xc5, 0x7b, 0xf9, 0xf3, 0xe5, 0x63, 0xd0, 0x68, 0x1a, 0x17, 0x4d, 0x4d, 0xae, 0x84, 0x15, - 0x1b, 0xda, 0x88, 0x1b, 0xe3, 0xca, 0x40, 0x48, 0x58, 0xb9, 0x68, 0x59, 0x18, 0x76, 0xa5, 0x1d, - 0x8b, 0xa1, 0x74, 0xcc, 0xcc, 0x54, 0x65, 0xe7, 0x23, 0xf8, 0x18, 0xbe, 0x80, 0xef, 0xc0, 0x92, - 0x25, 0x2b, 0x23, 0xc3, 0xc6, 0x25, 0x8f, 0x60, 0x9c, 0x06, 0x42, 0x22, 0xae, 0x7a, 0xcf, 0xe9, - 0xf9, 0xdd, 0x33, 0x93, 0x21, 0x47, 0x22, 0x1c, 0xd1, 0x28, 0x4b, 0x68, 0xe4, 0x3c, 0x70, 0x26, - 0x99, 0x59, 0xd6, 0x1f, 0xbb, 0x19, 0xdf, 0xcb, 0x51, 0x36, 0x74, 0x42, 0x36, 0x71, 0x63, 0x16, - 0x33, 0x57, 0xdb, 0xc3, 0xec, 0x4e, 0x2b, 0x2d, 0xf4, 0x94, 0x53, 0xf6, 0x60, 0x27, 0xde, 0x4d, - 0x38, 0x4b, 0xa3, 0x1b, 0x2a, 0x9f, 0x18, 0x1f, 0xbb, 0x54, 0xab, 0x66, 0xcc, 0x9a, 0x21, 0xe3, - 0xd4, 0x8d, 0x02, 0x19, 0xb8, 0x62, 0x12, 0x70, 0xd9, 0x61, 0xa9, 0xe4, 0x41, 0x28, 0x3d, 0x2a, - 0xb2, 0x44, 0xee, 0xf3, 0xf2, 0xdd, 0xf5, 0x5b, 0x72, 0xe2, 0xff, 0xfe, 0x29, 0xcc, 0x6b, 0x42, - 0xfa, 0xcf, 0xbd, 0x20, 0x8d, 0x12, 0xca, 0x85, 0x05, 0xb5, 0x62, 0xa3, 0xda, 0xb2, 0x73, 0xc6, - 0xd9, 0x03, 0xb4, 0x4b, 0xb3, 0x8f, 0x33, 0xc3, 0xdb, 0x61, 0xea, 0xef, 0x40, 0x0e, 0xfd, 0xcd, - 0xfd, 0xfd, 0x8e, 0x27, 0x4c, 0x9b, 0xfc, 0xe7, 0x8c, 0xc9, 0x5e, 0x20, 0x46, 0x16, 0xd4, 0xa0, - 0x71, 0xe0, 0x6d, 0xb5, 0xd9, 0x22, 0x25, 0x11, 0x72, 0x61, 0x15, 0x74, 0x13, 0x6e, 0x9a, 0x76, - 0x79, 0xc7, 0x0f, 0xb9, 0xe8, 0xa6, 0x92, 0x4f, 0x3d, 0x9d, 0xb5, 0xfb, 0xa4, 0xb2, 0xb5, 0xcc, - 0x63, 0x52, 0x1c, 0xd3, 0xa9, 0xde, 0x5b, 0xf6, 0x7e, 0x46, 0xf3, 0x9c, 0x94, 0x1f, 0x83, 0x24, - 0xa3, 0x56, 0xa1, 0x06, 0x8d, 0x6a, 0xeb, 0xf4, 0xef, 0xd3, 0x0b, 0x2f, 0x4f, 0x5e, 0x15, 0x2e, - 0xa1, 0xdd, 0x99, 0x2f, 0xd1, 0x58, 0x2c, 0xd1, 0x58, 0x2f, 0x11, 0x5e, 0x14, 0xc2, 0x9b, 0x42, - 0x98, 0x29, 0x84, 0xb9, 0x42, 0x58, 0x28, 0x84, 0x4f, 0x85, 0xf0, 0xa5, 0xd0, 0x58, 0x2b, 0x84, - 0xd7, 0x15, 0x1a, 0xf3, 0x15, 0x1a, 0x8b, 0x15, 0x1a, 0x83, 0xca, 0xf6, 0xb9, 0x87, 0xff, 0x74, - 0xd7, 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xac, 0x0b, 0x9f, 0xe6, 0x02, 0x02, 0x00, 0x00, + // 350 bytes of a gzipped FileDescriptorProto + 0x1f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2b, 0x36, 0xaa, 0x2d, 0x37, 0x67, 0xbc, 0x23, 0x00, + 0x39, 0x70, 0xd7, 0xdf, 0x11, 0x3e, 0x0d, 0x76, 0x2f, 0x0f, 0x7a, 0x44, 0xda, 0x2e, 0xfe, 0x2f, + 0x38, 0x57, 0x03, 0x2a, 0x27, 0x0e, 0xaa, 0xa1, 0xc6, 0x09, 0xd9, 0x6b, 0xbb, 0x8d, 0x4b, 0x32, + 0x14, 0xd2, 0x29, 0x98, 0x0c, 0xd8, 0x65, 0x1c, 0xf2, 0x5e, 0x10, 0x0a, 0xd9, 0x4f, 0x95, 0x98, + 0x77, 0x4b, 0x8b, 0x8f, 0x2b, 0x8b, 0x18, 0xc2, 0x1d, 0xe2, 0xca, 0x7e, 0x60, 0x9f, 0xe3, 0xe2, + 0x94, 0xcd, 0xcd, 0xf6, 0x32, 0xf9, 0x29, 0xed, 0x6b, 0x5c, 0x7e, 0xa4, 0x49, 0xc6, 0x9c, 0x42, + 0x0d, 0x35, 0xaa, 0xad, 0xcb, 0xbf, 0x6f, 0x2f, 0x49, 0xee, 0xec, 0x14, 0xda, 0xa8, 0xdb, 0x5b, + 0xae, 0xc1, 0x5a, 0xad, 0xc1, 0xda, 0xae, 0x01, 0xbd, 0x68, 0x40, 0x6f, 0x1a, 0xd0, 0x42, 0x03, + 0x5a, 0x6a, 0x40, 0x2b, 0x0d, 0xe8, 0x53, 0x03, 0xfa, 0xd2, 0x60, 0x6d, 0x35, 0xa0, 0xd7, 0x0d, + 0x58, 0xcb, 0x0d, 0x58, 0xab, 0x0d, 0x58, 0xa3, 0xca, 0xfe, 0xbb, 0xc7, 0xff, 0x4c, 0xd6, 0xcd, + 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x06, 0x1a, 0x9f, 0x5d, 0x02, 0x02, 0x00, 0x00, } func (this *SmartContractResults) Equal(that interface{}) bool { @@ -171,7 +171,7 @@ func (this *SmartContractResults) Equal(that interface{}) bool { return false } for i := range this.TxHandlers { - if !this.TxHandlers[i].Equal(&that1.TxHandlers[i]) { + if !this.TxHandlers[i].Equal(that1.TxHandlers[i]) { return false } } @@ -203,7 +203,9 @@ func (this *ScheduledSCRs) Equal(that interface{}) bool { return false } for i := range this.Scrs { - if !this.Scrs[i].Equal(that1.Scrs[i]) { + a := this.Scrs[i] + b := that1.Scrs[i] + if !(&a).Equal(&b) { return false } } @@ -216,11 +218,7 @@ func (this *SmartContractResults) GoString() string { s := make([]string, 0, 5) s = append(s, "&scheduled.SmartContractResults{") if this.TxHandlers != nil { - vs := make([]smartContractResult.SmartContractResult, len(this.TxHandlers)) - for i := range vs { - vs[i] = this.TxHandlers[i] - } - s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", vs)+",\n") + s = append(s, "TxHandlers: "+fmt.Sprintf("%#v", this.TxHandlers)+",\n") } s = append(s, "}") return strings.Join(s, "") @@ -237,7 +235,7 @@ func (this *ScheduledSCRs) GoString() string { keysForScrs = append(keysForScrs, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForScrs) - mapStringForScrs := "map[int32]*SmartContractResults{" + mapStringForScrs := "map[int32]SmartContractResults{" for _, k := range keysForScrs { mapStringForScrs += fmt.Sprintf("%#v: %#v,", k, this.Scrs[k]) } @@ -322,18 +320,16 @@ func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(keysForScrs) - 1; iNdEx >= 0; iNdEx-- { v := m.Scrs[int32(keysForScrs[iNdEx])] baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintScheduled(dAtA, i, uint64(size)) + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintScheduled(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 i = encodeVarintScheduled(dAtA, i, uint64(keysForScrs[iNdEx])) i-- dAtA[i] = 0x8 @@ -392,12 +388,8 @@ func (m *ScheduledSCRs) Size() (n int) { for k, v := range m.Scrs { _ = k _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovScheduled(uint64(l)) - } - mapEntrySize := 1 + sovScheduled(uint64(k)) + l + l = v.Size() + mapEntrySize := 1 + sovScheduled(uint64(k)) + 1 + l + sovScheduled(uint64(l)) n += mapEntrySize + 1 + sovScheduled(uint64(mapEntrySize)) } } @@ -414,9 +406,9 @@ func (this *SmartContractResults) String() string { if this == nil { return "nil" } - repeatedStringForTxHandlers := "[]SmartContractResult{" + repeatedStringForTxHandlers := "[]*SmartContractResult{" for _, f := range this.TxHandlers { - repeatedStringForTxHandlers += fmt.Sprintf("%v", f) + "," + repeatedStringForTxHandlers += strings.Replace(fmt.Sprintf("%v", f), "SmartContractResult", "smartContractResult.SmartContractResult", 1) + "," } repeatedStringForTxHandlers += "}" s := strings.Join([]string{`&SmartContractResults{`, @@ -434,7 +426,7 @@ func (this *ScheduledSCRs) String() string { keysForScrs = append(keysForScrs, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForScrs) - mapStringForScrs := "map[int32]*SmartContractResults{" + mapStringForScrs := "map[int32]SmartContractResults{" for _, k := range keysForScrs { mapStringForScrs += fmt.Sprintf("%v: %v,", k, this.Scrs[k]) } @@ -512,7 +504,7 @@ func (m *SmartContractResults) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxHandlers = append(m.TxHandlers, smartContractResult.SmartContractResult{}) + m.TxHandlers = append(m.TxHandlers, &smartContractResult.SmartContractResult{}) if err := m.TxHandlers[len(m.TxHandlers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -634,10 +626,10 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Scrs == nil { - m.Scrs = make(map[int32]*SmartContractResults) + m.Scrs = make(map[int32]SmartContractResults) } var mapkey int32 - var mapvalue *SmartContractResults + mapvalue := &SmartContractResults{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -717,7 +709,7 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Scrs[mapkey] = mapvalue + m.Scrs[mapkey] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index cb98afce9..a8b391de2 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -10,9 +10,9 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult/smartContractResult.proto"; message SmartContractResults { - repeated SmartContractResult TxHandlers = 1 [(gogoproto.nullable) = false]; + repeated SmartContractResult TxHandlers = 1; } message ScheduledSCRs { bytes rootHash = 1; - map scrs = 2; + map scrs = 2 [(gogoproto.nullable) = false]; } diff --git a/data/scheduled/scheduled_test.go b/data/scheduled/scheduled_test.go new file mode 100644 index 000000000..d98842709 --- /dev/null +++ b/data/scheduled/scheduled_test.go @@ -0,0 +1,131 @@ +package scheduled_test + +import ( + "testing" + + "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/ElrondNetwork/elrond-go-core/data/block" + "github.com/ElrondNetwork/elrond-go-core/data/scheduled" + "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult" + "github.com/stretchr/testify/require" +) + +func TestScheduledSCRs_GetTransactionHandlersMapNilSCRsList(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + Scrs: createInitializedSCRsMap(20), + } + scheduledSCRs.Scrs[int32(block.TxBlock)] = scheduled.SmartContractResults{ + TxHandlers: nil, + } + + expectedTxHandlersMap := createInitializedTransactionHandlerMap(20) + expectedTxHandlersMap[block.TxBlock] = nil + txHandlersMap := scheduledSCRs.GetTransactionHandlersMap() + require.NotNil(t, txHandlersMap) + require.Equal(t, expectedTxHandlersMap, txHandlersMap) +} + +func TestScheduledSCRs_GetTransactionHandlersMapNilSCRsMap(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + Scrs: nil, + } + + txHandlersMap := scheduledSCRs.GetTransactionHandlersMap() + require.Nil(t, txHandlersMap) +} + +func TestScheduledSCRs_GetTransactionHandlersMapOK(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + Scrs: createInitializedSCRsMap(20), + } + + expectedTxHandlersMap := createInitializedTransactionHandlerMap(20) + txHandlersMap := scheduledSCRs.GetTransactionHandlersMap() + require.NotNil(t, txHandlersMap) + require.Equal(t, expectedTxHandlersMap, txHandlersMap) +} + +func TestScheduledSCRs_SetTransactionHandlersMapNilSCRsMap(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + } + expectedScheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + } + err := scheduledSCRs.SetTransactionHandlersMap(nil) + require.Nil(t, err) + require.Equal(t, scheduledSCRs, expectedScheduledSCRs) +} + +func TestScheduledSCRs_SetTransactionHandlersMapNilSCRsList(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + } + expectedScheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + } + expectedScheduledSCRs.Scrs = createInitializedSCRsMap(20) + expectedScheduledSCRs.Scrs[int32(block.TxBlock)] = scheduled.SmartContractResults{TxHandlers: nil} + + txHandlersMap := createInitializedTransactionHandlerMap(20) + txHandlersMap[block.TxBlock] = nil + + err := scheduledSCRs.SetTransactionHandlersMap(txHandlersMap) + require.Nil(t, err) + require.Equal(t, scheduledSCRs, expectedScheduledSCRs) +} + +func TestScheduledSCRs_SetTransactionHandlersMapOK(t *testing.T) { + scheduledSCRs := &scheduled.ScheduledSCRs{ + RootHash: []byte("root hash"), + Scrs: createInitializedSCRsMap(20), + } + + expectedTxHandlersMap := createInitializedTransactionHandlerMap(20) + actualTxHandlersMap := scheduledSCRs.GetTransactionHandlersMap() + require.NotNil(t, actualTxHandlersMap) + require.Equal(t, actualTxHandlersMap, expectedTxHandlersMap) +} + +func createInitializedTransactionHandlerMap(nbTxsPerIndex int) map[block.Type][]data.TransactionHandler { + result := make(map[block.Type][]data.TransactionHandler) + result[block.TxBlock] = createInitializedTransactionHandlerArray(nbTxsPerIndex) + result[block.RewardsBlock] = createInitializedTransactionHandlerArray(nbTxsPerIndex) + + return result +} + +func createInitializedSCRsMap(nbSCRsPerIndex int) map[int32]scheduled.SmartContractResults { + result := make(map[int32]scheduled.SmartContractResults) + result[int32(block.TxBlock)] = scheduled.SmartContractResults{ + TxHandlers: createInitializedSCRPointerArray(nbSCRsPerIndex), + } + result[int32(block.RewardsBlock)] = scheduled.SmartContractResults{ + TxHandlers: createInitializedSCRPointerArray(nbSCRsPerIndex), + } + + return result +} + +func createInitializedTransactionHandlerArray(nbTxs int) []data.TransactionHandler { + result := make([]data.TransactionHandler, nbTxs) + for i := 0; i < nbTxs; i++ { + result[i] = &smartContractResult.SmartContractResult{ + Nonce: uint64(i), + } + } + return result +} + +func createInitializedSCRPointerArray(nbSCRs int) []*smartContractResult.SmartContractResult { + result := make([]*smartContractResult.SmartContractResult, nbSCRs) + for i := 0; i < nbSCRs; i++ { + result[i] = &smartContractResult.SmartContractResult{ + Nonce: uint64(i), + } + } + return result +} From 9ac59d75cdd03c0c62029df33ca227bc0c582e27 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Thu, 19 Aug 2021 11:38:28 +0300 Subject: [PATCH 19/32] data: fix after review --- data/scheduled/scheduled.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/scheduled/scheduled.go b/data/scheduled/scheduled.go index e37e83359..c7f1303bb 100644 --- a/data/scheduled/scheduled.go +++ b/data/scheduled/scheduled.go @@ -48,7 +48,7 @@ func (sscr *ScheduledSCRs) SetTransactionHandlersMap(txHandlersMap map[block.Typ sscr.Scrs[int32(i)] = SmartContractResults{} continue } - scrs := make([]*smartContractResult.SmartContractResult, len(txHandlersMap[i])) + scrs := make([]*smartContractResult.SmartContractResult, len(txHandlers)) for j := range txHandlers { scr, ok := txHandlers[j].(*smartContractResult.SmartContractResult) if !ok { From 0414fbf86a904a496f7f78be3af9d1c8ecf1a0c6 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Tue, 7 Sep 2021 16:29:59 +0300 Subject: [PATCH 20/32] data: create a miniblock reserved field structure and add scheduled root hash on epoch start shard data --- data/block/block.go | 40 +++- data/block/block.pb.go | 147 +++++++----- data/block/block.proto | 6 +- data/block/blockV2.pb.go | 273 ++++++++++++++++++++++- data/block/blockV2.proto | 5 + data/block/epochStartShardDataHandler.go | 11 + data/block/metaBlock.pb.go | 222 +++++++++++------- data/block/metaBlock.proto | 1 + 8 files changed, 555 insertions(+), 150 deletions(-) diff --git a/data/block/block.go b/data/block/block.go index 328ae419a..758334187 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -433,12 +433,50 @@ func (mb *MiniBlock) Clone() *MiniBlock { return newMb } +// GetMiniBlockReserved returns the unmarshalled reserved field for the miniblock +func (mb *MiniBlock) GetMiniBlockReserved() (*MiniBlockReserved, error) { + if len(mb.Reserved) > 0 { + mbr := &MiniBlockReserved{} + err := mbr.Unmarshal(mb.Reserved) + if err != nil { + return nil, err + } + + return mbr, nil + } + return nil, nil +} + +// SetMiniBlockReserved returns the unmarshalled reserved field for the miniblock +func (mb *MiniBlock) SetMiniBlockReserved(mbr *MiniBlockReserved) error { + if mbr == nil { + mb.Reserved = nil + return nil + } + + reserved, err := mbr.Marshal() + if err != nil { + return err + } + mb.Reserved = reserved + + return nil +} + // IsScheduledMiniBlock returns if the mini block is of type scheduled or not func (mb *MiniBlock) IsScheduledMiniBlock() bool { if mb == nil { return false } - return len(mb.Reserved) > 0 && mb.Reserved[0] == byte(ScheduledBlock) + if len(mb.Reserved) > 0 { + mbr := &MiniBlockReserved{} + err := mbr.Unmarshal(mb.Reserved) + if err != nil { + return false + } + return mbr.ExecutionType == Scheduled + } + return false } // SetAdditionalData sets the additional data for the header diff --git a/data/block/block.pb.go b/data/block/block.pb.go index f1e96afc1..eb9486ec8 100644 --- a/data/block/block.pb.go +++ b/data/block/block.pb.go @@ -39,7 +39,6 @@ const ( SmartContractResultBlock Type = 90 InvalidBlock Type = 120 ReceiptBlock Type = 150 - ScheduledBlock Type = 180 RewardsBlock Type = 255 ) @@ -50,7 +49,6 @@ var Type_name = map[int32]string{ 90: "SmartContractResultBlock", 120: "InvalidBlock", 150: "ReceiptBlock", - 180: "ScheduledBlock", 255: "RewardsBlock", } @@ -61,7 +59,6 @@ var Type_value = map[string]int32{ "SmartContractResultBlock": 90, "InvalidBlock": 120, "ReceiptBlock": 150, - "ScheduledBlock": 180, "RewardsBlock": 255, } @@ -69,6 +66,27 @@ func (Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor_8e550b1f5926e92d, []int{0} } +type ProcessingType int32 + +const ( + Normal ProcessingType = 0 + Scheduled ProcessingType = 1 +) + +var ProcessingType_name = map[int32]string{ + 0: "Normal", + 1: "Scheduled", +} + +var ProcessingType_value = map[string]int32{ + "Normal": 0, + "Scheduled": 1, +} + +func (ProcessingType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8e550b1f5926e92d, []int{1} +} + type MiniBlock struct { TxHashes [][]byte `protobuf:"bytes,1,rep,name=TxHashes,proto3" json:"TxHashes,omitempty"` ReceiverShardID uint32 `protobuf:"varint,2,opt,name=ReceiverShardID,proto3" json:"ReceiverShardID,omitempty"` @@ -581,6 +599,7 @@ func (m *BodyHeaderPair) GetHeader() []byte { func init() { proto.RegisterEnum("proto.Type", Type_name, Type_value) + proto.RegisterEnum("proto.ProcessingType", ProcessingType_name, ProcessingType_value) proto.RegisterType((*MiniBlock)(nil), "proto.MiniBlock") proto.RegisterType((*MiniBlockHeader)(nil), "proto.MiniBlockHeader") proto.RegisterType((*PeerChange)(nil), "proto.PeerChange") @@ -592,64 +611,65 @@ func init() { func init() { proto.RegisterFile("block.proto", fileDescriptor_8e550b1f5926e92d) } var fileDescriptor_8e550b1f5926e92d = []byte{ - // 900 bytes of a gzipped FileDescriptorProto + // 918 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x3d, 0x6f, 0x1b, 0x47, - 0x10, 0xe5, 0x4a, 0x24, 0x2d, 0x2d, 0x3f, 0x44, 0xad, 0x1d, 0xe5, 0x60, 0x18, 0x27, 0x82, 0x70, - 0x41, 0x04, 0x10, 0x99, 0x28, 0x4d, 0x82, 0x18, 0x08, 0x42, 0xca, 0x82, 0x98, 0xc4, 0x86, 0x70, - 0x27, 0xa4, 0x70, 0xb7, 0xbc, 0x1b, 0x93, 0x07, 0x93, 0xb7, 0xc4, 0xde, 0x1e, 0x25, 0x75, 0xfe, - 0x09, 0xa9, 0xd2, 0xa5, 0x0f, 0x52, 0xfb, 0x47, 0xb8, 0x48, 0xa1, 0x52, 0x55, 0x12, 0x9d, 0x9a, - 0x94, 0xfe, 0x07, 0x09, 0x76, 0xf6, 0x8e, 0x1f, 0x27, 0x15, 0x29, 0x5c, 0x89, 0xef, 0xcd, 0xec, - 0xce, 0x9b, 0xd9, 0x77, 0x23, 0x5a, 0x19, 0x4e, 0x84, 0xf7, 0xa6, 0x33, 0x93, 0x42, 0x09, 0x56, - 0xc2, 0x3f, 0x8f, 0x0f, 0x46, 0x81, 0x1a, 0xc7, 0xc3, 0x8e, 0x27, 0xa6, 0xdd, 0x91, 0x18, 0x89, - 0x2e, 0xd2, 0xc3, 0xf8, 0x35, 0x22, 0x04, 0xf8, 0xcb, 0x9c, 0x6a, 0xbd, 0x23, 0x74, 0xfb, 0x45, - 0x10, 0x06, 0x3d, 0x7d, 0x13, 0x7b, 0x4c, 0xb7, 0xce, 0x2e, 0x4e, 0x78, 0x34, 0x86, 0xc8, 0x22, - 0xcd, 0xcd, 0x76, 0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00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x2f, 0x1f, 0x60, - 0x75, 0x07, 0x00, 0x00, + 0x10, 0xe5, 0x4a, 0x24, 0x2d, 0x2d, 0x3f, 0x44, 0x6d, 0x1c, 0xe5, 0x60, 0x18, 0x27, 0x82, 0x70, + 0x41, 0x38, 0x10, 0x99, 0x28, 0x4d, 0x82, 0x18, 0x08, 0x42, 0xca, 0x82, 0x98, 0xc4, 0x02, 0x71, + 0x27, 0xa4, 0x70, 0xb7, 0xbc, 0x1b, 0x93, 0x07, 0x93, 0xb7, 0xc4, 0xde, 0x1e, 0x25, 0x75, 0x2e, + 0x53, 0xa6, 0xca, 0x6f, 0x08, 0x52, 0xe7, 0x47, 0xb8, 0x48, 0xa1, 0x52, 0x55, 0x12, 0x51, 0x4d, + 0x4a, 0xfd, 0x83, 0x04, 0x3b, 0x7b, 0xc7, 0x8f, 0x93, 0x8a, 0x14, 0xae, 0xc4, 0xf7, 0x66, 0x76, + 0xe7, 0xcd, 0xec, 0xbb, 0x11, 0x2d, 0x0d, 0xc6, 0xc2, 0x7b, 0xdb, 0x9a, 0x4a, 0xa1, 0x04, 0x2b, + 0xe0, 0x9f, 0x27, 0x07, 0xc3, 0x40, 0x8d, 0xe2, 0x41, 0xcb, 0x13, 0x93, 0xf6, 0x50, 0x0c, 0x45, + 0x1b, 0xe9, 0x41, 0xfc, 0x06, 0x11, 0x02, 0xfc, 0x65, 0x4e, 0x35, 0x7e, 0x27, 0x74, 0xfb, 0x55, + 0x10, 0x06, 0x1d, 0x7d, 0x13, 0x7b, 0x42, 0xb7, 0xce, 0x2e, 0x4e, 0x78, 0x34, 0x82, 0xc8, 0x22, + 0xf5, 0xcd, 0x66, 0xd9, 0x59, 0x60, 0xd6, 0xa4, 0x3b, 0x0e, 0x78, 0x10, 0xcc, 0x40, 0xba, 0x23, + 0x2e, 0xfd, 0xde, 0x91, 0xb5, 0x51, 0x27, 0xcd, 0x8a, 0x93, 0xa5, 0xd9, 0x33,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 0xec, 0x8f, 0x04, 0x3d, 0xff, 0x89, 0x98, 0x05, 0xc8, 0x4a, 0xda, 0x36, 0x78, 0x65, 0x2d, 0xc7, + 0xaa, 0x94, 0xba, 0x8a, 0x2b, 0x30, 0xd8, 0x66, 0x15, 0xba, 0xad, 0x8d, 0x6a, 0xe0, 0x0b, 0xf6, + 0x94, 0x5a, 0xee, 0x84, 0x4b, 0xd5, 0x15, 0xa1, 0x92, 0xdc, 0x53, 0x0e, 0x44, 0xf1, 0x58, 0x99, + 0xe8, 0x6b, 0x56, 0xa3, 0xe5, 0x5e, 0x38, 0xe3, 0xe3, 0xc0, 0x37, 0xcc, 0x05, 0xdb, 0x5d, 0x18, + 0xc9, 0x30, 0xbf, 0x10, 0x43, 0x9d, 0x73, 0xe9, 0x47, 0x86, 0xfa, 0x97, 0x3c, 0xff, 0x94, 0x56, + 0xfb, 0x52, 0x78, 0x10, 0x45, 0x41, 0x38, 0x44, 0x4d, 0x94, 0x16, 0x4f, 0x85, 0x9c, 0xf0, 0x71, + 0x2d, 0xa7, 0x25, 0xb8, 0xde, 0x08, 0xfc, 0x78, 0x0c, 0x7e, 0x8d, 0x74, 0xbe, 0xb9, 0xba, 0xb1, + 0x73, 0xd7, 0x37, 0x76, 0xee, 0xee, 0xc6, 0x26, 0xef, 0xe6, 0x36, 0xf9, 0x75, 0x6e, 0x93, 0xf7, + 0x73, 0x9b, 0x5c, 0xcd, 0x6d, 0x72, 0x3d, 0xb7, 0xc9, 0xdf, 0x73, 0x9b, 0xfc, 0x33, 0xb7, 0x73, + 0x77, 0x73, 0x9b, 0xfc, 0x7c, 0x6b, 0xe7, 0xae, 0x6e, 0xed, 0xdc, 0xf5, 0xad, 0x9d, 0x7b, 0x5d, + 0xc0, 0xff, 0xbe, 0x83, 0x22, 0xce, 0xf4, 0x8b, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xe6, + 0x66, 0x84, 0x8d, 0x07, 0x00, 0x00, } func (x Type) String() string { @@ -659,6 +679,13 @@ func (x Type) String() string { } return strconv.Itoa(int(x)) } +func (x ProcessingType) String() string { + s, ok := ProcessingType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} func (this *MiniBlock) Equal(that interface{}) bool { if that == nil { return this == nil diff --git a/data/block/block.proto b/data/block/block.proto index 40b8ed499..89acc6b2e 100644 --- a/data/block/block.proto +++ b/data/block/block.proto @@ -21,10 +21,14 @@ enum Type { SmartContractResultBlock = 90; InvalidBlock = 120; ReceiptBlock = 150; - ScheduledBlock = 180; RewardsBlock = 255; } +enum ProcessingType { + Normal = 0; + Scheduled = 1; +} + message MiniBlock { repeated bytes TxHashes = 1; uint32 ReceiverShardID = 2; diff --git a/data/block/blockV2.pb.go b/data/block/blockV2.pb.go index f14cf7441..89c644ac5 100644 --- a/data/block/blockV2.pb.go +++ b/data/block/blockV2.pb.go @@ -74,14 +74,62 @@ func (m *HeaderV2) GetScheduledRootHash() []byte { return nil } +type MiniBlockReserved struct { + ExecutionType ProcessingType `protobuf:"varint,1,opt,name=ExecutionType,proto3,enum=proto.ProcessingType" json:"ExecutionType,omitempty"` + TransactionsType []byte `protobuf:"bytes,2,opt,name=TransactionsType,proto3" json:"TransactionsType,omitempty"` +} + +func (m *MiniBlockReserved) Reset() { *m = MiniBlockReserved{} } +func (*MiniBlockReserved) ProtoMessage() {} +func (*MiniBlockReserved) Descriptor() ([]byte, []int) { + return fileDescriptor_17a3844aa051366e, []int{1} +} +func (m *MiniBlockReserved) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MiniBlockReserved) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MiniBlockReserved) XXX_Merge(src proto.Message) { + xxx_messageInfo_MiniBlockReserved.Merge(m, src) +} +func (m *MiniBlockReserved) XXX_Size() int { + return m.Size() +} +func (m *MiniBlockReserved) XXX_DiscardUnknown() { + xxx_messageInfo_MiniBlockReserved.DiscardUnknown(m) +} + +var xxx_messageInfo_MiniBlockReserved proto.InternalMessageInfo + +func (m *MiniBlockReserved) GetExecutionType() ProcessingType { + if m != nil { + return m.ExecutionType + } + return Normal +} + +func (m *MiniBlockReserved) GetTransactionsType() []byte { + if m != nil { + return m.TransactionsType + } + return nil +} + func init() { proto.RegisterType((*HeaderV2)(nil), "proto.HeaderV2") + proto.RegisterType((*MiniBlockReserved)(nil), "proto.MiniBlockReserved") } func init() { proto.RegisterFile("blockV2.proto", fileDescriptor_17a3844aa051366e) } var fileDescriptor_17a3844aa051366e = []byte{ - // 213 bytes of a gzipped FileDescriptorProto + // 292 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0xca, 0xc9, 0x4f, 0xce, 0x0e, 0x33, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, @@ -90,12 +138,17 @@ var fileDescriptor_17a3844aa051366e = []byte{ 0x6c, 0x10, 0xb6, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x11, 0x2f, 0x44, 0x8d, 0x1e, 0x44, 0x30, 0x08, 0x2a, 0x29, 0xa4, 0xc3, 0x25, 0x18, 0x9c, 0x9c, 0x91, 0x9a, 0x52, 0x9a, 0x93, 0x9a, 0x12, 0x94, 0x9f, 0x5f, 0xe2, 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x84, 0x29, - 0xe1, 0x64, 0x7f, 0xe1, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0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 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0x38, + 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xb1, 0x82, 0x43, + 0x29, 0x89, 0x0d, 0xec, 0x22, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x2d, 0x39, 0xbb, + 0x7a, 0x01, 0x00, 0x00, } func (this *HeaderV2) Equal(that interface{}) bool { @@ -125,6 +178,33 @@ func (this *HeaderV2) Equal(that interface{}) bool { } return true } +func (this *MiniBlockReserved) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MiniBlockReserved) + if !ok { + that2, ok := that.(MiniBlockReserved) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ExecutionType != that1.ExecutionType { + return false + } + if !bytes.Equal(this.TransactionsType, that1.TransactionsType) { + return false + } + return true +} func (this *HeaderV2) GoString() string { if this == nil { return "nil" @@ -138,6 +218,17 @@ func (this *HeaderV2) GoString() string { s = append(s, "}") return strings.Join(s, "") } +func (this *MiniBlockReserved) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&block.MiniBlockReserved{") + s = append(s, "ExecutionType: "+fmt.Sprintf("%#v", this.ExecutionType)+",\n") + s = append(s, "TransactionsType: "+fmt.Sprintf("%#v", this.TransactionsType)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} func valueToGoStringBlockV2(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -188,6 +279,41 @@ func (m *HeaderV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MiniBlockReserved) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MiniBlockReserved) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MiniBlockReserved) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TransactionsType) > 0 { + i -= len(m.TransactionsType) + copy(dAtA[i:], m.TransactionsType) + i = encodeVarintBlockV2(dAtA, i, uint64(len(m.TransactionsType))) + i-- + dAtA[i] = 0x12 + } + if m.ExecutionType != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.ExecutionType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintBlockV2(dAtA []byte, offset int, v uint64) int { offset -= sovBlockV2(v) base := offset @@ -216,6 +342,22 @@ func (m *HeaderV2) Size() (n int) { return n } +func (m *MiniBlockReserved) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExecutionType != 0 { + n += 1 + sovBlockV2(uint64(m.ExecutionType)) + } + l = len(m.TransactionsType) + if l > 0 { + n += 1 + l + sovBlockV2(uint64(l)) + } + return n +} + func sovBlockV2(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -233,6 +375,17 @@ func (this *HeaderV2) String() string { }, "") return s } +func (this *MiniBlockReserved) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MiniBlockReserved{`, + `ExecutionType:` + fmt.Sprintf("%v", this.ExecutionType) + `,`, + `TransactionsType:` + fmt.Sprintf("%v", this.TransactionsType) + `,`, + `}`, + }, "") + return s +} func valueToStringBlockV2(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -364,6 +517,112 @@ func (m *HeaderV2) Unmarshal(dAtA []byte) error { } return nil } +func (m *MiniBlockReserved) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MiniBlockReserved: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MiniBlockReserved: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionType", wireType) + } + m.ExecutionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecutionType |= ProcessingType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransactionsType", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransactionsType = append(m.TransactionsType[:0], dAtA[iNdEx:postIndex]...) + if m.TransactionsType == nil { + m.TransactionsType = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockV2(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipBlockV2(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/data/block/blockV2.proto b/data/block/blockV2.proto index 948ad1238..8c9b408a1 100644 --- a/data/block/blockV2.proto +++ b/data/block/blockV2.proto @@ -14,3 +14,8 @@ message HeaderV2 { Header Header = 1; bytes ScheduledRootHash = 2; } + +message MiniBlockReserved { + ProcessingType ExecutionType = 1; + bytes TransactionsType = 2; +} diff --git a/data/block/epochStartShardDataHandler.go b/data/block/epochStartShardDataHandler.go index a3a83166f..0bc329193 100644 --- a/data/block/epochStartShardDataHandler.go +++ b/data/block/epochStartShardDataHandler.go @@ -126,3 +126,14 @@ func (essd *EpochStartShardData) SetPendingMiniBlockHeaders(miniBlockHeaderHandl return nil } + +// SetScheduledRootHash sets the scheduled root hash +func (essd *EpochStartShardData) SetScheduledRootHash(schRootHash []byte) error { + if essd == nil { + return data.ErrNilPointerReceiver + } + + essd.ScheduledRootHash = schRootHash + + return nil +} diff --git a/data/block/metaBlock.pb.go b/data/block/metaBlock.pb.go index 922d9b0ee..bce26ae0a 100644 --- a/data/block/metaBlock.pb.go +++ b/data/block/metaBlock.pb.go @@ -295,6 +295,7 @@ type EpochStartShardData struct { Nonce uint64 `protobuf:"varint,8,opt,name=Nonce,proto3" json:"Nonce,omitempty"` HeaderHash []byte `protobuf:"bytes,2,opt,name=HeaderHash,proto3" json:"HeaderHash,omitempty"` RootHash []byte `protobuf:"bytes,3,opt,name=RootHash,proto3" json:"RootHash,omitempty"` + ScheduledRootHash []byte `protobuf:"bytes,10,opt,name=ScheduledRootHash,proto3" json:"ScheduledRootHash,omitempty"` FirstPendingMetaBlock []byte `protobuf:"bytes,4,opt,name=FirstPendingMetaBlock,proto3" json:"FirstPendingMetaBlock,omitempty"` LastFinishedMetaBlock []byte `protobuf:"bytes,5,opt,name=LastFinishedMetaBlock,proto3" json:"LastFinishedMetaBlock,omitempty"` PendingMiniBlockHeaders []MiniBlockHeader `protobuf:"bytes,6,rep,name=PendingMiniBlockHeaders,proto3" json:"PendingMiniBlockHeaders"` @@ -370,6 +371,13 @@ func (m *EpochStartShardData) GetRootHash() []byte { return nil } +func (m *EpochStartShardData) GetScheduledRootHash() []byte { + if m != nil { + return m.ScheduledRootHash + } + return nil +} + func (m *EpochStartShardData) GetFirstPendingMetaBlock() []byte { if m != nil { return m.FirstPendingMetaBlock @@ -780,86 +788,88 @@ func init() { func init() { proto.RegisterFile("metaBlock.proto", fileDescriptor_87b91ab531130b2b) } var fileDescriptor_87b91ab531130b2b = []byte{ - // 1264 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x3f, 0x6f, 0xdb, 0x46, - 0x14, 0x17, 0x6d, 0xcb, 0xb6, 0x9e, 0x2c, 0x9b, 0xbe, 0x38, 0x0e, 0x6b, 0x14, 0x8c, 0x21, 0x74, - 0x70, 0x0b, 0xc4, 0x6e, 0xdd, 0xa0, 0x1d, 0x3a, 0x14, 0xb1, 0x1d, 0x23, 0xca, 0x1f, 0x43, 0xa0, - 0x5c, 0x0f, 0xdd, 0x4e, 0xe4, 0x8b, 0x74, 0x30, 0xc5, 0x13, 0x8e, 0x47, 0x3b, 0xee, 0x54, 0xf4, - 0x13, 0x74, 0x2a, 0xfa, 0x01, 0x3a, 0x14, 0xdd, 0xfb, 0x15, 0x8a, 0x8c, 0x19, 0x33, 0xb5, 0x8d, - 0xb2, 0x74, 0x4c, 0x81, 0x2e, 0xdd, 0x0a, 0xde, 0x91, 0x22, 0x4d, 0xd1, 0x4d, 0x06, 0x79, 0xb2, - 0xdf, 0xef, 0xdd, 0x7b, 0x4f, 0xf7, 0xfe, 0xdd, 0x8f, 0xb0, 0x32, 0x40, 0x49, 0xf7, 0x7c, 0xee, - 0x9e, 0x6e, 0x0f, 0x05, 0x97, 0x9c, 0x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, 0xfb, 0xe6, 0xaf, - 0x55, 0xa8, 0x75, 0xfa, 0x54, 0x78, 0xea, 0xf2, 0x36, 0xc0, 0x03, 0xa4, 0x1e, 0x8a, 0x07, 0x34, - 0xec, 0x27, 0x77, 0xcc, 0x21, 0xc4, 0x81, 0x9b, 0xea, 0xf0, 0x13, 0x16, 0x30, 0x55, 0x04, 0xad, - 0x0b, 0xad, 0xd9, 0xcd, 0xd9, 0xad, 0xfa, 0xee, 0x7a, 0x72, 0xe7, 0x82, 0x7a, 0x6f, 0xee, 0xf9, - 0xef, 0xb7, 0x2b, 0x4e, 0xb9, 0x29, 0x69, 0xc2, 0x52, 0x5b, 0xe0, 0x99, 0x43, 0x03, 0xaf, 0x83, - 0xe8, 0xa9, 0x84, 0x2c, 0x39, 0x97, 0x30, 0xf2, 0x01, 0x34, 0xda, 0x51, 0xf7, 0x11, 0x5e, 0x84, - 0x7b, 0x4c, 0x0e, 0xe8, 0x50, 0x67, 0xc5, 0xb9, 0x0c, 0xc6, 0x79, 0xed, 0xb0, 0x5e, 0x40, 0x65, - 0x24, 0xd0, 0x9a, 0xd7, 0x05, 0x1a, 0x03, 0x64, 0x0d, 0xaa, 0x0e, 0x8f, 0x02, 0xcf, 0x5a, 0x54, - 0x19, 0xd7, 0x02, 0xd9, 0x80, 0xc5, 0x38, 0x92, 0xba, 0x6f, 0x4d, 0x99, 0x8c, 0xe5, 0xd8, 0xe2, - 0x88, 0x07, 0x2e, 0x5a, 0xa0, 0x2d, 0x94, 0x40, 0x24, 0xac, 0xdc, 0x73, 0xdd, 0x68, 0x10, 0xf9, - 0x54, 0xa2, 0x77, 0x88, 0x18, 0x5a, 0x4b, 0x53, 0xaf, 0x51, 0x31, 0x04, 0x19, 0x42, 0xe3, 0x00, - 0xcf, 0xd0, 0xe7, 0x43, 0x14, 0x2a, 0xe6, 0xf2, 0xd4, 0x63, 0x5e, 0x0e, 0x40, 0x76, 0x61, 0xed, - 0x28, 0x1a, 0xb4, 0x31, 0xf0,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xfc, 0x1e, 0x1c, 0x6f, 0xd2, 0x99, 0xd2, 0x4d, 0x3a, 0x9b, 0xdf, 0xa4, 0xff, 0xcf, - 0x75, 0xee, 0x26, 0xe4, 0xa3, 0x15, 0x3c, 0xe5, 0x56, 0x55, 0x5d, 0x37, 0xfd, 0x8d, 0xc5, 0x4b, - 0x66, 0x07, 0xc9, 0x27, 0x9a, 0xae, 0x29, 0x23, 0xbd, 0xd0, 0x56, 0x72, 0x64, 0x2b, 0x67, 0x33, - 0x3e, 0x76, 0x99, 0x1a, 0x2c, 0x14, 0xa9, 0xc1, 0x16, 0xac, 0x3c, 0x56, 0x59, 0xcb, 0xce, 0xe8, - 0xe2, 0x15, 0xe1, 0x49, 0x22, 0x52, 0x2b, 0x23, 0x22, 0x79, 0x52, 0x01, 0x05, 0x52, 0x51, 0xa4, - 0x3b, 0xf5, 0x12, 0xba, 0x13, 0x3f, 0x24, 0xa9, 0x7e, 0x29, 0x79, 0x48, 0xf2, 0xba, 0xf4, 0x91, - 0x69, 0x14, 0x1e, 0x99, 0xcf, 0x60, 0xfd, 0x84, 0xfa, 0xcc, 0xa3, 0x92, 0x8b, 0x8e, 0xa4, 0x32, - 0x1c, 0x9f, 0x54, 0x6c, 0xc1, 0xb9, 0x42, 0x4b, 0x1e, 0x80, 0x39, 0xf1, 0x52, 0x98, 0xef, 0xf0, - 0x52, 0x98, 0x65, 0x64, 0xce, 0x41, 0x17, 0xd9, 0x50, 0x86, 0x2a, 0xee, 0xaa, 0xbe, 0x5d, 0x1e, - 0x23, 0x9f, 0xe7, 0x9b, 0xdf, 0x22, 0xaa, 0x33, 0x57, 0x27, 0x9a, 0x3c, 0x09, 0x91, 0x9f, 0x13, - 0x0b, 0x16, 0xf6, 0xfb, 0x94, 0x05, 0xad, 0x03, 0xeb, 0x86, 0xa6, 0xe6, 0x89, 0x18, 0x17, 0xb0, - 0xc3, 0x9f, 0xca, 0x73, 0x2a, 0xf0, 0x04, 0x45, 0x18, 0xb3, 0xf0,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8d, 0x3f, 0x47, 0xb6, 0xf1, 0xd7, 0xc8, 0xae, 0xbc, 0x19, 0xd9, 0xc6, 0xf7, 0xaf, 0xed, 0xca, - 0x8b, 0xd7, 0x76, 0xe5, 0xe5, 0x6b, 0xbb, 0xf2, 0x75, 0x55, 0x7d, 0xf0, 0x76, 0xe7, 0xd5, 0x98, - 0x7d, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x56, 0xd4, 0xe2, 0x47, 0x0f, 0x00, 0x00, + // 1281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xbf, 0x6f, 0xdb, 0xc6, + 0x17, 0x17, 0x23, 0xcb, 0xb6, 0x9e, 0x2c, 0x9b, 0xbe, 0x38, 0x0e, 0xbf, 0xc6, 0x17, 0x8c, 0x21, + 0x74, 0x70, 0x8b, 0xc6, 0x6e, 0xdd, 0xa0, 0x1d, 0x3a, 0x14, 0xb1, 0x1d, 0x23, 0xca, 0x0f, 0x43, + 0xa0, 0x5c, 0x0f, 0xdd, 0x4e, 0xe4, 0x8b, 0x74, 0x30, 0xc5, 0x13, 0x8e, 0x47, 0x3b, 0xee, 0x54, + 0xf4, 0x2f, 0xe8, 0x54, 0x74, 0xeb, 0xd2, 0xa1, 0xe8, 0xde, 0x7f, 0xa1, 0xc8, 0x98, 0x31, 0x53, + 0xdb, 0x28, 0x4b, 0xc7, 0x0c, 0x5d, 0xba, 0x15, 0xbc, 0x23, 0x45, 0x9a, 0xa2, 0x9b, 0x0c, 0xca, + 0x64, 0xbf, 0xcf, 0x7b, 0xef, 0x9e, 0xee, 0xfd, 0xba, 0x0f, 0x61, 0x65, 0x88, 0x92, 0xee, 0xf9, + 0xdc, 0x3d, 0xdd, 0x1e, 0x09, 0x2e, 0x39, 0xa9, 0xa9, 0x3f, 0x1b, 0xb7, 0xfb, 0x4c, 0x0e, 0xa2, + 0xde,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, 0x36, 0x9e, 0x8f, 0x6d, 0xe3, 0xc5, + 0xd8, 0x36, 0xfe, 0x1c, 0xdb, 0xc6, 0x5f, 0x63, 0xbb, 0xf2, 0x7a, 0x6c, 0x1b, 0xdf, 0xbd, 0xb2, + 0x2b, 0xcf, 0x5f, 0xd9, 0x95, 0x17, 0xaf, 0xec, 0xca, 0x57, 0x35, 0xf5, 0x79, 0xdc, 0x9b, 0x57, + 0x63, 0xf6, 0xc9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x10, 0x9d, 0x19, 0x75, 0x0f, 0x00, + 0x00, } func (x PeerAction) String() string { @@ -1019,6 +1029,9 @@ func (this *EpochStartShardData) Equal(that interface{}) bool { if !bytes.Equal(this.RootHash, that1.RootHash) { return false } + if !bytes.Equal(this.ScheduledRootHash, that1.ScheduledRootHash) { + return false + } if !bytes.Equal(this.FirstPendingMetaBlock, that1.FirstPendingMetaBlock) { return false } @@ -1300,7 +1313,7 @@ func (this *EpochStartShardData) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 13) + s := make([]string, 0, 14) s = append(s, "&block.EpochStartShardData{") s = append(s, "ShardID: "+fmt.Sprintf("%#v", this.ShardID)+",\n") s = append(s, "Epoch: "+fmt.Sprintf("%#v", this.Epoch)+",\n") @@ -1308,6 +1321,7 @@ func (this *EpochStartShardData) GoString() string { s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n") s = append(s, "HeaderHash: "+fmt.Sprintf("%#v", this.HeaderHash)+",\n") s = append(s, "RootHash: "+fmt.Sprintf("%#v", this.RootHash)+",\n") + s = append(s, "ScheduledRootHash: "+fmt.Sprintf("%#v", this.ScheduledRootHash)+",\n") s = append(s, "FirstPendingMetaBlock: "+fmt.Sprintf("%#v", this.FirstPendingMetaBlock)+",\n") s = append(s, "LastFinishedMetaBlock: "+fmt.Sprintf("%#v", this.LastFinishedMetaBlock)+",\n") if this.PendingMiniBlockHeaders != nil { @@ -1616,6 +1630,13 @@ func (m *EpochStartShardData) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ScheduledRootHash) > 0 { + i -= len(m.ScheduledRootHash) + copy(dAtA[i:], m.ScheduledRootHash) + i = encodeVarintMetaBlock(dAtA, i, uint64(len(m.ScheduledRootHash))) + i-- + dAtA[i] = 0x52 + } if m.Epoch != 0 { i = encodeVarintMetaBlock(dAtA, i, uint64(m.Epoch)) i-- @@ -2221,6 +2242,10 @@ func (m *EpochStartShardData) Size() (n int) { if m.Epoch != 0 { n += 1 + sovMetaBlock(uint64(m.Epoch)) } + l = len(m.ScheduledRootHash) + if l > 0 { + n += 1 + l + sovMetaBlock(uint64(l)) + } return n } @@ -2466,6 +2491,7 @@ func (this *EpochStartShardData) String() string { `Round:` + fmt.Sprintf("%v", this.Round) + `,`, `Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`, `Epoch:` + fmt.Sprintf("%v", this.Epoch) + `,`, + `ScheduledRootHash:` + fmt.Sprintf("%v", this.ScheduledRootHash) + `,`, `}`, }, "") return s @@ -3479,6 +3505,40 @@ func (m *EpochStartShardData) Unmarshal(dAtA []byte) error { break } } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledRootHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetaBlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMetaBlock + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMetaBlock + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ScheduledRootHash = append(m.ScheduledRootHash[:0], dAtA[iNdEx:postIndex]...) + if m.ScheduledRootHash == nil { + m.ScheduledRootHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMetaBlock(dAtA[iNdEx:]) diff --git a/data/block/metaBlock.proto b/data/block/metaBlock.proto index 450933136..c90c2d2f8 100644 --- a/data/block/metaBlock.proto +++ b/data/block/metaBlock.proto @@ -60,6 +60,7 @@ message EpochStartShardData { uint64 Nonce = 8; bytes HeaderHash = 2; bytes RootHash = 3; + bytes ScheduledRootHash = 10; bytes FirstPendingMetaBlock = 4; bytes LastFinishedMetaBlock = 5; repeated MiniBlockHeader PendingMiniBlockHeaders = 6 [(gogoproto.nullable) = false]; From 9df378e8f9fd72027f6c9c7a86b39a8f10b0eed7 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 8 Sep 2021 10:58:40 +0300 Subject: [PATCH 21/32] data: fix comment and small refactor --- data/block/block.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/data/block/block.go b/data/block/block.go index 758334187..55e520f32 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -447,7 +447,7 @@ func (mb *MiniBlock) GetMiniBlockReserved() (*MiniBlockReserved, error) { return nil, nil } -// SetMiniBlockReserved returns the unmarshalled reserved field for the miniblock +// SetMiniBlockReserved sets the reserved field for the miniBlock with the given parameter func (mb *MiniBlock) SetMiniBlockReserved(mbr *MiniBlockReserved) error { if mbr == nil { mb.Reserved = nil @@ -465,18 +465,16 @@ func (mb *MiniBlock) SetMiniBlockReserved(mbr *MiniBlockReserved) error { // IsScheduledMiniBlock returns if the mini block is of type scheduled or not func (mb *MiniBlock) IsScheduledMiniBlock() bool { - if mb == nil { + if mb == nil || len(mb.Reserved) == 0 { return false } - if len(mb.Reserved) > 0 { - mbr := &MiniBlockReserved{} - err := mbr.Unmarshal(mb.Reserved) - if err != nil { - return false - } - return mbr.ExecutionType == Scheduled + + mbr := &MiniBlockReserved{} + err := mbr.Unmarshal(mb.Reserved) + if err != nil { + return false } - return false + return mbr.ExecutionType == Scheduled } // SetAdditionalData sets the additional data for the header From 9aa1d547ea8421e2ff9ab931095f7a26fabc75b7 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 8 Sep 2021 14:59:55 +0300 Subject: [PATCH 22/32] data: handle miniblock reserved field on deep clones --- data/block/block.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/block/block.go b/data/block/block.go index 55e520f32..fd3b56f4a 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -430,6 +430,9 @@ func (mb *MiniBlock) Clone() *MiniBlock { newMb.TxHashes = make([][]byte, len(mb.TxHashes)) copy(newMb.TxHashes, mb.TxHashes) + newMb.Reserved = make([]byte, len(mb.Reserved)) + copy(newMb.Reserved, mb.Reserved) + return newMb } From fddb9febe98b6f6c9f85163f76b1bf0786e903d4 Mon Sep 17 00:00:00 2001 From: Sebastian Marian Date: Wed, 8 Sep 2021 16:44:00 +0300 Subject: [PATCH 23/32] * Added GetTxsTypeFromMiniBlock method for mini blocks --- data/block/block.go | 66 ++++++++++++++++++++++++++++++++++++++++ data/block/block_test.go | 1 + data/errors.go | 3 ++ 3 files changed, 70 insertions(+) diff --git a/data/block/block.go b/data/block/block.go index fd3b56f4a..4007849ad 100644 --- a/data/block/block.go +++ b/data/block/block.go @@ -480,6 +480,72 @@ func (mb *MiniBlock) IsScheduledMiniBlock() bool { return mbr.ExecutionType == Scheduled } +// GetTxsTypeFromMiniBlock returns all the txs type from mini block +func (mb *MiniBlock) GetTxsTypeFromMiniBlock() ([]Type, error) { + if mb == nil { + return nil, data.ErrNilPointerReceiver + } + + if len(mb.Reserved) == 0 { + return mb.getTxsTypeOfMiniBlock() + } + + mbr := &MiniBlockReserved{} + err := mbr.Unmarshal(mb.Reserved) + if err != nil { + return nil, err + } + + if len(mbr.TransactionsType) == 0 { + return mb.getTxsTypeOfMiniBlock() + } + + return mb.getTxsType(mbr) +} + +func (mb *MiniBlock) getTxsTypeOfMiniBlock() ([]Type, error) { + numTxs := len(mb.TxHashes) + txsType := make([]Type, numTxs) + for i := 0; i < numTxs; i++ { + txsType[i] = mb.Type + } + return txsType, nil +} + +func (mb *MiniBlock) getTxsType(mbr *MiniBlockReserved) ([]Type, error) { + numTxs := len(mb.TxHashes) + err := checkTransactionsTypeValidity(mbr, numTxs) + if err != nil { + return nil, err + } + + txsType := make([]Type, numTxs) + for i := 0; i < numTxs; i++ { + isTxBlockType := (mbr.TransactionsType[i/8] & (1 << (uint16(i) % 8))) == 0 + if isTxBlockType { + txsType[i] = TxBlock + } else { + // we assume that we have only two types of txs, TxBlock and SmartContractResultBlock, included in mini blocks of type TxBlock + txsType[i] = SmartContractResultBlock + } + } + + return txsType, nil +} + +func checkTransactionsTypeValidity(mbr *MiniBlockReserved, numTxs int) error { + transactionsTypeSize := numTxs / 8 + if numTxs%8 != 0 { + transactionsTypeSize++ + } + + if len(mbr.TransactionsType) != transactionsTypeSize { + return data.ErrWrongTransactionsTypeSize + } + + return nil +} + // SetAdditionalData sets the additional data for the header func (h *Header) SetAdditionalData(_ headerVersionData.HeaderAdditionalData) error { // first header version does not have any additional data diff --git a/data/block/block_test.go b/data/block/block_test.go index 7d17b9208..194a19497 100644 --- a/data/block/block_test.go +++ b/data/block/block_test.go @@ -385,6 +385,7 @@ func TestMiniBlock_Clone(t *testing.T) { ReceiverShardID: 1, SenderShardID: 2, Type: 0, + Reserved: []byte("something"), } clonedMB := miniBlock.Clone() diff --git a/data/errors.go b/data/errors.go index 790a430f5..048aeac46 100644 --- a/data/errors.go +++ b/data/errors.go @@ -75,3 +75,6 @@ var ErrNilScheduledRootHash = errors.New("scheduled root hash is nil") // ErrScheduledRootHashNotSupported signals that a scheduled root hash is not supported var ErrScheduledRootHashNotSupported = errors.New("scheduled root hash is not supported") + +// ErrWrongTransactionsTypeSize signals that size of transactions type buffer from mini block reserved field is wrong +var ErrWrongTransactionsTypeSize = errors.New("wrong transactions type size") From 15de1417b63648ad467236239062709843c285de Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Thu, 6 Jan 2022 18:44:26 +0200 Subject: [PATCH 24/32] data: add gas and fees data for scheduled sc calls --- data/scheduled/scheduled.pb.go | 549 +++++++++++++++++++++++++++++++-- data/scheduled/scheduled.proto | 10 + 2 files changed, 532 insertions(+), 27 deletions(-) diff --git a/data/scheduled/scheduled.pb.go b/data/scheduled/scheduled.pb.go index 995a21b00..32d9604e3 100644 --- a/data/scheduled/scheduled.pb.go +++ b/data/scheduled/scheduled.pb.go @@ -6,12 +6,14 @@ package scheduled import ( bytes "bytes" fmt "fmt" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" smartContractResult "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" io "io" math "math" + math_big "math/big" math_bits "math/bits" reflect "reflect" strings "strings" @@ -67,15 +69,87 @@ func (m *SmartContractResults) GetTxHandlers() []*smartContractResult.SmartContr return nil } +type GasAndFees struct { + AccumulatedFees *math_big.Int `protobuf:"bytes,1,opt,name=AccumulatedFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"AccumulatedFees,omitempty"` + DeveloperFees *math_big.Int `protobuf:"bytes,2,opt,name=DeveloperFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"DeveloperFees,omitempty"` + GasProvided uint64 `protobuf:"varint,3,opt,name=GasProvided,proto3" json:"GasProvided,omitempty"` + GasPenalized uint64 `protobuf:"varint,4,opt,name=GasPenalized,proto3" json:"GasPenalized,omitempty"` + GasRefunded uint64 `protobuf:"varint,5,opt,name=GasRefunded,proto3" json:"GasRefunded,omitempty"` +} + +func (m *GasAndFees) Reset() { *m = GasAndFees{} } +func (*GasAndFees) ProtoMessage() {} +func (*GasAndFees) Descriptor() ([]byte, []int) { + return fileDescriptor_f80076f37bd30c16, []int{1} +} +func (m *GasAndFees) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasAndFees) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GasAndFees) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasAndFees.Merge(m, src) +} +func (m *GasAndFees) XXX_Size() int { + return m.Size() +} +func (m *GasAndFees) XXX_DiscardUnknown() { + xxx_messageInfo_GasAndFees.DiscardUnknown(m) +} + +var xxx_messageInfo_GasAndFees proto.InternalMessageInfo + +func (m *GasAndFees) GetAccumulatedFees() *math_big.Int { + if m != nil { + return m.AccumulatedFees + } + return nil +} + +func (m *GasAndFees) GetDeveloperFees() *math_big.Int { + if m != nil { + return m.DeveloperFees + } + return nil +} + +func (m *GasAndFees) GetGasProvided() uint64 { + if m != nil { + return m.GasProvided + } + return 0 +} + +func (m *GasAndFees) GetGasPenalized() uint64 { + if m != nil { + return m.GasPenalized + } + return 0 +} + +func (m *GasAndFees) GetGasRefunded() uint64 { + if m != nil { + return m.GasRefunded + } + return 0 +} + type ScheduledSCRs struct { - RootHash []byte `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` - Scrs map[int32]SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RootHash []byte `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` + Scrs map[int32]SmartContractResults `protobuf:"bytes,2,rep,name=scrs,proto3" json:"scrs" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + GasAndFees *GasAndFees `protobuf:"bytes,3,opt,name=gasAndFees,proto3" json:"gasAndFees,omitempty"` } func (m *ScheduledSCRs) Reset() { *m = ScheduledSCRs{} } func (*ScheduledSCRs) ProtoMessage() {} func (*ScheduledSCRs) Descriptor() ([]byte, []int) { - return fileDescriptor_f80076f37bd30c16, []int{1} + return fileDescriptor_f80076f37bd30c16, []int{2} } func (m *ScheduledSCRs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -114,8 +188,16 @@ func (m *ScheduledSCRs) GetScrs() map[int32]SmartContractResults { return nil } +func (m *ScheduledSCRs) GetGasAndFees() *GasAndFees { + if m != nil { + return m.GasAndFees + } + return nil +} + func init() { proto.RegisterType((*SmartContractResults)(nil), "proto.SmartContractResults") + proto.RegisterType((*GasAndFees)(nil), "proto.GasAndFees") proto.RegisterType((*ScheduledSCRs)(nil), "proto.ScheduledSCRs") proto.RegisterMapType((map[int32]SmartContractResults)(nil), "proto.ScheduledSCRs.ScrsEntry") } @@ -123,29 +205,39 @@ func init() { func init() { proto.RegisterFile("scheduled.proto", fileDescriptor_f80076f37bd30c16) } var fileDescriptor_f80076f37bd30c16 = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xbf, 0x6e, 0xf2, 0x30, - 0x14, 0xc5, 0x63, 0xfe, 0x7c, 0xfa, 0x30, 0xad, 0x5a, 0x45, 0x1d, 0xa2, 0x54, 0xba, 0x45, 0x4c, - 0x2c, 0x24, 0x2a, 0x5d, 0x10, 0x23, 0x08, 0x89, 0xa9, 0x83, 0xc3, 0xc4, 0x66, 0x12, 0x37, 0x54, - 0x84, 0xb8, 0xb2, 0x9d, 0xb6, 0x6c, 0x7d, 0x84, 0x3e, 0x46, 0xdf, 0xa1, 0x2f, 0xc0, 0xc8, 0xc8, - 0x54, 0x15, 0xb3, 0x74, 0xe4, 0x11, 0xaa, 0x3a, 0x02, 0x21, 0x95, 0x4e, 0xbe, 0xe7, 0xde, 0xf3, - 0xbb, 0xc7, 0x96, 0xf1, 0x99, 0x0c, 0x27, 0x2c, 0xca, 0x12, 0x16, 0x79, 0x0f, 0x82, 0x2b, 0x6e, - 0x97, 0xcd, 0xe1, 0x36, 0xe3, 0x7b, 0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0x14, 0xda, 0xa8, 0xdb, 0x5b, - 0xae, 0xc1, 0x5a, 0xad, 0xc1, 0xda, 0xae, 0x01, 0xbd, 0x68, 0x40, 0x6f, 0x1a, 0xd0, 0x42, 0x03, - 0x5a, 0x6a, 0x40, 0x2b, 0x0d, 0xe8, 0x53, 0x03, 0xfa, 0xd2, 0x60, 0x6d, 0x35, 0xa0, 0xd7, 0x0d, - 0x58, 0xcb, 0x0d, 0x58, 0xab, 0x0d, 0x58, 0xa3, 0xca, 0xfe, 0xbb, 0xc7, 0xff, 0x4c, 0xd6, 0xcd, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x06, 0x1a, 0x9f, 0x5d, 0x02, 0x02, 0x00, 0x00, + // 498 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0xf6, 0xe5, 0x03, 0xd1, 0x4b, 0xab, 0xc2, 0x89, 0x21, 0x32, 0xd2, 0x35, 0xca, 0x94, 0x25, + 0xb6, 0x1a, 0x96, 0xaa, 0x4c, 0x4d, 0xe8, 0x17, 0x03, 0x42, 0x97, 0x4e, 0xdd, 0x2e, 0xf6, 0x5b, + 0xc7, 0xaa, 0xe3, 0x8b, 0xee, 0xce, 0x81, 0x32, 0xf1, 0x13, 0xf8, 0x19, 0x88, 0x5f, 0xd2, 0x31, + 0x63, 0x06, 0x04, 0xc4, 0x59, 0x98, 0x50, 0x7f, 0x02, 0xf2, 0xb9, 0x31, 0x2e, 0x94, 0x01, 0x89, + 0x29, 0xf7, 0x3e, 0x79, 0x3e, 0xfc, 0xfa, 0x39, 0xe3, 0x6d, 0xe5, 0x8d, 0xc1, 0x4f, 0x22, 0xf0, + 0x9d, 0xa9, 0x14, 0x5a, 0x90, 0xba, 0xf9, 0xb1, 0xbb, 0x41, 0xa8, 0xc7, 0xc9, 0xc8, 0xf1, 0xc4, + 0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e, 0x51, 0x7c, 0x80, 0xa3, + 0x07, 0x26, 0xeb, 0xd9, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xc2, 0x3d, 0x31, 0x94, 0x03, + 0x00, 0x00, } func (this *SmartContractResults) Equal(that interface{}) bool { @@ -177,6 +269,48 @@ func (this *SmartContractResults) Equal(that interface{}) bool { } return true } +func (this *GasAndFees) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GasAndFees) + if !ok { + that2, ok := that.(GasAndFees) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if !__caster.Equal(this.AccumulatedFees, that1.AccumulatedFees) { + return false + } + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if !__caster.Equal(this.DeveloperFees, that1.DeveloperFees) { + return false + } + } + if this.GasProvided != that1.GasProvided { + return false + } + if this.GasPenalized != that1.GasPenalized { + return false + } + if this.GasRefunded != that1.GasRefunded { + return false + } + return true +} func (this *ScheduledSCRs) Equal(that interface{}) bool { if that == nil { return this == nil @@ -209,6 +343,9 @@ func (this *ScheduledSCRs) Equal(that interface{}) bool { return false } } + if !this.GasAndFees.Equal(that1.GasAndFees) { + return false + } return true } func (this *SmartContractResults) GoString() string { @@ -223,11 +360,25 @@ func (this *SmartContractResults) GoString() string { s = append(s, "}") return strings.Join(s, "") } +func (this *GasAndFees) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&scheduled.GasAndFees{") + s = append(s, "AccumulatedFees: "+fmt.Sprintf("%#v", this.AccumulatedFees)+",\n") + s = append(s, "DeveloperFees: "+fmt.Sprintf("%#v", this.DeveloperFees)+",\n") + s = append(s, "GasProvided: "+fmt.Sprintf("%#v", this.GasProvided)+",\n") + s = append(s, "GasPenalized: "+fmt.Sprintf("%#v", this.GasPenalized)+",\n") + s = append(s, "GasRefunded: "+fmt.Sprintf("%#v", this.GasRefunded)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} func (this *ScheduledSCRs) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 6) + s := make([]string, 0, 7) s = append(s, "&scheduled.ScheduledSCRs{") s = append(s, "RootHash: "+fmt.Sprintf("%#v", this.RootHash)+",\n") keysForScrs := make([]int32, 0, len(this.Scrs)) @@ -243,6 +394,9 @@ func (this *ScheduledSCRs) GoString() string { if this.Scrs != nil { s = append(s, "Scrs: "+mapStringForScrs+",\n") } + if this.GasAndFees != nil { + s = append(s, "GasAndFees: "+fmt.Sprintf("%#v", this.GasAndFees)+",\n") + } s = append(s, "}") return strings.Join(s, "") } @@ -291,6 +445,66 @@ func (m *SmartContractResults) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GasAndFees) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GasAndFees) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasAndFees) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasRefunded != 0 { + i = encodeVarintScheduled(dAtA, i, uint64(m.GasRefunded)) + i-- + dAtA[i] = 0x28 + } + if m.GasPenalized != 0 { + i = encodeVarintScheduled(dAtA, i, uint64(m.GasPenalized)) + i-- + dAtA[i] = 0x20 + } + if m.GasProvided != 0 { + i = encodeVarintScheduled(dAtA, i, uint64(m.GasProvided)) + i-- + dAtA[i] = 0x18 + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + size := __caster.Size(m.DeveloperFees) + i -= size + if _, err := __caster.MarshalTo(m.DeveloperFees, dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintScheduled(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + size := __caster.Size(m.AccumulatedFees) + i -= size + if _, err := __caster.MarshalTo(m.AccumulatedFees, dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintScheduled(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ScheduledSCRs) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -311,6 +525,18 @@ func (m *ScheduledSCRs) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.GasAndFees != nil { + { + size, err := m.GasAndFees.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintScheduled(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.Scrs) > 0 { keysForScrs := make([]int32, 0, len(m.Scrs)) for k := range m.Scrs { @@ -374,6 +600,34 @@ func (m *SmartContractResults) Size() (n int) { return n } +func (m *GasAndFees) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + l = __caster.Size(m.AccumulatedFees) + n += 1 + l + sovScheduled(uint64(l)) + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + l = __caster.Size(m.DeveloperFees) + n += 1 + l + sovScheduled(uint64(l)) + } + if m.GasProvided != 0 { + n += 1 + sovScheduled(uint64(m.GasProvided)) + } + if m.GasPenalized != 0 { + n += 1 + sovScheduled(uint64(m.GasPenalized)) + } + if m.GasRefunded != 0 { + n += 1 + sovScheduled(uint64(m.GasRefunded)) + } + return n +} + func (m *ScheduledSCRs) Size() (n int) { if m == nil { return 0 @@ -393,6 +647,10 @@ func (m *ScheduledSCRs) Size() (n int) { n += mapEntrySize + 1 + sovScheduled(uint64(mapEntrySize)) } } + if m.GasAndFees != nil { + l = m.GasAndFees.Size() + n += 1 + l + sovScheduled(uint64(l)) + } return n } @@ -417,6 +675,20 @@ func (this *SmartContractResults) String() string { }, "") return s } +func (this *GasAndFees) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GasAndFees{`, + `AccumulatedFees:` + fmt.Sprintf("%v", this.AccumulatedFees) + `,`, + `DeveloperFees:` + fmt.Sprintf("%v", this.DeveloperFees) + `,`, + `GasProvided:` + fmt.Sprintf("%v", this.GasProvided) + `,`, + `GasPenalized:` + fmt.Sprintf("%v", this.GasPenalized) + `,`, + `GasRefunded:` + fmt.Sprintf("%v", this.GasRefunded) + `,`, + `}`, + }, "") + return s +} func (this *ScheduledSCRs) String() string { if this == nil { return "nil" @@ -434,6 +706,7 @@ func (this *ScheduledSCRs) String() string { s := strings.Join([]string{`&ScheduledSCRs{`, `RootHash:` + fmt.Sprintf("%v", this.RootHash) + `,`, `Scrs:` + mapStringForScrs + `,`, + `GasAndFees:` + strings.Replace(this.GasAndFees.String(), "GasAndFees", "GasAndFees", 1) + `,`, `}`, }, "") return s @@ -533,6 +806,192 @@ func (m *SmartContractResults) Unmarshal(dAtA []byte) error { } return nil } +func (m *GasAndFees) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GasAndFees: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasAndFees: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccumulatedFees", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } else { + m.AccumulatedFees = tmp + } + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeveloperFees", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } else { + m.DeveloperFees = tmp + } + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasProvided", wireType) + } + m.GasProvided = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasProvided |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPenalized", wireType) + } + m.GasPenalized = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasPenalized |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasRefunded", wireType) + } + m.GasRefunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasRefunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipScheduled(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthScheduled + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -711,6 +1170,42 @@ func (m *ScheduledSCRs) Unmarshal(dAtA []byte) error { } m.Scrs[mapkey] = *mapvalue iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasAndFees", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowScheduled + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthScheduled + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthScheduled + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GasAndFees == nil { + m.GasAndFees = &GasAndFees{} + } + if err := m.GasAndFees.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipScheduled(dAtA[iNdEx:]) diff --git a/data/scheduled/scheduled.proto b/data/scheduled/scheduled.proto index a8b391de2..853deb297 100644 --- a/data/scheduled/scheduled.proto +++ b/data/scheduled/scheduled.proto @@ -12,7 +12,17 @@ import "github.com/ElrondNetwork/elrond-go-core/data/smartContractResult/smartCo message SmartContractResults { repeated SmartContractResult TxHandlers = 1; } + +message GasAndFees { + bytes AccumulatedFees = 1 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + bytes DeveloperFees = 2 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + uint64 GasProvided = 3; + uint64 GasPenalized = 4; + uint64 GasRefunded = 5; +} + message ScheduledSCRs { bytes rootHash = 1; map scrs = 2 [(gogoproto.nullable) = false]; + GasAndFees gasAndFees = 3; } From c7b672c8f7ded8e05f79006dd93a59e928b06fca Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 10 Jan 2022 11:41:52 +0200 Subject: [PATCH 25/32] data: add scheduled accumulated fees and development fees on block v2 --- data/block/blockV2.go | 53 ++++++- data/block/blockV2.pb.go | 195 +++++++++++++++++++++++--- data/block/blockV2.proto | 6 +- data/block/blockV2_test.go | 28 +++- data/block/metaBlock.go | 2 +- data/headerVersionData/shardHeader.go | 26 +++- 6 files changed, 280 insertions(+), 30 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 254c0fa8a..baf1cbce4 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -484,6 +484,38 @@ func (hv2 *HeaderV2) SetScheduledRootHash(rootHash []byte) error { return nil } +// SetScheduledAccumulatedFees sets the scheduled accumulated fees +func (hv2 *HeaderV2) SetScheduledAccumulatedFees(value *big.Int) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + if hv2.ScheduledAccumulatedFees == nil { + hv2.ScheduledAccumulatedFees = big.NewInt(0) + } + if value == nil { + value = big.NewInt(0) + } + + hv2.ScheduledAccumulatedFees.Set(value) + return nil +} + +// SetScheduledDeveloperFees sets the scheduled developer fees +func (hv2 *HeaderV2) SetScheduledDeveloperFees(value *big.Int) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + if hv2.ScheduledDeveloperFees == nil { + hv2.ScheduledDeveloperFees = big.NewInt(0) + } + if value == nil { + value = big.NewInt(0) + } + + hv2.ScheduledDeveloperFees.Set(value) + return nil +} + // ValidateHeaderVersion does extra validation for header version func (hv2 *HeaderV2) ValidateHeaderVersion() error { if hv2 == nil { @@ -507,7 +539,22 @@ func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.Heade if check.IfNil(headerVersionData) { return data.ErrNilPointerDereference } - return hv2.SetScheduledRootHash(headerVersionData.GetScheduledRootHash()) + + err := hv2.SetScheduledRootHash(headerVersionData.GetScheduledRootHash()) + if err != nil { + return err + } + + if headerVersionData.GetScheduledRootHash() == nil { + return nil + } + + err = hv2.SetScheduledAccumulatedFees(headerVersionData.GetScheduledAccumulatedFees()) + if err != nil { + return err + } + + return hv2.SetScheduledDeveloperFees(headerVersionData.GetScheduledDeveloperFees()) } // GetAdditionalData gets the additional version related data for the header @@ -517,7 +564,9 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData } additionalVersionData := &headerVersionData.AdditionalData{ - ScheduledRootHash: hv2.GetScheduledRootHash(), + ScheduledRootHash: hv2.GetScheduledRootHash(), + ScheduledAccumulatedFees: hv2.GetScheduledAccumulatedFees(), + ScheduledDeveloperFees: hv2.GetScheduledDeveloperFees(), } return additionalVersionData } diff --git a/data/block/blockV2.pb.go b/data/block/blockV2.pb.go index 89c644ac5..852f25de8 100644 --- a/data/block/blockV2.pb.go +++ b/data/block/blockV2.pb.go @@ -6,10 +6,12 @@ package block import ( bytes "bytes" fmt "fmt" + github_com_ElrondNetwork_elrond_go_core_data "github.com/ElrondNetwork/elrond-go-core/data" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_big "math/big" math_bits "math/bits" reflect "reflect" strings "strings" @@ -28,8 +30,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // HeaderV2 extends the Header structure with extra fields for version 2 type HeaderV2 struct { - Header *Header `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"` - ScheduledRootHash []byte `protobuf:"bytes,2,opt,name=ScheduledRootHash,proto3" json:"ScheduledRootHash,omitempty"` + Header *Header `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"` + ScheduledRootHash []byte `protobuf:"bytes,2,opt,name=ScheduledRootHash,proto3" json:"ScheduledRootHash,omitempty"` + ScheduledAccumulatedFees *math_big.Int `protobuf:"bytes,3,opt,name=ScheduledAccumulatedFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"ScheduledAccumulatedFees,omitempty"` + ScheduledDeveloperFees *math_big.Int `protobuf:"bytes,4,opt,name=ScheduledDeveloperFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"ScheduledDeveloperFees,omitempty"` } func (m *HeaderV2) Reset() { *m = HeaderV2{} } @@ -74,6 +78,20 @@ func (m *HeaderV2) GetScheduledRootHash() []byte { return nil } +func (m *HeaderV2) GetScheduledAccumulatedFees() *math_big.Int { + if m != nil { + return m.ScheduledAccumulatedFees + } + return nil +} + +func (m *HeaderV2) GetScheduledDeveloperFees() *math_big.Int { + if m != nil { + return m.ScheduledDeveloperFees + } + return nil +} + type MiniBlockReserved struct { ExecutionType ProcessingType `protobuf:"varint,1,opt,name=ExecutionType,proto3,enum=proto.ProcessingType" json:"ExecutionType,omitempty"` TransactionsType []byte `protobuf:"bytes,2,opt,name=TransactionsType,proto3" json:"TransactionsType,omitempty"` @@ -129,26 +147,33 @@ func init() { func init() { proto.RegisterFile("blockV2.proto", fileDescriptor_17a3844aa051366e) } var fileDescriptor_17a3844aa051366e = []byte{ - // 292 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0xca, 0xc9, 0x4f, - 0xce, 0x0e, 0x33, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x52, 0xba, 0xe9, - 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, - 0xe1, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20, 0xba, 0xa4, 0xb8, 0xc1, 0x86, 0x40, - 0x38, 0x4a, 0xf1, 0x5c, 0x1c, 0x1e, 0xa9, 0x89, 0x29, 0xa9, 0x45, 0x61, 0x46, 0x42, 0xaa, 0x5c, - 0x6c, 0x10, 0xb6, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x11, 0x2f, 0x44, 0x8d, 0x1e, 0x44, 0x30, - 0x08, 0x2a, 0x29, 0xa4, 0xc3, 0x25, 0x18, 0x9c, 0x9c, 0x91, 0x9a, 0x52, 0x9a, 0x93, 0x9a, 0x12, - 0x94, 0x9f, 0x5f, 0xe2, 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x84, 0x29, - 0xa1, 0x54, 0xc3, 0x25, 0xe8, 0x9b, 0x99, 0x97, 0xe9, 0x04, 0xb2, 0x33, 0x28, 0xb5, 0x38, 0xb5, - 0xa8, 0x2c, 0x35, 0x45, 0xc8, 0x9a, 0x8b, 0xd7, 0xb5, 0x22, 0x35, 0xb9, 0xb4, 0x24, 0x33, 0x3f, - 0x2f, 0xa4, 0xb2, 0x20, 0x15, 0x6c, 0x21, 0x9f, 0x91, 0x28, 0xd4, 0xc2, 0x80, 0xa2, 0xfc, 0xe4, - 0xd4, 0xe2, 0xe2, 0xcc, 0xbc, 0x74, 0x90, 0x64, 0x10, 0xaa, 0x5a, 0x21, 0x2d, 0x2e, 0x81, 0x90, - 0xa2, 0xc4, 0xbc, 0xe2, 0xc4, 0x64, 0x90, 0x50, 0x31, 0x58, 0x3f, 0xc4, 0x7a, 0x0c, 0x71, 0x27, - 0xfb, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, 0xb1, 0xe1, 0x91, - 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, - 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xb1, 0x82, 0x43, - 0x29, 0x89, 0x0d, 0xec, 0x22, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x2d, 0x39, 0xbb, - 0x7a, 0x01, 0x00, 0x00, + // 404 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x41, 0xab, 0xd3, 0x40, + 0x10, 0xce, 0x3e, 0x7d, 0x0f, 0xd9, 0x67, 0xc5, 0x06, 0x94, 0xd0, 0xc3, 0x5a, 0x0a, 0x42, 0x11, + 0x9b, 0x40, 0x3c, 0xf6, 0x20, 0x46, 0x5b, 0x5a, 0x41, 0x91, 0x58, 0x7a, 0xf0, 0xb6, 0xd9, 0x8c, + 0x49, 0x68, 0x9a, 0x2d, 0xbb, 0x9b, 0xaa, 0xe0, 0x41, 0x3c, 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 0x15, 0x75, 0x83, 0x2c, 0x19, 0x17, 0xea, 0x29, 0x95, 0x0a, 0x44, 0x78, 0xb2, 0x97, 0xfd, 0x19, + 0xe1, 0xbb, 0x07, 0xf1, 0x19, 0x2c, 0x21, 0xe7, 0x0b, 0x10, 0xc6, 0xc6, 0xf5, 0x2b, 0xb7, 0x71, + 0xa2, 0x53, 0xe7, 0x23, 0x6e, 0xbe, 0xc8, 0x8a, 0x2c, 0xa8, 0x56, 0x10, 0x82, 0x04, 0xb1, 0x84, + 0xd8, 0xee, 0xe3, 0xc6, 0xe0, 0x3d, 0xb0, 0x52, 0x65, 0xbc, 0x98, 0x7c, 0x58, 0x80, 0x19, 0xff, + 0x2d, 0xff, 0xce, 0x7e, 0xfc, 0xaf, 0x04, 0x67, 0x20, 0x65, 0x56, 0x24, 0x95, 0x18, 0xfe, 0x9f, + 0x6b, 0x3f, 0xc0, 0xb7, 0x27, 0x82, 0x16, 0x92, 0xb2, 0x8a, 0x92, 0xa6, 0xbe, 0x5e, 0xc6, 0x11, + 0x1f, 0x3c, 0x5e, 0x6d, 0x88, 0xb5, 0xde, 0x10, 0x6b, 0xb7, 0x21, 0xe8, 0x93, 0x26, 0xe8, 0x9b, + 0x26, 0xe8, 0x87, 0x26, 0x68, 0xa5, 0x09, 0x5a, 0x6b, 0x82, 0x7e, 0x69, 0x82, 0x7e, 0x6b, 0x62, + 0xed, 0x34, 0x41, 0x5f, 0xb7, 0xc4, 0x5a, 0x6d, 0x89, 0xb5, 0xde, 0x12, 0xeb, 0xcd, 0xb9, 0xf9, + 0x34, 0xd1, 0x85, 0x71, 0xf4, 0xe8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0x90, 0x3d, 0x38, + 0x89, 0x02, 0x00, 0x00, } func (this *HeaderV2) Equal(that interface{}) bool { @@ -176,6 +201,18 @@ func (this *HeaderV2) Equal(that interface{}) bool { if !bytes.Equal(this.ScheduledRootHash, that1.ScheduledRootHash) { return false } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if !__caster.Equal(this.ScheduledAccumulatedFees, that1.ScheduledAccumulatedFees) { + return false + } + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if !__caster.Equal(this.ScheduledDeveloperFees, that1.ScheduledDeveloperFees) { + return false + } + } return true } func (this *MiniBlockReserved) Equal(that interface{}) bool { @@ -209,12 +246,14 @@ func (this *HeaderV2) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 6) + s := make([]string, 0, 8) s = append(s, "&block.HeaderV2{") if this.Header != nil { s = append(s, "Header: "+fmt.Sprintf("%#v", this.Header)+",\n") } s = append(s, "ScheduledRootHash: "+fmt.Sprintf("%#v", this.ScheduledRootHash)+",\n") + s = append(s, "ScheduledAccumulatedFees: "+fmt.Sprintf("%#v", this.ScheduledAccumulatedFees)+",\n") + s = append(s, "ScheduledDeveloperFees: "+fmt.Sprintf("%#v", this.ScheduledDeveloperFees)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -257,6 +296,28 @@ func (m *HeaderV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + size := __caster.Size(m.ScheduledDeveloperFees) + i -= size + if _, err := __caster.MarshalTo(m.ScheduledDeveloperFees, dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBlockV2(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + size := __caster.Size(m.ScheduledAccumulatedFees) + i -= size + if _, err := __caster.MarshalTo(m.ScheduledAccumulatedFees, dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBlockV2(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.ScheduledRootHash) > 0 { i -= len(m.ScheduledRootHash) copy(dAtA[i:], m.ScheduledRootHash) @@ -339,6 +400,16 @@ func (m *HeaderV2) Size() (n int) { if l > 0 { n += 1 + l + sovBlockV2(uint64(l)) } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + l = __caster.Size(m.ScheduledAccumulatedFees) + n += 1 + l + sovBlockV2(uint64(l)) + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + l = __caster.Size(m.ScheduledDeveloperFees) + n += 1 + l + sovBlockV2(uint64(l)) + } return n } @@ -371,6 +442,8 @@ func (this *HeaderV2) String() string { s := strings.Join([]string{`&HeaderV2{`, `Header:` + strings.Replace(fmt.Sprintf("%v", this.Header), "Header", "Header", 1) + `,`, `ScheduledRootHash:` + fmt.Sprintf("%v", this.ScheduledRootHash) + `,`, + `ScheduledAccumulatedFees:` + fmt.Sprintf("%v", this.ScheduledAccumulatedFees) + `,`, + `ScheduledDeveloperFees:` + fmt.Sprintf("%v", this.ScheduledDeveloperFees) + `,`, `}`, }, "") return s @@ -493,6 +566,82 @@ func (m *HeaderV2) Unmarshal(dAtA []byte) error { m.ScheduledRootHash = []byte{} } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledAccumulatedFees", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } else { + m.ScheduledAccumulatedFees = tmp + } + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledDeveloperFees", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + { + __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} + if tmp, err := __caster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } else { + m.ScheduledDeveloperFees = tmp + } + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBlockV2(dAtA[iNdEx:]) diff --git a/data/block/blockV2.proto b/data/block/blockV2.proto index 8c9b408a1..801a40106 100644 --- a/data/block/blockV2.proto +++ b/data/block/blockV2.proto @@ -11,8 +11,10 @@ import "block.proto"; // HeaderV2 extends the Header structure with extra fields for version 2 message HeaderV2 { - Header Header = 1; - bytes ScheduledRootHash = 2; + Header Header = 1; + bytes ScheduledRootHash = 2; + bytes ScheduledAccumulatedFees = 3 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + bytes ScheduledDeveloperFees = 4 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; } message MiniBlockReserved { diff --git a/data/block/blockV2_test.go b/data/block/blockV2_test.go index 056a29760..ea670154a 100644 --- a/data/block/blockV2_test.go +++ b/data/block/blockV2_test.go @@ -1,6 +1,7 @@ package block_test import ( + "math/big" "testing" "github.com/ElrondNetwork/elrond-go-core/data" @@ -686,7 +687,7 @@ func TestHeaderV2_SetAdditionalDataNilAdditionalDataShouldErr(t *testing.T) { require.Equal(t, data.ErrNilPointerDereference, err) } -func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { +func TestHeaderV2_SetAdditionalDataEmptyFeesShouldWork(t *testing.T) { t.Parallel() shardBlock := &block.HeaderV2{ @@ -701,4 +702,29 @@ func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { require.Nil(t, err) require.Equal(t, scRootHash, shardBlock.ScheduledRootHash) + require.Equal(t, big.NewInt(0), shardBlock.ScheduledAccumulatedFees) + require.Equal(t, big.NewInt(0), shardBlock.ScheduledDeveloperFees) +} + +func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { + t.Parallel() + + shardBlock := &block.HeaderV2{ + Header: &block.Header{}, + ScheduledRootHash: nil, + } + + scRootHash := []byte("scheduledRootHash") + accFees := big.NewInt(100) + devFees := big.NewInt(10) + err := shardBlock.SetAdditionalData(&headerVersionData.AdditionalData{ + ScheduledRootHash: scRootHash, + ScheduledAccumulatedFees: accFees, + ScheduledDeveloperFees: devFees, + }) + + require.Nil(t, err) + require.Equal(t, scRootHash, shardBlock.ScheduledRootHash) + require.Equal(t, accFees, shardBlock.ScheduledAccumulatedFees) + require.Equal(t, devFees, shardBlock.ScheduledDeveloperFees) } diff --git a/data/block/metaBlock.go b/data/block/metaBlock.go index e20e5f194..9ff547d02 100644 --- a/data/block/metaBlock.go +++ b/data/block/metaBlock.go @@ -213,7 +213,7 @@ func (m *MetaBlock) SetDeveloperFees(value *big.Int) error { return nil } -// SetDeveloperFees sets the developer fees in the header +// SetDevFeesInEpoch sets the developer fees in the header func (m *MetaBlock) SetDevFeesInEpoch(value *big.Int) error { if m == nil { return data.ErrNilPointerReceiver diff --git a/data/headerVersionData/shardHeader.go b/data/headerVersionData/shardHeader.go index 0570b9dc9..b8efd17de 100644 --- a/data/headerVersionData/shardHeader.go +++ b/data/headerVersionData/shardHeader.go @@ -1,16 +1,22 @@ package headerVersionData +import "math/big" + // HeaderAdditionalData holds getters for the additional version related header data for new versions // for future versions this interface can grow type HeaderAdditionalData interface { GetScheduledRootHash() []byte + GetScheduledAccumulatedFees() *big.Int + GetScheduledDeveloperFees() *big.Int IsInterfaceNil() bool } // AdditionalData holds the additional version related header data // for future header versions this structure can grow type AdditionalData struct { - ScheduledRootHash []byte + ScheduledRootHash []byte + ScheduledAccumulatedFees *big.Int + ScheduledDeveloperFees *big.Int } // GetScheduledRootHash returns the scheduled RootHash @@ -22,6 +28,24 @@ func (ad *AdditionalData) GetScheduledRootHash() []byte { return ad.ScheduledRootHash } +// GetScheduledAccumulatedFees returns the accumulated fees on scheduled SC calls +func (ad *AdditionalData) GetScheduledAccumulatedFees() *big.Int { + if ad == nil { + return nil + } + + return ad.ScheduledAccumulatedFees +} + +// GetScheduledDeveloperFees returns the developer fees on scheduled SC calls +func (ad *AdditionalData) GetScheduledDeveloperFees() *big.Int { + if ad == nil { + return nil + } + + return ad.ScheduledDeveloperFees +} + // IsInterfaceNil returns true if there is no value under the interface func (ad *AdditionalData) IsInterfaceNil() bool { return ad == nil From d75794c77b456f513cd5ac537ad38760f3f1f211 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 10 Jan 2022 12:21:56 +0200 Subject: [PATCH 26/32] data: add also gas metrics on headerV2 for scheduled SC calls --- data/block/blockV2.go | 7 + data/block/blockV2.pb.go | 179 ++++++++++++++++++++++---- data/block/blockV2.proto | 15 ++- data/headerVersionData/shardHeader.go | 33 +++++ 4 files changed, 200 insertions(+), 34 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index baf1cbce4..5f1bff306 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -549,6 +549,10 @@ func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.Heade return nil } + hv2.ScheduledGasProvided = headerVersionData.GetGasProvided() + hv2.ScheduledGasPenalized = headerVersionData.GetGasPenalized() + hv2.ScheduledGasRefunded = headerVersionData.GetGasRefunded() + err = hv2.SetScheduledAccumulatedFees(headerVersionData.GetScheduledAccumulatedFees()) if err != nil { return err @@ -567,6 +571,9 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData ScheduledRootHash: hv2.GetScheduledRootHash(), ScheduledAccumulatedFees: hv2.GetScheduledAccumulatedFees(), ScheduledDeveloperFees: hv2.GetScheduledDeveloperFees(), + GasProvided: hv2.GetScheduledGasProvided(), + GasPenalized: hv2.GetScheduledGasPenalized(), + GasRefunded: hv2.GetScheduledGasRefunded(), } return additionalVersionData } diff --git a/data/block/blockV2.pb.go b/data/block/blockV2.pb.go index 852f25de8..9f267f452 100644 --- a/data/block/blockV2.pb.go +++ b/data/block/blockV2.pb.go @@ -34,6 +34,9 @@ type HeaderV2 struct { ScheduledRootHash []byte `protobuf:"bytes,2,opt,name=ScheduledRootHash,proto3" json:"ScheduledRootHash,omitempty"` ScheduledAccumulatedFees *math_big.Int `protobuf:"bytes,3,opt,name=ScheduledAccumulatedFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"ScheduledAccumulatedFees,omitempty"` ScheduledDeveloperFees *math_big.Int `protobuf:"bytes,4,opt,name=ScheduledDeveloperFees,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster" json:"ScheduledDeveloperFees,omitempty"` + ScheduledGasProvided uint64 `protobuf:"varint,5,opt,name=ScheduledGasProvided,proto3" json:"ScheduledGasProvided,omitempty"` + ScheduledGasPenalized uint64 `protobuf:"varint,6,opt,name=ScheduledGasPenalized,proto3" json:"ScheduledGasPenalized,omitempty"` + ScheduledGasRefunded uint64 `protobuf:"varint,7,opt,name=ScheduledGasRefunded,proto3" json:"ScheduledGasRefunded,omitempty"` } func (m *HeaderV2) Reset() { *m = HeaderV2{} } @@ -92,6 +95,27 @@ func (m *HeaderV2) GetScheduledDeveloperFees() *math_big.Int { return nil } +func (m *HeaderV2) GetScheduledGasProvided() uint64 { + if m != nil { + return m.ScheduledGasProvided + } + return 0 +} + +func (m *HeaderV2) GetScheduledGasPenalized() uint64 { + if m != nil { + return m.ScheduledGasPenalized + } + return 0 +} + +func (m *HeaderV2) GetScheduledGasRefunded() uint64 { + if m != nil { + return m.ScheduledGasRefunded + } + return 0 +} + type MiniBlockReserved struct { ExecutionType ProcessingType `protobuf:"varint,1,opt,name=ExecutionType,proto3,enum=proto.ProcessingType" json:"ExecutionType,omitempty"` TransactionsType []byte `protobuf:"bytes,2,opt,name=TransactionsType,proto3" json:"TransactionsType,omitempty"` @@ -147,33 +171,36 @@ func init() { func init() { proto.RegisterFile("blockV2.proto", fileDescriptor_17a3844aa051366e) } var fileDescriptor_17a3844aa051366e = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x41, 0xab, 0xd3, 0x40, - 0x10, 0xce, 0x3e, 0x7d, 0x0f, 0xd9, 0x67, 0xc5, 0x06, 0x94, 0xd0, 0xc3, 0x5a, 0x0a, 0x42, 0x11, - 0x9b, 0x40, 0x3c, 0xf6, 0x20, 0x46, 0x5b, 0x5a, 0x41, 0x91, 0x58, 0x7a, 0xf0, 0xb6, 0xd9, 0x8c, - 0x49, 0x68, 0x9a, 0x2d, 0xbb, 0x9b, 0xaa, 0xe0, 0x41, 0x3c, 0x78, 0xf6, 0x67, 0x88, 0xbf, 0xc4, - 0x63, 0x8f, 0xbd, 0x69, 0xb7, 0x17, 0x2f, 0x42, 0x7f, 0x82, 0x64, 0x53, 0x8a, 0x52, 0x7a, 0x7b, - 0xa7, 0x9d, 0xef, 0xfb, 0x66, 0x76, 0xbe, 0x9d, 0x59, 0xdc, 0x88, 0x72, 0xce, 0x66, 0x53, 0xdf, - 0x5d, 0x08, 0xae, 0xb8, 0x7d, 0x6e, 0x8e, 0x56, 0x2f, 0xc9, 0x54, 0x5a, 0x46, 0x2e, 0xe3, 0x73, - 0x2f, 0xe1, 0x09, 0xf7, 0x0c, 0x1d, 0x95, 0x6f, 0x0d, 0x32, 0xc0, 0x44, 0x75, 0x55, 0xeb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 0xaf, 0x04, 0x67, 0x20, 0x65, 0x56, 0x24, 0x95, 0x18, 0xfe, 0x9f, - 0x6b, 0x3f, 0xc0, 0xb7, 0x27, 0x82, 0x16, 0x92, 0xb2, 0x8a, 0x92, 0xa6, 0xbe, 0x5e, 0xc6, 0x11, - 0x1f, 0x3c, 0x5e, 0x6d, 0x88, 0xb5, 0xde, 0x10, 0x6b, 0xb7, 0x21, 0xe8, 0x93, 0x26, 0xe8, 0x9b, - 0x26, 0xe8, 0x87, 0x26, 0x68, 0xa5, 0x09, 0x5a, 0x6b, 0x82, 0x7e, 0x69, 0x82, 0x7e, 0x6b, 0x62, - 0xed, 0x34, 0x41, 0x5f, 0xb7, 0xc4, 0x5a, 0x6d, 0x89, 0xb5, 0xde, 0x12, 0xeb, 0xcd, 0xb9, 0xf9, - 0x34, 0xd1, 0x85, 0x71, 0xf4, 0xe8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0x90, 0x3d, 0x38, - 0x89, 0x02, 0x00, 0x00, + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x7d, 0x90, 0x04, 0x74, 0x25, 0x88, 0x5a, 0x14, 0x59, 0x1d, 0x8e, 0xa8, 0x12, 0x52, + 0x84, 0x88, 0x2d, 0x19, 0xb6, 0x0e, 0x88, 0x40, 0x4b, 0x8b, 0x04, 0xaa, 0x4c, 0xd5, 0x81, 0xed, + 0x7c, 0xf7, 0xd6, 0x39, 0xd5, 0xb9, 0x8b, 0xee, 0xce, 0xe1, 0x8f, 0x18, 0x10, 0x03, 0x0b, 0x0b, + 0x1f, 0x03, 0xf1, 0x49, 0x18, 0x33, 0x66, 0x83, 0x38, 0x0b, 0x63, 0x3f, 0x02, 0xf2, 0xb9, 0x44, + 0x94, 0x34, 0x1b, 0x93, 0xef, 0x7d, 0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 0xe4, 0x6a, 0x04, 0xda, 0xad, + 0xd1, 0xf8, 0xef, 0x6b, 0xac, 0x48, 0xf2, 0x63, 0x7c, 0x73, 0x41, 0x9e, 0x52, 0x73, 0xa0, 0xd5, + 0x58, 0x70, 0xe0, 0x41, 0xb3, 0x83, 0xba, 0x8d, 0xe4, 0x42, 0xe6, 0x3f, 0xc0, 0x1b, 0xe7, 0x74, + 0x90, 0x34, 0x17, 0xef, 0x80, 0x07, 0x2d, 0x67, 0xba, 0x18, 0xfe, 0x9b, 0x94, 0xc0, 0x71, 0x21, + 0xab, 0xa4, 0x2b, 0xcb, 0x49, 0x7f, 0xd8, 0xd6, 0x7b, 0xbc, 0xfe, 0x5c, 0x48, 0xd1, 0xaf, 0x0a, + 0x92, 0x80, 0x01, 0x3d, 0x06, 0xee, 0x6f, 0xe3, 0xf6, 0xce, 0x1b, 0x60, 0x85, 0x15, 0x4a, 0x1e, + 0xbe, 0x1d, 0x81, 0x2b, 0xc7, 0xf5, 0x78, 0xe3, 0xac, 0x1c, 0x07, 0x5a, 0x31, 0x30, 0x46, 0xc8, + 0xac, 0x82, 0xc9, 0xf9, 0xbb, 0xfe, 0x5d, 0x7c, 0xe3, 0x50, 0x53, 0x69, 0x28, 0xab, 0x24, 0xe3, + 0xfc, 0x75, 0x55, 0x96, 0xf4, 0xfe, 0xc3, 0xc9, 0x8c, 0x78, 0xd3, 0x19, 0xf1, 0x4e, 0x67, 0x04, + 0x7d, 0x28, 0x09, 0xfa, 0x5a, 0x12, 0xf4, 0xbd, 0x24, 0x68, 0x52, 0x12, 0x34, 0x2d, 0x09, 0xfa, + 0x59, 0x12, 0xf4, 0xab, 0x24, 0xde, 0x69, 0x49, 0xd0, 0x97, 0x39, 0xf1, 0x26, 0x73, 0xe2, 0x4d, + 0xe7, 0xc4, 0x7b, 0xd5, 0x74, 0x95, 0x4e, 0x5b, 0x6e, 0xa3, 0xfb, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x64, 0xf6, 0x9f, 0x37, 0x27, 0x03, 0x00, 0x00, } func (this *HeaderV2) Equal(that interface{}) bool { @@ -213,6 +240,15 @@ func (this *HeaderV2) Equal(that interface{}) bool { return false } } + if this.ScheduledGasProvided != that1.ScheduledGasProvided { + return false + } + if this.ScheduledGasPenalized != that1.ScheduledGasPenalized { + return false + } + if this.ScheduledGasRefunded != that1.ScheduledGasRefunded { + return false + } return true } func (this *MiniBlockReserved) Equal(that interface{}) bool { @@ -246,7 +282,7 @@ func (this *HeaderV2) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 8) + s := make([]string, 0, 11) s = append(s, "&block.HeaderV2{") if this.Header != nil { s = append(s, "Header: "+fmt.Sprintf("%#v", this.Header)+",\n") @@ -254,6 +290,9 @@ func (this *HeaderV2) GoString() string { s = append(s, "ScheduledRootHash: "+fmt.Sprintf("%#v", this.ScheduledRootHash)+",\n") s = append(s, "ScheduledAccumulatedFees: "+fmt.Sprintf("%#v", this.ScheduledAccumulatedFees)+",\n") s = append(s, "ScheduledDeveloperFees: "+fmt.Sprintf("%#v", this.ScheduledDeveloperFees)+",\n") + s = append(s, "ScheduledGasProvided: "+fmt.Sprintf("%#v", this.ScheduledGasProvided)+",\n") + s = append(s, "ScheduledGasPenalized: "+fmt.Sprintf("%#v", this.ScheduledGasPenalized)+",\n") + s = append(s, "ScheduledGasRefunded: "+fmt.Sprintf("%#v", this.ScheduledGasRefunded)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -296,6 +335,21 @@ func (m *HeaderV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ScheduledGasRefunded != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.ScheduledGasRefunded)) + i-- + dAtA[i] = 0x38 + } + if m.ScheduledGasPenalized != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.ScheduledGasPenalized)) + i-- + dAtA[i] = 0x30 + } + if m.ScheduledGasProvided != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.ScheduledGasProvided)) + i-- + dAtA[i] = 0x28 + } { __caster := &github_com_ElrondNetwork_elrond_go_core_data.BigIntCaster{} size := __caster.Size(m.ScheduledDeveloperFees) @@ -410,6 +464,15 @@ func (m *HeaderV2) Size() (n int) { l = __caster.Size(m.ScheduledDeveloperFees) n += 1 + l + sovBlockV2(uint64(l)) } + if m.ScheduledGasProvided != 0 { + n += 1 + sovBlockV2(uint64(m.ScheduledGasProvided)) + } + if m.ScheduledGasPenalized != 0 { + n += 1 + sovBlockV2(uint64(m.ScheduledGasPenalized)) + } + if m.ScheduledGasRefunded != 0 { + n += 1 + sovBlockV2(uint64(m.ScheduledGasRefunded)) + } return n } @@ -444,6 +507,9 @@ func (this *HeaderV2) String() string { `ScheduledRootHash:` + fmt.Sprintf("%v", this.ScheduledRootHash) + `,`, `ScheduledAccumulatedFees:` + fmt.Sprintf("%v", this.ScheduledAccumulatedFees) + `,`, `ScheduledDeveloperFees:` + fmt.Sprintf("%v", this.ScheduledDeveloperFees) + `,`, + `ScheduledGasProvided:` + fmt.Sprintf("%v", this.ScheduledGasProvided) + `,`, + `ScheduledGasPenalized:` + fmt.Sprintf("%v", this.ScheduledGasPenalized) + `,`, + `ScheduledGasRefunded:` + fmt.Sprintf("%v", this.ScheduledGasRefunded) + `,`, `}`, }, "") return s @@ -642,6 +708,63 @@ func (m *HeaderV2) Unmarshal(dAtA []byte) error { } } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledGasProvided", wireType) + } + m.ScheduledGasProvided = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ScheduledGasProvided |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledGasPenalized", wireType) + } + m.ScheduledGasPenalized = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ScheduledGasPenalized |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledGasRefunded", wireType) + } + m.ScheduledGasRefunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ScheduledGasRefunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipBlockV2(dAtA[iNdEx:]) diff --git a/data/block/blockV2.proto b/data/block/blockV2.proto index 801a40106..0f640ff1b 100644 --- a/data/block/blockV2.proto +++ b/data/block/blockV2.proto @@ -11,13 +11,16 @@ import "block.proto"; // HeaderV2 extends the Header structure with extra fields for version 2 message HeaderV2 { - Header Header = 1; - bytes ScheduledRootHash = 2; - bytes ScheduledAccumulatedFees = 3 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; - bytes ScheduledDeveloperFees = 4 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + Header Header = 1; + bytes ScheduledRootHash = 2; + bytes ScheduledAccumulatedFees = 3 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + bytes ScheduledDeveloperFees = 4 [(gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go-core/data.BigIntCaster"]; + uint64 ScheduledGasProvided = 5; + uint64 ScheduledGasPenalized = 6; + uint64 ScheduledGasRefunded = 7; } message MiniBlockReserved { - ProcessingType ExecutionType = 1; - bytes TransactionsType = 2; + ProcessingType ExecutionType = 1; + bytes TransactionsType = 2; } diff --git a/data/headerVersionData/shardHeader.go b/data/headerVersionData/shardHeader.go index b8efd17de..edbedef96 100644 --- a/data/headerVersionData/shardHeader.go +++ b/data/headerVersionData/shardHeader.go @@ -8,6 +8,9 @@ type HeaderAdditionalData interface { GetScheduledRootHash() []byte GetScheduledAccumulatedFees() *big.Int GetScheduledDeveloperFees() *big.Int + GetGasProvided() uint64 + GetGasPenalized() uint64 + GetGasRefunded() uint64 IsInterfaceNil() bool } @@ -17,6 +20,9 @@ type AdditionalData struct { ScheduledRootHash []byte ScheduledAccumulatedFees *big.Int ScheduledDeveloperFees *big.Int + GasProvided uint64 + GasPenalized uint64 + GasRefunded uint64 } // GetScheduledRootHash returns the scheduled RootHash @@ -46,6 +52,33 @@ func (ad *AdditionalData) GetScheduledDeveloperFees() *big.Int { return ad.ScheduledDeveloperFees } +// GetGasProvided returns the gas provided on scheduled SC calls for previous block +func (ad *AdditionalData) GetGasProvided() uint64 { + if ad == nil { + return 0 + } + + return ad.GasProvided +} + +// GetGasPenalized returns the gas penalized on scheduled SC calls for previous block +func (ad *AdditionalData) GetGasPenalized() uint64 { + if ad == nil { + return 0 + } + + return ad.GasPenalized +} + +// GetGasRefunded returns the gas refunded on scheduled SC calls for previous block +func (ad *AdditionalData) GetGasRefunded() uint64 { + if ad == nil { + return 0 + } + + return ad.GasRefunded +} + // IsInterfaceNil returns true if there is no value under the interface func (ad *AdditionalData) IsInterfaceNil() bool { return ad == nil From 8775b9d020317ece774c1768ff1728d8940803b2 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 10 Jan 2022 12:33:48 +0200 Subject: [PATCH 27/32] data: some renamings --- data/block/blockV2.go | 12 +++++------ data/headerVersionData/shardHeader.go | 30 +++++++++++++-------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 5f1bff306..50cc30ca5 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -549,9 +549,9 @@ func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.Heade return nil } - hv2.ScheduledGasProvided = headerVersionData.GetGasProvided() - hv2.ScheduledGasPenalized = headerVersionData.GetGasPenalized() - hv2.ScheduledGasRefunded = headerVersionData.GetGasRefunded() + hv2.ScheduledGasProvided = headerVersionData.GetScheduledGasProvided() + hv2.ScheduledGasPenalized = headerVersionData.GetScheduledGasPenalized() + hv2.ScheduledGasRefunded = headerVersionData.GetScheduledGasRefunded() err = hv2.SetScheduledAccumulatedFees(headerVersionData.GetScheduledAccumulatedFees()) if err != nil { @@ -571,9 +571,9 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData ScheduledRootHash: hv2.GetScheduledRootHash(), ScheduledAccumulatedFees: hv2.GetScheduledAccumulatedFees(), ScheduledDeveloperFees: hv2.GetScheduledDeveloperFees(), - GasProvided: hv2.GetScheduledGasProvided(), - GasPenalized: hv2.GetScheduledGasPenalized(), - GasRefunded: hv2.GetScheduledGasRefunded(), + ScheduledGasProvided: hv2.GetScheduledGasProvided(), + ScheduledGasPenalized: hv2.GetScheduledGasPenalized(), + ScheduledGasRefunded: hv2.GetScheduledGasRefunded(), } return additionalVersionData } diff --git a/data/headerVersionData/shardHeader.go b/data/headerVersionData/shardHeader.go index edbedef96..b53b5d926 100644 --- a/data/headerVersionData/shardHeader.go +++ b/data/headerVersionData/shardHeader.go @@ -8,9 +8,9 @@ type HeaderAdditionalData interface { GetScheduledRootHash() []byte GetScheduledAccumulatedFees() *big.Int GetScheduledDeveloperFees() *big.Int - GetGasProvided() uint64 - GetGasPenalized() uint64 - GetGasRefunded() uint64 + GetScheduledGasProvided() uint64 + GetScheduledGasPenalized() uint64 + GetScheduledGasRefunded() uint64 IsInterfaceNil() bool } @@ -20,9 +20,9 @@ type AdditionalData struct { ScheduledRootHash []byte ScheduledAccumulatedFees *big.Int ScheduledDeveloperFees *big.Int - GasProvided uint64 - GasPenalized uint64 - GasRefunded uint64 + ScheduledGasProvided uint64 + ScheduledGasPenalized uint64 + ScheduledGasRefunded uint64 } // GetScheduledRootHash returns the scheduled RootHash @@ -52,31 +52,31 @@ func (ad *AdditionalData) GetScheduledDeveloperFees() *big.Int { return ad.ScheduledDeveloperFees } -// GetGasProvided returns the gas provided on scheduled SC calls for previous block -func (ad *AdditionalData) GetGasProvided() uint64 { +// GetScheduledGasProvided returns the gas provided on scheduled SC calls for previous block +func (ad *AdditionalData) GetScheduledGasProvided() uint64 { if ad == nil { return 0 } - return ad.GasProvided + return ad.ScheduledGasProvided } -// GetGasPenalized returns the gas penalized on scheduled SC calls for previous block -func (ad *AdditionalData) GetGasPenalized() uint64 { +// GetScheduledGasPenalized returns the gas penalized on scheduled SC calls for previous block +func (ad *AdditionalData) GetScheduledGasPenalized() uint64 { if ad == nil { return 0 } - return ad.GasPenalized + return ad.ScheduledGasPenalized } -// GetGasRefunded returns the gas refunded on scheduled SC calls for previous block -func (ad *AdditionalData) GetGasRefunded() uint64 { +// GetScheduledGasRefunded returns the gas refunded on scheduled SC calls for previous block +func (ad *AdditionalData) GetScheduledGasRefunded() uint64 { if ad == nil { return 0 } - return ad.GasRefunded + return ad.ScheduledGasRefunded } // IsInterfaceNil returns true if there is no value under the interface From 95467e225d98c28cd7f1002f0f37b35e9c1dd0f1 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 10 Jan 2022 13:15:39 +0200 Subject: [PATCH 28/32] data: missing setters --- data/block/blockV2.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 50cc30ca5..1e4a21906 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -516,6 +516,36 @@ func (hv2 *HeaderV2) SetScheduledDeveloperFees(value *big.Int) error { return nil } +// SetScheduledGasProvided sets the scheduled SC calls provided gas +func (hv2 *HeaderV2) SetScheduledGasProvided(gasProvided uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + hv2.ScheduledGasProvided = gasProvided + + return nil +} + +// SetScheduledGasPenalized sets the scheduled SC calls penalized gas +func (hv2 *HeaderV2) SetScheduledGasPenalized(gasPenalized uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + hv2.ScheduledGasPenalized = gasPenalized + + return nil +} + +// SetScheduledGasRefunded sets the scheduled SC calls refunded gas +func (hv2 *HeaderV2) SetScheduledGasRefunded(gasRefunded uint64) error { + if hv2 == nil { + return data.ErrNilPointerReceiver + } + hv2.ScheduledGasRefunded = gasRefunded + + return nil +} + // ValidateHeaderVersion does extra validation for header version func (hv2 *HeaderV2) ValidateHeaderVersion() error { if hv2 == nil { From bbc5ce640f4623913b0a0880b235a96ddfa0469b Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 10 Jan 2022 19:05:58 +0200 Subject: [PATCH 29/32] data: fixes accumulated fees and dev fees --- data/block/blockV2.go | 4 ++-- data/headerVersionData/shardHeader.go | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 1e4a21906..53437304a 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -599,8 +599,8 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData additionalVersionData := &headerVersionData.AdditionalData{ ScheduledRootHash: hv2.GetScheduledRootHash(), - ScheduledAccumulatedFees: hv2.GetScheduledAccumulatedFees(), - ScheduledDeveloperFees: hv2.GetScheduledDeveloperFees(), + ScheduledAccumulatedFees: big.NewInt(0).Set(hv2.GetScheduledAccumulatedFees()), + ScheduledDeveloperFees: big.NewInt(0).Set(hv2.GetScheduledDeveloperFees()), ScheduledGasProvided: hv2.GetScheduledGasProvided(), ScheduledGasPenalized: hv2.GetScheduledGasPenalized(), ScheduledGasRefunded: hv2.GetScheduledGasRefunded(), diff --git a/data/headerVersionData/shardHeader.go b/data/headerVersionData/shardHeader.go index b53b5d926..f3bcf1a2b 100644 --- a/data/headerVersionData/shardHeader.go +++ b/data/headerVersionData/shardHeader.go @@ -39,8 +39,10 @@ func (ad *AdditionalData) GetScheduledAccumulatedFees() *big.Int { if ad == nil { return nil } - - return ad.ScheduledAccumulatedFees + if ad.ScheduledAccumulatedFees == nil { + return big.NewInt(0) + } + return big.NewInt(0).Set(ad.ScheduledAccumulatedFees) } // GetScheduledDeveloperFees returns the developer fees on scheduled SC calls @@ -48,8 +50,11 @@ func (ad *AdditionalData) GetScheduledDeveloperFees() *big.Int { if ad == nil { return nil } + if ad.ScheduledDeveloperFees == nil { + return big.NewInt(0) + } - return ad.ScheduledDeveloperFees + return big.NewInt(0).Set(ad.ScheduledDeveloperFees) } // GetScheduledGasProvided returns the gas provided on scheduled SC calls for previous block From d8645bc1bb2b0bcdb291f9d9ff7bf3f5d075f2e7 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Fri, 14 Jan 2022 13:40:35 +0200 Subject: [PATCH 30/32] add checks for additional data bigInt values --- data/block/blockV2.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 53437304a..8b0b70bab 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -597,10 +597,19 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData return nil } + accFees := big.NewInt(0) + if hv2.GetScheduledAccumulatedFees() != nil { + accFees = big.NewInt(0).Set(hv2.GetScheduledAccumulatedFees()) + } + devFees := big.NewInt(0) + if hv2.GetDeveloperFees() != nil { + devFees = big.NewInt(0).Set(hv2.GetDeveloperFees()) + } + additionalVersionData := &headerVersionData.AdditionalData{ ScheduledRootHash: hv2.GetScheduledRootHash(), - ScheduledAccumulatedFees: big.NewInt(0).Set(hv2.GetScheduledAccumulatedFees()), - ScheduledDeveloperFees: big.NewInt(0).Set(hv2.GetScheduledDeveloperFees()), + ScheduledAccumulatedFees: accFees, + ScheduledDeveloperFees: devFees, ScheduledGasProvided: hv2.GetScheduledGasProvided(), ScheduledGasPenalized: hv2.GetScheduledGasPenalized(), ScheduledGasRefunded: hv2.GetScheduledGasRefunded(), From d101878ad0ccb67daea7a0ccb7376a6543db8cd2 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Mon, 17 Jan 2022 11:54:31 +0200 Subject: [PATCH 31/32] data: fixes after review --- data/block/blockV2.go | 4 ---- data/block/blockV2_test.go | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index 8b0b70bab..e69828baa 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -575,10 +575,6 @@ func (hv2 *HeaderV2) SetAdditionalData(headerVersionData headerVersionData.Heade return err } - if headerVersionData.GetScheduledRootHash() == nil { - return nil - } - hv2.ScheduledGasProvided = headerVersionData.GetScheduledGasProvided() hv2.ScheduledGasPenalized = headerVersionData.GetScheduledGasPenalized() hv2.ScheduledGasRefunded = headerVersionData.GetScheduledGasRefunded() diff --git a/data/block/blockV2_test.go b/data/block/blockV2_test.go index ea670154a..5596b26d8 100644 --- a/data/block/blockV2_test.go +++ b/data/block/blockV2_test.go @@ -704,6 +704,9 @@ func TestHeaderV2_SetAdditionalDataEmptyFeesShouldWork(t *testing.T) { require.Equal(t, scRootHash, shardBlock.ScheduledRootHash) require.Equal(t, big.NewInt(0), shardBlock.ScheduledAccumulatedFees) require.Equal(t, big.NewInt(0), shardBlock.ScheduledDeveloperFees) + require.Equal(t, uint64(0), shardBlock.GetScheduledGasPenalized()) + require.Equal(t, uint64(0), shardBlock.GetScheduledGasRefunded()) + require.Equal(t, uint64(0), shardBlock.GetScheduledGasProvided()) } func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { @@ -717,14 +720,23 @@ func TestHeaderV2_SetAdditionalDataShouldWork(t *testing.T) { scRootHash := []byte("scheduledRootHash") accFees := big.NewInt(100) devFees := big.NewInt(10) + gasProvided := uint64(60) + gasRefunded := uint64(10) + gasPenalized := uint64(20) err := shardBlock.SetAdditionalData(&headerVersionData.AdditionalData{ ScheduledRootHash: scRootHash, ScheduledAccumulatedFees: accFees, ScheduledDeveloperFees: devFees, + ScheduledGasProvided: gasProvided, + ScheduledGasPenalized: gasPenalized, + ScheduledGasRefunded: gasRefunded, }) require.Nil(t, err) require.Equal(t, scRootHash, shardBlock.ScheduledRootHash) require.Equal(t, accFees, shardBlock.ScheduledAccumulatedFees) require.Equal(t, devFees, shardBlock.ScheduledDeveloperFees) + require.Equal(t, gasPenalized, shardBlock.GetScheduledGasPenalized()) + require.Equal(t, gasRefunded, shardBlock.GetScheduledGasRefunded()) + require.Equal(t, gasProvided, shardBlock.GetScheduledGasProvided()) } From a52f4e9a61071f2efdd41f3b27c8418e7feb1f91 Mon Sep 17 00:00:00 2001 From: AdoAdoAdo Date: Wed, 19 Jan 2022 13:48:21 +0200 Subject: [PATCH 32/32] data: fix additional data scheduled dev fees --- data/block/blockV2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/block/blockV2.go b/data/block/blockV2.go index e69828baa..923b08076 100644 --- a/data/block/blockV2.go +++ b/data/block/blockV2.go @@ -598,8 +598,8 @@ func (hv2 *HeaderV2) GetAdditionalData() headerVersionData.HeaderAdditionalData accFees = big.NewInt(0).Set(hv2.GetScheduledAccumulatedFees()) } devFees := big.NewInt(0) - if hv2.GetDeveloperFees() != nil { - devFees = big.NewInt(0).Set(hv2.GetDeveloperFees()) + if hv2.GetScheduledDeveloperFees() != nil { + devFees = big.NewInt(0).Set(hv2.GetScheduledDeveloperFees()) } additionalVersionData := &headerVersionData.AdditionalData{