Skip to content

Commit

Permalink
Make internal ids deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
MS authored and Groxan committed Sep 19, 2022
1 parent 4b16f87 commit 39bd91e
Show file tree
Hide file tree
Showing 124 changed files with 568 additions and 257 deletions.
22 changes: 11 additions & 11 deletions Tzkt.Api/Controllers/OperationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ public async Task<ActionResult<IEnumerable<OriginationOperation>>> GetOriginatio
AccountParameter contractManager,
AccountParameter contractDelegate,
AccountParameter originatedContract,
Int32Parameter id,
Int64Parameter id,
Int32Parameter typeHash,
Int32Parameter codeHash,
Int32Parameter level,
Expand Down Expand Up @@ -2111,7 +2111,7 @@ public async Task<ActionResult<IEnumerable<TransactionOperation>>> GetTransactio
AccountParameter sender,
AccountParameter target,
Int64Parameter amount,
Int32Parameter id,
Int64Parameter id,
Int32Parameter level,
DateTimeParameter timestamp,
Int32Parameter senderCodeHash,
Expand Down Expand Up @@ -4365,7 +4365,7 @@ public async Task<ActionResult<IEnumerable<MigrationOperation>>> GetMigrations(
AccountParameter account,
MigrationKindParameter kind,
Int64Parameter balanceChange,
Int32Parameter id,
Int64Parameter id,
Int32Parameter level,
DateTimeParameter timestamp,
SelectParameter select,
Expand Down Expand Up @@ -4439,9 +4439,9 @@ public async Task<ActionResult<IEnumerable<MigrationOperation>>> GetMigrations(
/// <param name="micheline">Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string</param>
/// <param name="quote">Comma-separated list of ticker symbols to inject historical prices into response</param>
/// <returns></returns>
[HttpGet("migrations/{id:int}")]
[HttpGet("migrations/{id:long}")]
public async Task<ActionResult<MigrationOperation>> GetMigrationById(
[Required][Min(0)] int id,
[Required][Min(0)] long id,
MichelineFormat micheline = MichelineFormat.Json,
Symbols quote = Symbols.None)
{
Expand Down Expand Up @@ -4574,9 +4574,9 @@ public async Task<ActionResult<IEnumerable<RevelationPenaltyOperation>>> GetReve
/// <param name="id">Operation id</param>
/// <param name="quote">Comma-separated list of ticker symbols to inject historical prices into response</param>
/// <returns></returns>
[HttpGet("revelation_penalties/{id:int}")]
[HttpGet("revelation_penalties/{id:long}")]
public async Task<ActionResult<RevelationPenaltyOperation>> GetRevelationPenaltyById(
[Required][Min(0)] int id,
[Required][Min(0)] long id,
Symbols quote = Symbols.None)
{
var query = ResponseCacheService.BuildKey(Request.Path.Value,
Expand Down Expand Up @@ -4739,9 +4739,9 @@ public async Task<ActionResult<IEnumerable<BakingOperation>>> GetBaking(
/// <param name="id">Operation id</param>
/// <param name="quote">Comma-separated list of ticker symbols to inject historical prices into response</param>
/// <returns></returns>
[HttpGet("baking/{id:int}")]
[HttpGet("baking/{id:long}")]
public async Task<ActionResult<BakingOperation>> GetBakingById(
[Required][Min(0)] int id,
[Required][Min(0)] long id,
Symbols quote = Symbols.None)
{
var query = ResponseCacheService.BuildKey(Request.Path.Value,
Expand Down Expand Up @@ -4873,9 +4873,9 @@ public async Task<ActionResult<IEnumerable<EndorsingRewardOperation>>> GetEndors
/// <param name="id">Operation id</param>
/// <param name="quote">Comma-separated list of ticker symbols to inject historical prices into response</param>
/// <returns></returns>
[HttpGet("endorsing_rewards/{id:int}")]
[HttpGet("endorsing_rewards/{id:long}")]
public async Task<ActionResult<EndorsingRewardOperation>> GetEndorsingRewardById(
[Required][Min(0)] int id,
[Required][Min(0)] long id,
Symbols quote = Symbols.None)
{
var query = ResponseCacheService.BuildKey(Request.Path.Value,
Expand Down
5 changes: 4 additions & 1 deletion Tzkt.Api/Controllers/TokensController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public Task<int> GetTokensCount([FromQuery] TokenFilter filter)
filter.lastTime != null ||
filter.lastLevel != null ||
filter.tokenId != null ||
filter.id != null)
filter.id != null ||
filter.indexedAt != null)
return Tokens.GetTokensCount(filter);

return Task.FromResult(State.Current.TokensCount);
Expand Down Expand Up @@ -95,6 +96,7 @@ public async Task<ActionResult<int>> GetTokenBalancesCount([FromQuery] TokenBala
filter.firstLevel != null ||
filter.lastTime != null ||
filter.lastLevel != null ||
filter.indexedAt != null ||
filter.id != null ||
filter.token.id != null ||
filter.token.contract != null ||
Expand Down Expand Up @@ -177,6 +179,7 @@ public Task<int> GetTokenTransfersCount([FromQuery] TokenTransferFilter filter)
filter.transactionId != null ||
filter.originationId != null ||
filter.migrationId != null ||
filter.indexedAt != null ||
filter.token.id != null ||
filter.token.contract != null ||
filter.token.tokenId != null ||
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/ContractEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ContractEvent
/// <summary>
/// Internal TzKT id of the transaction operation, caused the event.
/// </summary>
public int TransactionId { get; set; }
public long TransactionId { get; set; }

/// <summary>
/// Michelson type of the payload.
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/ActivationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ActivationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block, from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/BakingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class BakingOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// Height of the block from the genesis
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/BallotOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BallotOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/Base/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public abstract int Id { get; set; }
public abstract long Id { get; set; }
}

public class OperationJsonInheritanceConverter : JsonInheritanceConverter
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/DelegationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DelegationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/DoubleBakingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DoubleBakingOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// Height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/DoubleEndorsingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DoubleEndorsingOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// Height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/DoublePreendorsingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class DoublePreendorsingOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// Height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/EndorsementOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class EndorsementOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/EndorsingRewardOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class EndorsingRewardOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// Height of the block from the genesis
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/IncreasePaidStorageOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class IncreasePaidStorageOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/MigrationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MigrationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/NonceRevelationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class NonceRevelationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/OriginationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OriginationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/PreendorsementOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class PreendorsementOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/ProposalOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ProposalOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/RegisterConstantOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RegisterConstantOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/RevealOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class RevealOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/RevelationPenaltyOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class RevelationPenaltyOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SetDepositsLimitOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TransactionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TransactionOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TransferTicketOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TransferTicketOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TxRollupCommitOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupCommitOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupDispatchTicketsOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupFinalizeCommitmentOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TxRollupOriginationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupOriginationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TxRollupRejectionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupRejectionOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupRemoveCommitmentOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TxRollupReturnBondOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupReturnBondOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/TxRollupSubmitBatchOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TxRollupSubmitBatchOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Operations/VdfRevelationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class VdfRevelationOperation : Operation
/// <summary>
/// Unique ID of the operation, stored in the TzKT indexer database
/// </summary>
public override int Id { get; set; }
public override long Id { get; set; }

/// <summary>
/// The height of the block from the genesis block, in which the operation was included
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Models/Tokens/Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Token
/// Internal TzKT id (not the same as `tokenId`).
/// **[sortable]**
/// </summary>
public int Id { get; set; }
public long Id { get; set; }

/// <summary>
/// Contract, created the token.
Expand Down
Loading

0 comments on commit 39bd91e

Please sign in to comment.