Skip to content

Conversation

@ssd04
Copy link
Contributor

@ssd04 ssd04 commented Jun 3, 2025

Reasoning behind the pull request

  • Added new hooks to export timestamp as milliseconds

Testing procedure

  • Standard system test

Related PRs:

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this Jun 3, 2025
// LastTimeStampMs returns the timeStamp in milliseconds from the last committed block
func (bh *BlockChainHookImpl) LastTimeStampMs() uint64 {
if !check.IfNil(bh.blockChain.GetCurrentBlockHeader()) {
return common.ConvertTimeStampSecToMs(bh.blockChain.GetCurrentBlockHeader().GetTimeStamp())
Copy link
Contributor Author

@ssd04 ssd04 Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConvertTimeStampSecToMs looks like this

// ConvertTimeStampSecToMs will convert unix timestamp from seconds to milliseconds
// TODO: this has to be handled properly when round timestamp granularity will be changed to milliseconds
func ConvertTimeStampSecToMs(timeStamp uint64) uint64 {
	return timeStamp * 1000
}

With Supernova we'll handle this TODO properly and change in all places

sstanculeanu
sstanculeanu previously approved these changes Jun 3, 2025
@laurci laurci marked this pull request as ready for review June 4, 2025 11:34
Base automatically changed from timestamp-as-milliseconds to feat/timestamp-ms June 5, 2025 09:52
@AdoAdoAdo AdoAdoAdo dismissed sstanculeanu’s stale review June 5, 2025 09:52

The base branch was changed.

defer bh.mutEpochStartHdr.RUnlock()

return bh.epochStartHdr.GetTimeStamp()
timestampMs := common.ConvertTimeStampSecToMs(bh.epochStartHdr.GetTimeStamp())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could return directly

@ssd04 ssd04 merged commit 9425d54 into feat/timestamp-ms Jun 11, 2025
7 checks passed
@ssd04 ssd04 deleted the smart-contract-hooks-as-milliseconds branch June 11, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants