Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type AccountInfo struct {
DeveloperRewardsNum float64 `json:"developerRewardsNum,omitempty"`
Data *TokenMetaData `json:"data,omitempty"`
Timestamp time.Duration `json:"timestamp,omitempty"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
Type string `json:"type,omitempty"`
CurrentOwner string `json:"currentOwner,omitempty"`
ShardID uint32 `json:"shardID"`
Expand Down Expand Up @@ -52,6 +53,7 @@ type TokenMetaData struct {
type AccountBalanceHistory struct {
Address string `json:"address"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
Balance string `json:"balance"`
Token string `json:"token,omitempty"`
Identifier string `json:"identifier,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions data/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Block struct {
Size int64 `json:"size"`
SizeTxs int64 `json:"sizeTxs"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
StateRootHash string `json:"stateRootHash"`
PrevHash string `json:"prevHash"`
ShardID uint32 `json:"shardId"`
Expand Down Expand Up @@ -113,5 +114,6 @@ type Miniblock struct {
ProcessingTypeOnSource string `json:"procTypeS,omitempty"`
ProcessingTypeOnDestination string `json:"procTypeD,omitempty"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
Reserved []byte `json:"reserved,omitempty"`
}
1 change: 1 addition & 0 deletions data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type RoundInfo struct {
ShardId uint32 `json:"shardId"`
Epoch uint32 `json:"epoch"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
}

// EpochInfo holds the information about epoch
Expand Down
10 changes: 6 additions & 4 deletions data/delegators.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Delegator struct {
Address string `json:"address"`
Contract string `json:"contract"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
ActiveStake string `json:"activeStake"`
ActiveStakeNum float64 `json:"activeStakeNum"`
ShouldDelete bool `json:"-"`
Expand All @@ -16,8 +17,9 @@ type Delegator struct {

// UnDelegate is a structure that is needed to store information about user unDelegate position
type UnDelegate struct {
Timestamp time.Duration `json:"timestamp"`
ID string `json:"id"`
Value string `json:"value"`
ValueNum float64 `json:"valueNum"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
ID string `json:"id"`
Value string `json:"value"`
ValueNum float64 `json:"valueNum"`
}
1 change: 1 addition & 0 deletions data/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ type LogEvent struct {
TxOrder int `json:"txOrder"`
ShardID uint32 `json:"shardID"`
Timestamp time.Duration `json:"timestamp,omitempty"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
}
1 change: 1 addition & 0 deletions data/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Logs struct {
Address string `json:"address"`
Events []*Event `json:"events"`
Timestamp time.Duration `json:"timestamp,omitempty"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
}

// Event holds all the fields needed for an event structure
Expand Down
10 changes: 6 additions & 4 deletions data/scDeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ type ScDeployInfo struct {
CurrentOwner string `json:"currentOwner"`
CodeHash []byte `json:"initialCodeHash"`
Timestamp uint64 `json:"timestamp"`
TimestampMs uint64 `json:"timestampMs,omitempty"`
Upgrades []*Upgrade `json:"upgrades"`
OwnersHistory []*OwnerData `json:"owners"`
}

// Upgrade is the DTO that holds information about a smart contract upgrade
type Upgrade struct {
TxHash string `json:"upgradeTxHash"`
Upgrader string `json:"upgrader"`
Timestamp uint64 `json:"timestamp"`
CodeHash []byte `json:"codeHash"`
TxHash string `json:"upgradeTxHash"`
Upgrader string `json:"upgrader"`
Timestamp uint64 `json:"timestamp"`
TimestampMs uint64 `json:"timestampMs"`
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The TimestampMs field in Upgrade lacks the omitempty JSON tag, which causes zero values to always be serialized. Consider adding omitempty for consistency with other timestamp fields.

Suggested change
TimestampMs uint64 `json:"timestampMs"`
TimestampMs uint64 `json:"timestampMs,omitempty"`

Copilot uses AI. Check for mistakes.
CodeHash []byte `json:"codeHash"`
}
1 change: 1 addition & 0 deletions data/scresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type ScResult struct {
CodeMetadata []byte `json:"codeMetaData,omitempty"`
ReturnMessage string `json:"returnMessage,omitempty"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
HasOperations bool `json:"hasOperations,omitempty"`
Type string `json:"type,omitempty"`
Status string `json:"status,omitempty"`
Expand Down
8 changes: 5 additions & 3 deletions data/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type TokenInfo struct {
Type string `json:"type,omitempty"`
Nonce uint64 `json:"nonce,omitempty"`
Timestamp time.Duration `json:"timestamp,omitempty"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
Data *TokenMetaData `json:"data,omitempty"`
OwnersHistory []*OwnerData `json:"ownersHistory,omitempty"`
TransferOwnership bool `json:"-"`
Expand All @@ -80,9 +81,10 @@ type TokenProperties struct {

// OwnerData is a structure that is needed to store information about an owner
type OwnerData struct {
TxHash string `json:"txHash,omitempty"`
Address string `json:"address"`
Timestamp time.Duration `json:"timestamp"`
TxHash string `json:"txHash,omitempty"`
Address string `json:"address"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
}

// TokensHandler defines the actions that a tokens' handler should do
Expand Down
14 changes: 8 additions & 6 deletions data/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Transaction struct {
Data []byte `json:"data"`
Signature string `json:"signature"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
Status string `json:"status"`
SearchOrder uint32 `json:"searchOrder"`
SenderUserName []byte `json:"senderUserName,omitempty"`
Expand Down Expand Up @@ -61,12 +62,13 @@ type Transaction struct {

// Receipt is a structure containing all the fields that need to be safe for a Receipt
type Receipt struct {
Hash string `json:"-"`
Value string `json:"value"`
Sender string `json:"sender"`
Data string `json:"data,omitempty"`
TxHash string `json:"txHash"`
Timestamp time.Duration `json:"timestamp"`
Hash string `json:"-"`
Value string `json:"value"`
Sender string `json:"sender"`
Data string `json:"data,omitempty"`
TxHash string `json:"txHash"`
Timestamp time.Duration `json:"timestamp"`
TimestampMs time.Duration `json:"timestampMs,omitempty"`
}

// PreparedResults is the DTO that holds all the results after processing
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0
github.com/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250606113953-9e4dc87c16cb
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20250520075408-c94bee9ee163
github.com/prometheus/client_model v0.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ 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/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476 h1:Dn73bH1AdG+7+3/FFRfOiivOEvwPyzZUBWWxpk8QVxc=
github.com/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476/go.mod h1:99+FW6f7X0Ri5tph+2l2GaDVrdej1do89exkfh7gilE=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39 h1:a+98PN1XXTCYiJEdg7gpqfTOxGuQqvA8H1yglidV/p0=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250606113953-9e4dc87c16cb h1:orPuViEu3dnElbfp6w2q1iokLQlTueb9akRpxfqe6IU=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250606113953-9e4dc87c16cb/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d h1:NI5uKpkwP5XZu9gtDiWxmbbb07T9hXegPist17WAzY4=
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d/go.mod h1:yekQt4uB5LYXtimbhpdUbnFexjucWrQG/t+AX55bdM8=
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273 h1:1I2CgGDAMINxrKI6yzSP/Y6Wow2YUmqegUXcltpGXQA=
Expand Down
3 changes: 2 additions & 1 deletion integrationtests/accountsBalanceNftTransfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ func createOutportBlockWithHeader(
return &outport.OutportBlockWithHeader{
OutportBlock: &outport.OutportBlock{
BlockData: &outport.BlockData{
Body: body,
Body: body,
TimestampMs: header.GetTimeStamp() * 1000,
},
TransactionPool: pool,
AlteredAccounts: coreAlteredAccounts,
Expand Down
2 changes: 1 addition & 1 deletion integrationtests/accountsESDTRollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestAccountsESDTDeleteOnRollback(t *testing.T) {
require.JSONEq(t, readExpectedResult("./testdata/accountsESDTRollback/account-after-create.json"), string(genericResponse.Docs[0].Source))

// DO ROLLBACK
err = esProc.RemoveAccountsESDT(5040, 2)
err = esProc.RemoveAccountsESDT(2, 5040000)
require.Nil(t, err)

err = esClient.DoMultiGet(context.Background(), ids, indexerdata.AccountsESDTIndex, true, genericResponse)
Expand Down
2 changes: 1 addition & 1 deletion integrationtests/delegators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestDelegateUnDelegateAndWithdraw(t *testing.T) {

// revert unDelegate 2
header.TimeStamp = 5060
err = esProc.RemoveTransactions(header, body)
err = esProc.RemoveTransactions(header, body, 5060000)
require.Nil(t, err)

time.Sleep(time.Second)
Expand Down
2 changes: 1 addition & 1 deletion integrationtests/logsCrossShard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestIndexLogSourceShardAndAfterDestinationAndAgainSource(t *testing.T) {
},
}

err = esProc.RemoveTransactions(header, body)
err = esProc.RemoveTransactions(header, body, header.TimeStamp*1000)
require.Nil(t, err)

err = esClient.DoMultiGet(context.Background(), ids, indexerdata.LogsIndex, true, genericResponse)
Expand Down
8 changes: 4 additions & 4 deletions integrationtests/miniblocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestIndexMiniBlocksOnSourceAndDestination(t *testing.T) {
ReceiverShardID: 2,
},
}
err = esProc.SaveMiniblocks(header, miniBlocks)
err = esProc.SaveMiniblocks(header, miniBlocks, 1234000)
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] This test uses a hardcoded millisecond value (1234000). To prevent mismatches if header.TimeStamp changes, consider computing it with header.TimeStamp * 1000.

Suggested change
err = esProc.SaveMiniblocks(header, miniBlocks, 1234000)
err = esProc.SaveMiniblocks(header, miniBlocks, header.TimeStamp*1000)

Copilot uses AI. Check for mistakes.
require.Nil(t, err)
mbHash := "11a1bb4065e16a2e93b2b5ac5957b7b69f1cfba7579b170b24f30dab2d3162e0"
ids := []string{mbHash}
Expand All @@ -57,7 +57,7 @@ func TestIndexMiniBlocksOnSourceAndDestination(t *testing.T) {
},
}

err = esProc.SaveMiniblocks(header, miniBlocks)
err = esProc.SaveMiniblocks(header, miniBlocks, 1234000)
require.Nil(t, err)

err = esClient.DoMultiGet(context.Background(), ids, indexerdata.MiniblocksIndex, true, genericResponse)
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestIndexMiniBlockFirstOnDestinationAndAfterSource(t *testing.T) {
},
}

err = esProc.SaveMiniblocks(header, miniBlocks)
err = esProc.SaveMiniblocks(header, miniBlocks, 54321000)
require.Nil(t, err)
genericResponse := &GenericResponse{}

Expand All @@ -116,7 +116,7 @@ func TestIndexMiniBlockFirstOnDestinationAndAfterSource(t *testing.T) {
Reserved: mbhrBytes,
},
}
err = esProc.SaveMiniblocks(header, miniBlocks)
err = esProc.SaveMiniblocks(header, miniBlocks, 54321000)
require.Nil(t, err)
err = esClient.DoMultiGet(context.Background(), ids, indexerdata.MiniblocksIndex, true, genericResponse)
require.Nil(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"tokenNonce": 7440483,
"token": "NFT-abcdef",
"timestamp": 5600,
"timestampMs": 5600000,
"shardID": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"tokenNonce": 7440483,
"token": "NFT-abcdef",
"timestamp": 5600,
"timestampMs": 5600000,
"shardID": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"balanceNum": 1e-15,
"token": "TTTT-abcd",
"timestamp": 5600,
"timestampMs": 5600000,
"type": "FungibleESDT",
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"balance": "1000",
"balanceNum": 1e-15,
"timestamp": 6000,
"timestampMs": 6000000,
"token": "TTTT-abcd",
"type": "FungibleESDT",
"shardID": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"balance": "0",
"balanceNum": 0,
"timestamp": 5600,
"timestampMs": 5600000,
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"balance": "2000",
"balanceNum": 0,
"timestamp": 6000,
"timestampMs": 6000000,
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"tokenNonce": 2,
"properties": "3032",
"token": "TOKEN-eeee",
"timestamp": 5040
"timestamp": 5040,
"timestampMs": 5040000
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"whiteListedStorage": false
},
"timestamp": 5600,
"timestampMs": 5600000,
"type": "SemiFungibleESDT",
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"whiteListedStorage": false
},
"timestamp": 5600,
"timestampMs": 5600000,
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"whiteListedStorage": false
},
"timestamp": 5600,
"timestampMs": 5600000,
"type": "SemiFungibleESDT",
"currentOwner":"erd1sqy2ywvswp09ef7qwjhv8zwr9kzz3xas6y2ye5nuryaz0wcnfzzsnq0am3",
"shardID": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"token": "TTTT-abcd",
"nonce": 2,
"timestamp": 5600,
"timestampMs": 5600000,
"data": {
"creator": "erd1l29zsl2dqq988kvr2y0xlfv9ydgnvhzkatfd8ccalpag265pje8qn8lslf",
"nonEmptyURIs": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"currentOwner": "erd1l29zsl2dqq988kvr2y0xlfv9ydgnvhzkatfd8ccalpag265pje8qn8lslf",
"type": "SemiFungibleESDT",
"timestamp": 5040,
"timestampMs": 5040000,
"ownersHistory": [
{
"address": "erd1l29zsl2dqq988kvr2y0xlfv9ydgnvhzkatfd8ccalpag265pje8qn8lslf",
"timestamp": 5040
"timestamp": 5040,
"timestampMs": 5040000
}
],
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"currentOwner": "erd1sqy2ywvswp09ef7qwjhv8zwr9kzz3xas6y2ye5nuryaz0wcnfzzsnq0am3",
"type": "SemiFungibleESDT",
"timestamp": 5040,
"timestampMs": 5040000,
"ownersHistory": [
{
"address": "erd1sqy2ywvswp09ef7qwjhv8zwr9kzz3xas6y2ye5nuryaz0wcnfzzsnq0am3",
"timestamp": 5040
"timestamp": 5040,
"timestampMs": 5040000
}
],
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"data": "Y2xhaW1SZXdhcmRz",
"signature": "",
"timestamp": 5040,
"timestampMs": 5040000,
"status": "success",
"searchOrder": 0,
"hasScResults": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"properties": "3032",
"token": "DESK-abcd",
"timestamp": 5600,
"timestampMs": 5600000,
"shardID": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"contract": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat",
"activeStake": "200000000000000000000",
"activeStakeNum": 200,
"timestamp": 5040
"timestamp": 5040,
"timestampMs": 5040000
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"activeStake": "124500000000000000000",
"activeStakeNum": 124.5,
"timestamp": 5060,
"timestampMs": 5060000,
"unDelegateInfo": [
{
"valueNum": 50,
"id": "31",
"value": "50000000000000000000",
"timestamp": 5050
"timestamp": 5050,
"timestampMs": 5050000
}
]
}
Loading
Loading