diff --git a/Tzkt.Api.Tests/Tzkt.Api.Tests.csproj b/Tzkt.Api.Tests/Tzkt.Api.Tests.csproj index 5c494fb69..0e203c309 100644 --- a/Tzkt.Api.Tests/Tzkt.Api.Tests.csproj +++ b/Tzkt.Api.Tests/Tzkt.Api.Tests.csproj @@ -10,13 +10,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Tzkt.Api/Models/Accounts/Base/Account.cs b/Tzkt.Api/Models/Accounts/Base/Account.cs index 3f1357e76..26a832ddf 100644 --- a/Tzkt.Api/Models/Accounts/Base/Account.cs +++ b/Tzkt.Api/Models/Accounts/Base/Account.cs @@ -24,7 +24,7 @@ public abstract class Account public abstract string Address { get; set; } } - public class AccountJsonInheritanceConverter : JsonInheritanceConverter + public class AccountJsonInheritanceConverter : JsonInheritanceConverter { public AccountJsonInheritanceConverter(string name) : base(name) { } diff --git a/Tzkt.Api/Models/Operations/Base/Operation.cs b/Tzkt.Api/Models/Operations/Base/Operation.cs index 367dbb632..51cfe5e1a 100644 --- a/Tzkt.Api/Models/Operations/Base/Operation.cs +++ b/Tzkt.Api/Models/Operations/Base/Operation.cs @@ -61,7 +61,7 @@ public abstract class Operation public abstract long Id { get; set; } } - public class OperationJsonInheritanceConverter : JsonInheritanceConverter + public class OperationJsonInheritanceConverter : JsonInheritanceConverter { public OperationJsonInheritanceConverter(string name) : base(name) { } diff --git a/Tzkt.Api/Models/Operations/Base/OperationError.cs b/Tzkt.Api/Models/Operations/Base/OperationError.cs index 0e34d1b4a..6b17c5a11 100644 --- a/Tzkt.Api/Models/Operations/Base/OperationError.cs +++ b/Tzkt.Api/Models/Operations/Base/OperationError.cs @@ -20,7 +20,7 @@ public abstract class OperationError public abstract string Type { get; set; } } - public class OperationErrorJsonInheritanceConverter : JsonInheritanceConverter + public class OperationErrorJsonInheritanceConverter : JsonInheritanceConverter { public OperationErrorJsonInheritanceConverter(string name) : base(name) { } diff --git a/Tzkt.Api/Services/Cache/Accounts/AccountsCache.cs b/Tzkt.Api/Services/Cache/Accounts/AccountsCache.cs index d9407609c..7ef751d7e 100644 --- a/Tzkt.Api/Services/Cache/Accounts/AccountsCache.cs +++ b/Tzkt.Api/Services/Cache/Accounts/AccountsCache.cs @@ -45,7 +45,7 @@ public AccountsCache(NpgsqlDataSource dataSource, StateCache state, IConfigurati : (int)(limit * 1.1); using var db = DataSource.OpenConnection(); - using var reader = db.ExecuteReader($@"{SelectQuery} ORDER BY ""LastLevel"" DESC LIMIT @limit", new { limit }); + using IDataReader reader = db.ExecuteReader($@"{SelectQuery} ORDER BY ""LastLevel"" DESC LIMIT @limit", new { limit }); AccountsById = new Dictionary(capacity); AccountsByAddress = new Dictionary(capacity); @@ -98,7 +98,7 @@ public async Task UpdateAsync() #endregion await using var db = await DataSource.OpenConnectionAsync(); - using var reader = await db.ExecuteReaderAsync($@"{SelectQuery} WHERE ""LastLevel"" > @from", new { from }); + using IDataReader reader = await db.ExecuteReaderAsync($@"{SelectQuery} WHERE ""LastLevel"" > @from", new { from }); var parsers = new Func[6] { diff --git a/Tzkt.Api/Tzkt.Api.csproj b/Tzkt.Api/Tzkt.Api.csproj index 1876cfd6f..22fc53b1e 100644 --- a/Tzkt.Api/Tzkt.Api.csproj +++ b/Tzkt.Api/Tzkt.Api.csproj @@ -51,9 +51,9 @@ - - - + + + diff --git a/Tzkt.Data/Tzkt.Data.csproj b/Tzkt.Data/Tzkt.Data.csproj index 362ebfd9d..ae8c8a6c7 100644 --- a/Tzkt.Data/Tzkt.Data.csproj +++ b/Tzkt.Data/Tzkt.Data.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/Tzkt.Sync/Extensions/JsonElementExtension.cs b/Tzkt.Sync/Extensions/JsonElementExtension.cs index 3d48bed89..6aa15a8eb 100644 --- a/Tzkt.Sync/Extensions/JsonElementExtension.cs +++ b/Tzkt.Sync/Extensions/JsonElementExtension.cs @@ -141,6 +141,15 @@ public static BigInteger RequiredBigInteger(this JsonElement el, string name) : throw new SerializationException($"Missed required BigInteger {name}"); } + public static BigInteger? OptionalBigInteger(this JsonElement el, string name) + { + if (!el.TryGetProperty(name, out var prop)) + return null; + + return BigInteger.TryParse(prop.GetString(), out var res) ? res + : throw new SerializationException($"Invalid BigInteger {name}"); + } + public static bool TryGetBigInteger(this JsonElement el, string name, out BigInteger res) { res = BigInteger.Zero; diff --git a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoubleEndorsingCommit.cs b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoubleEndorsingCommit.cs index ca57d2d54..d4d686fcd 100644 --- a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoubleEndorsingCommit.cs +++ b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoubleEndorsingCommit.cs @@ -83,18 +83,19 @@ public void Revert(DoubleEndorsingOperation operation) { var branch = op.RequiredString("branch"); var content = op.Required("operations"); - var endorsement = new EndorsementContent + var attestation = new AttestationContent { Level = content.RequiredInt32("level"), Round = content.RequiredInt32("round"), Slot = content.RequiredInt32("slot"), - PayloadHash = content.RequiredString("block_payload_hash") + PayloadHash = content.RequiredString("block_payload_hash"), + DalAttestation = content.OptionalBigInteger("dal_attestation") }; var signature = Base58.Parse(op.RequiredString("signature"), 3); var bytes = new byte[1] { 19 } .Concat(Base58.Parse(chainId, 3)) - .Concat(await new LocalForge().ForgeOperationAsync(branch, endorsement)) + .Concat(await new LocalForge().ForgeOperationAsync(branch, attestation)) .ToArray(); foreach (var baker in Cache.Accounts.GetDelegates().OrderByDescending(x => x.LastLevel)) diff --git a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoublePreendorsingCommit.cs b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoublePreendorsingCommit.cs index c344516fc..bea066eba 100644 --- a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoublePreendorsingCommit.cs +++ b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/Operations/DoublePreendorsingCommit.cs @@ -83,7 +83,7 @@ public void Revert(DoublePreendorsingOperation operation) { var branch = op.RequiredString("branch"); var content = op.Required("operations"); - var preendorsement = new PreendorsementContent + var preattestation = new PreattestationContent { Level = content.RequiredInt32("level"), Round = content.RequiredInt32("round"), @@ -94,7 +94,7 @@ public void Revert(DoublePreendorsingOperation operation) var bytes = new byte[1] { 18 } .Concat(Base58.Parse(chainId, 3)) - .Concat(await new LocalForge().ForgeOperationAsync(branch, preendorsement)) + .Concat(await new LocalForge().ForgeOperationAsync(branch, preattestation)) .ToArray(); foreach (var baker in Cache.Accounts.GetDelegates().OrderByDescending(x => x.LastLevel)) diff --git a/Tzkt.Sync/Tzkt.Sync.csproj b/Tzkt.Sync/Tzkt.Sync.csproj index 26bf90aa4..a3a345b22 100644 --- a/Tzkt.Sync/Tzkt.Sync.csproj +++ b/Tzkt.Sync/Tzkt.Sync.csproj @@ -14,12 +14,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - +