-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new epoch start blockchain hooks #6548
Open
laurci
wants to merge
36
commits into
rc/barnard
Choose a base branch
from
new-blockchain-hooks
base: rc/barnard
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+881
−153
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a7e9294
add new blockchain hooks
laurci 9ff3ca2
Merge remote-tracking branch 'origin/rc/v1.7.next1' into new-blockcha…
laurci 67a99d6
Merge remote-tracking branch 'origin/rc/v1.7.2' into new-blockchain-h…
laurci f060fde
use cached epoch start block in vm blockchain hook
laurci a4b93be
tpn nil epoch start trigger
laurci c8ef463
use round handler to get round duration in blockchain hook
laurci 9334561
fix nil pointer epoch start block header
laurci b9eef0c
nil checks for RoundHandler and EpochStartTriggerHandler
laurci f94bc3c
fix more RoundHandler nils in tests
laurci 8d9114d
deep copy header when returning from trigger
laurci 0684c29
epochStartHdr nil error check
laurci 53f4563
propagate SetCurrentHeader errors
laurci 0534fc4
remove log; epoch start hdr check if nil
laurci 1f07ae2
simplify error handling in LastCommitedEpochStartHdr impl
laurci 1877e0c
get epoch start block from storage for sc query
laurci 6f64220
add comment for SetEpochStartHeader
laurci a333893
rc/1.7.2 update dependencies
laurci fc46b8b
managed buffer small ints gas cost
laurci 5d877d8
formatting fixes
laurci 4ac3ab5
update vm version
laurci a6a1af7
chainsimulator tests fixes
laurci e770491
more chain simulator tests fixing
laurci 2a402b5
add warn logs for error cases in updateEpochStartHeaderFromCurrentHeader
laurci bc949a7
Merge remote-tracking branch 'origin/rc/barnard' into new-blockchain-…
laurci 98a24b2
fixes after merge
sasurobert 96d4de0
delete files
sasurobert dc39f02
Merge branch 'spica-to-barnard-23-okt' into new-blockchain-hooks
sasurobert c27f005
go mod tidy
sasurobert c47b844
go lint fixes
sasurobert 4a2031b
Merge branch 'spica-to-barnard-23-okt' into new-blockchain-hooks
sasurobert 71dcf66
merges
sasurobert 0ae6ede
Merge branch 'rc/barnard' into new-blockchain-hooks
sasurobert 6af33da
fallback read from storage for epoch start header
laurci 5462659
log.Debug instead of Warn
laurci cd27078
fix: epoch start block for epoch 0 is the genesis block
laurci a050424
Merge branch 'rc/barnard' into new-blockchain-hooks
sasurobert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import ( | |
"github.com/multiversx/mx-chain-go/epochStart" | ||
"github.com/multiversx/mx-chain-go/process" | ||
"github.com/multiversx/mx-chain-go/storage" | ||
"github.com/multiversx/mx-chain-logger-go" | ||
logger "github.com/multiversx/mx-chain-logger-go" | ||
) | ||
|
||
var log = logger.GetOrCreate("epochStart/shardchain") | ||
|
@@ -1102,6 +1102,31 @@ func (t *trigger) EpochStartMetaHdrHash() []byte { | |
return t.epochMetaBlockHash | ||
} | ||
|
||
// LastCommitedEpochStartHdr returns the epoch start header | ||
func (t *trigger) LastCommitedEpochStartHdr() (data.HeaderHandler, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add unit tests. |
||
t.mutTrigger.RLock() | ||
defer t.mutTrigger.RUnlock() | ||
|
||
// marshal + unmarshal deep copy | ||
headerBytes, err := t.marshaller.Marshal(t.epochStartShardHeader) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return process.UnmarshalShardHeader(t.marshaller, headerBytes) | ||
} | ||
|
||
// GetEpochStartHdrFromStorage returns the epoch start header from storage | ||
func (t *trigger) GetEpochStartHdrFromStorage(epoch uint32) (data.HeaderHandler, error) { | ||
epochStartIdentifier := core.EpochStartIdentifier(epoch) | ||
shardHdrBuff, err := t.shardHdrStorage.SearchFirst([]byte(epochStartIdentifier)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return process.UnmarshalShardHeader(t.marshaller, shardHdrBuff) | ||
} | ||
|
||
// GetSavedStateKey returns the last saved trigger state key | ||
func (t *trigger) GetSavedStateKey() []byte { | ||
return t.triggerStateKey | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add unit tests