diff --git a/backend/Application/Api/GraphQL/ChainParameters.cs b/backend/Application/Api/GraphQL/ChainParameters.cs index a1fb9fe1a..f672d9d8e 100644 --- a/backend/Application/Api/GraphQL/ChainParameters.cs +++ b/backend/Application/Api/GraphQL/ChainParameters.cs @@ -59,6 +59,7 @@ internal static ChainParameters From(IChainParameters chainParameters) Concordium.Sdk.Types.ChainParametersV0 chainParametersV0 => ChainParametersV0.From(chainParametersV0), Concordium.Sdk.Types.ChainParametersV1 chainParametersV1 => ChainParametersV1.From(chainParametersV1), Concordium.Sdk.Types.ChainParametersV2 chainParametersV2 => ChainParametersV2.From(chainParametersV2), + Concordium.Sdk.Types.ChainParametersV3 chainParametersV3 => ChainParametersV3.From(chainParametersV3), _ => throw new NotImplementedException() }; } diff --git a/backend/Application/Api/GraphQL/ChainParametersV3.cs b/backend/Application/Api/GraphQL/ChainParametersV3.cs new file mode 100644 index 000000000..14a2434fd --- /dev/null +++ b/backend/Application/Api/GraphQL/ChainParametersV3.cs @@ -0,0 +1,51 @@ +using Application.Api.GraphQL.Accounts; +using Application.Api.GraphQL.Extensions; + +namespace Application.Api.GraphQL; + +public class ChainParametersV3 : ChainParameters, IEquatable +{ + public ulong RewardPeriodLength { get; init; } + + internal static ChainParametersV3 From(Concordium.Sdk.Types.ChainParametersV3 input) + { + return new ChainParametersV3 + { + EuroPerEnergy = ExchangeRate.From(input.EuroPerEnergy), + MicroCcdPerEuro = ExchangeRate.From(input.MicroCcdPerEuro), + AccountCreationLimit = (int)input.AccountCreationLimit.Limit, + FoundationAccountAddress = AccountAddress.From(input.FoundationAccount), + RewardPeriodLength = input.TimeParameters.RewardPeriodLength.RewardPeriodEpochs.Count, + }; + + } + + public bool Equals(ChainParametersV3? other) + { + return other != null && + base.Equals(other) && + RewardPeriodLength == other.RewardPeriodLength; + } + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals(obj as ChainParametersV3); + } + + public override int GetHashCode() + { + return Id; + } + + public static bool operator ==(ChainParametersV3? left, ChainParametersV3? right) + { + return Equals(left, right); + } + + public static bool operator !=(ChainParametersV3? left, ChainParametersV3? right) + { + return !Equals(left, right); + } +} diff --git a/backend/CHANGELOG.md b/backend/CHANGELOG.md index 2241633f5..ed8faa75e 100644 --- a/backend/CHANGELOG.md +++ b/backend/CHANGELOG.md @@ -1,5 +1,11 @@ ## Unreleased changes +## 1.10.0 + +- Added + - Minimal support for Concordium Protocol Version 8. + - Introduce `ChainParametersV3` in the GraphQL API. + ## 1.9.2 - Bugfix diff --git a/backend/Tests/Aggregates/Contract/ContractAggregateTests.cs b/backend/Tests/Aggregates/Contract/ContractAggregateTests.cs index a506491c8..97a71091d 100644 --- a/backend/Tests/Aggregates/Contract/ContractAggregateTests.cs +++ b/backend/Tests/Aggregates/Contract/ContractAggregateTests.cs @@ -177,7 +177,9 @@ public async Task GivenContractInitialization_WhenNodeImport_ThenStoreContractEv new ContractAddress(contractIndex, 0), CcdAmount.Zero, contractNameParse.ContractName!, - new List()) + new List(), + null + ) ); var client = new Mock(); var transactionDetails = new AccountTransactionDetailsBuilder(contractInitialized) diff --git a/backend/Tests/Aggregates/Contract/Jobs/_05_CisEventReinitializationTests.cs b/backend/Tests/Aggregates/Contract/Jobs/_05_CisEventReinitializationTests.cs index 58c1a6295..86dde34ba 100644 --- a/backend/Tests/Aggregates/Contract/Jobs/_05_CisEventReinitializationTests.cs +++ b/backend/Tests/Aggregates/Contract/Jobs/_05_CisEventReinitializationTests.cs @@ -200,7 +200,8 @@ public async Task WhenGetOrderedContractEvents_ThenGetOrderedContractEvents() contractAddress, CcdAmount.Zero, contractNameOutput.ContractName!, - new List() + new List(), + null )); var contractInitializedEvent = ContractEventBuilder.Create() .WithContractAddress(address) diff --git a/backend/Tests/Api/GraphQL/Import/BakerImportHandlerTests.cs b/backend/Tests/Api/GraphQL/Import/BakerImportHandlerTests.cs index 9e8bb403c..fa3b426ff 100644 --- a/backend/Tests/Api/GraphQL/Import/BakerImportHandlerTests.cs +++ b/backend/Tests/Api/GraphQL/Import/BakerImportHandlerTests.cs @@ -104,7 +104,8 @@ public async Task WhenUpdateCurrentPaydayStatusOnAllBakers_ThenBakersUpdates() ), afterStatus, CcdAmount.Zero, - null + null, + false ); var bakerPoolStatuses = () => Task.FromResult(new[] { bakerPoolStatus }); @@ -225,7 +226,8 @@ public async Task TestFirstBlockAfterPaydayBakerAddition() ""), null, CcdAmount.Zero, - null + null, + false ) }); diff --git a/backend/Tests/Api/GraphQL/Import/BakerWriterTest.cs b/backend/Tests/Api/GraphQL/Import/BakerWriterTest.cs index ad1846637..b2a2652c9 100644 --- a/backend/Tests/Api/GraphQL/Import/BakerWriterTest.cs +++ b/backend/Tests/Api/GraphQL/Import/BakerWriterTest.cs @@ -128,7 +128,8 @@ public async Task UpdateBakersFromAccountBaker() PendingChange: new AccountBakerRemovePending(_anyDateTimeOffset), RestakeEarnings: false, StakedAmount: CcdAmount.Zero, - BakerPoolInfo: null + BakerPoolInfo: null, + IsSuspended: false ) }; diff --git a/backend/Tests/Api/GraphQL/Import/TransactionsWriterTest.cs b/backend/Tests/Api/GraphQL/Import/TransactionsWriterTest.cs index 1a233a6dc..13d667f90 100644 --- a/backend/Tests/Api/GraphQL/Import/TransactionsWriterTest.cs +++ b/backend/Tests/Api/GraphQL/Import/TransactionsWriterTest.cs @@ -638,7 +638,10 @@ public async Task TransactionEvents_ContractInitialized() { new(Convert.FromHexString(firstEvent)), new(Convert.FromHexString(secondEvent)) - })); + }, + null + ) + ); var accountTransactionDetails = new AccountTransactionDetailsBuilder(contractInitialized) .Build(); diff --git a/backend/Tests/Api/GraphQL/__snapshots__/committed-schema.verified.graphql b/backend/Tests/Api/GraphQL/__snapshots__/committed-schema.verified.graphql index c862dc18c..c06265109 100644 --- a/backend/Tests/Api/GraphQL/__snapshots__/committed-schema.verified.graphql +++ b/backend/Tests/Api/GraphQL/__snapshots__/committed-schema.verified.graphql @@ -706,6 +706,14 @@ type ChainParametersV2 implements ChainParameters { foundationAccountAddress: AccountAddress! } +type ChainParametersV3 implements ChainParameters { + rewardPeriodLength: UnsignedLong! + euroPerEnergy: ExchangeRate! + microCcdPerEuro: ExchangeRate! + accountCreationLimit: Int! + foundationAccountAddress: AccountAddress! +} + type ChainUpdateEnqueued { effectiveTime: DateTime! effectiveImmediately: Boolean! @@ -2127,7 +2135,7 @@ enum AccountTransactionType { SIMPLE_TRANSFER "Transfer encrypted amount." ENCRYPTED_TRANSFER - "Same as transfer, but with a memo field." + "Same as transfer but with a memo field." SIMPLE_TRANSFER_WITH_MEMO "Same as encrypted transfer, but with a memo." ENCRYPTED_TRANSFER_WITH_MEMO @@ -2196,9 +2204,9 @@ enum ContractVersion { "Enumeration of the types of credentials." enum CredentialDeploymentTransactionType { - "Initial credential is a credential that is submitted by the identity\nprovider on behalf of the user. There is at most one initial credential\nper identity." + "Initial credential is a credential that is submitted by the identity\nprovider on behalf of the user. There is only one initial credential\nper identity." INITIAL - "A normal credential is one where the identity behind it is only known to\nthe owner of the account, unless the identity disclosure process was\nhas been initiated." + "A normal credential is one where the identity behind it is only known to\nthe owner of the account, unless the anonymity revocation process was\nfollowed." NORMAL } @@ -2307,6 +2315,8 @@ enum UpdateTransactionType { BLOCK_ENERGY_LIMIT_UPDATE "Update of finalization committee parameters." FINALIZATION_COMMITTEE_PARAMETERS_UPDATE + "Update of validator score parameters." + VALIDATOR_SCORE_PARAMETERS_UPDATE } "The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions." diff --git a/backend/Tests/Database/MigrationJobs/_00_UpdateValidatorCommissionRatesTests.cs b/backend/Tests/Database/MigrationJobs/_00_UpdateValidatorCommissionRatesTests.cs index f73dca01c..3ef12d22c 100644 --- a/backend/Tests/Database/MigrationJobs/_00_UpdateValidatorCommissionRatesTests.cs +++ b/backend/Tests/Database/MigrationJobs/_00_UpdateValidatorCommissionRatesTests.cs @@ -97,7 +97,8 @@ decimal blockCommission AmountFraction.From(blockCommission)), BakerPoolOpenStatus.OpenForAll, ""), null, - CcdAmount.Zero, null + CcdAmount.Zero, null, + false ); } diff --git a/backend/concordium-net-sdk b/backend/concordium-net-sdk index 66f608b19..5ab495089 160000 --- a/backend/concordium-net-sdk +++ b/backend/concordium-net-sdk @@ -1 +1 @@ -Subproject commit 66f608b19cc8c93a37582cf9c16056ef73a749eb +Subproject commit 5ab495089d3313c11c88034599c5d31df73b478d