diff --git a/cmd/indexer/indexer/indexer.go b/cmd/indexer/indexer/indexer.go index 6eba127f6..6eeed46da 100644 --- a/cmd/indexer/indexer/indexer.go +++ b/cmd/indexer/indexer/indexer.go @@ -250,7 +250,7 @@ func (bi *BlockchainIndexer) handleBlock(ctx context.Context, block *Block) erro return bi.StorageDB.DB.RunInTransaction(ctx, func(tx *pg.Tx) error { - if block.Header.Protocol != bi.currentProtocol.Hash || (bi.Network == types.Mainnet && block.Header.Level == 1) { + if block.Header.Protocol != bi.currentProtocol.Hash || bi.needVestingMigration(block.Header.Level) { logger.Info().Str("network", bi.Network.String()).Msgf("New protocol detected: %s -> %s", bi.currentProtocol.Hash, block.Header.Protocol) if err := bi.migrate(ctx, block.Header, tx); err != nil { @@ -417,7 +417,7 @@ func (bi *BlockchainIndexer) migrate(ctx context.Context, head noderpc.Header, t } } - if bi.Network == types.Mainnet && head.Level == 1 { + if bi.needVestingMigration(head.Level) { if err := bi.vestingMigration(ctx, head, tx); err != nil { return err } @@ -443,6 +443,13 @@ func (bi *BlockchainIndexer) migrate(ctx context.Context, head noderpc.Header, t return nil } +func (bi *BlockchainIndexer) needVestingMigration(level int64) bool { + return (bi.Network == types.Mainnet || + bi.Network == types.Dailynet || + bi.Network == types.Mondaynet) && + level == 1 +} + func (bi *BlockchainIndexer) implicitMigration(ctx context.Context, block *Block, protocol protocol.Protocol, store parsers.Store) error { if block == nil || block.Metadata == nil { return nil diff --git a/configs/testnets.yml b/configs/testnets.yml index 281569a16..c41a37136 100644 --- a/configs/testnets.yml +++ b/configs/testnets.yml @@ -17,6 +17,7 @@ storage: password: ${POSTGRES_PASSWORD} sslmode: disable timeout: 10 + log_queries: ${POSTGRES_LOG_QUERIES:-false} sentry: environment: development diff --git a/internal/noderpc/responses.go b/internal/noderpc/responses.go index 9a0a8ca29..90bdd79fc 100644 --- a/internal/noderpc/responses.go +++ b/internal/noderpc/responses.go @@ -65,9 +65,22 @@ type ContractData struct { Balance int64 `json:"balance,string"` Counter int64 `json:"counter,string"` Manager string `json:"manager"` - Delegate struct { - Value string `json:"value"` - } `json:"delegate"` + Delegate Delegate `json:"delegate"` +} + +type Delegate struct { + Value string `json:"value"` +} + +func (d *Delegate) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err == nil { + d.Value = s + return nil + } + + type buf Delegate + return json.Unmarshal(data, (*buf)(d)) } // OperationGroup - diff --git a/internal/parsers/migrations/jakarta.go b/internal/parsers/migrations/jakarta.go index 2cd8e91aa..f3a5b7118 100644 --- a/internal/parsers/migrations/jakarta.go +++ b/internal/parsers/migrations/jakarta.go @@ -67,6 +67,10 @@ func NewJakarta() *Jakarta { "KT1DrJV8vhkdLEj76h1H9Q4irZDqAkMPo1Qf": {}, "KT1D68BvUm9N1fcq6uaZnyZvmBkBvj9biyPu": {}, "KT1CT7S2b9hXNRxRrEcany9sak1qe4aaFAZJ": {}, + "KT1FHqsvc7vRS3u54L66DdMX4gb6QKqxJ1JW": {}, + "KT1QwBaLj5TRaGU3qkU4ZKKQ5mvNvyyzGBFv": {}, + "KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5": {}, + "KT1VqarPDicMFn1ejmQqqshUkUXTCTXwmkCN": {}, }, } }