Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into consensus-det…
Browse files Browse the repository at this point in the history
…ailed-status
  • Loading branch information
td202 committed Oct 31, 2024
2 parents 7387015 + 4973c92 commit 3ab7485
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 132 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Support node version 8 and protocol version 8.
- Add command `consensus detailed-status` for getting detailed consensus status (from protocol
version 6).
- Add `raw GetConsensusDetailedStatus` that presents the detailed consensus status as JSON.
Expand Down
1 change: 1 addition & 0 deletions concordium-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ library
, prettyprinter-ansi-terminal
, proto-lens ==0.7.*
, scientific
, singletons-base
, split
, string-interpolate
, text
Expand Down
2 changes: 1 addition & 1 deletion deps/concordium-base
Submodule concordium-base updated 42 files
+2 −2 .github/workflows/build-test-contracts-common.yaml
+2 −2 .github/workflows/build-test-smart-contracts.yaml
+2 −2 .github/workflows/build-test-sources.yaml
+1 −0 concordium-base.cabal
+1 −1 concordium-grpc-api
+33 −0 haskell-bins/genesis/Genesis.hs
+3 −0 haskell-src/Concordium/Constants.hs
+1 −0 haskell-src/Concordium/Cost.hs
+32 −0 haskell-src/Concordium/GRPC2.hs
+19 −0 haskell-src/Concordium/Genesis/Data.hs
+143 −0 haskell-src/Concordium/Genesis/Data/P8.hs
+73 −0 haskell-src/Concordium/Genesis/Parameters.hs
+67 −6 haskell-src/Concordium/Types/Accounts.hs
+4 −0 haskell-src/Concordium/Types/Conditionally.hs
+36 −2 haskell-src/Concordium/Types/Execution.hs
+7 −0 haskell-src/Concordium/Types/Migration.hs
+81 −0 haskell-src/Concordium/Types/Parameters.hs
+69 −2 haskell-src/Concordium/Types/ProtocolVersion.hs
+6 −0 haskell-src/Concordium/Types/Queries.hs
+1 −0 haskell-src/Concordium/Types/SeedState.hs
+54 −0 haskell-src/Concordium/Types/UpdateQueues.hs
+1 −0 haskell-src/Concordium/Wasm.hs
+53 −5 haskell-tests/Generators.hs
+9 −0 haskell-tests/Genesis/ParametersSpec.hs
+12 −0 haskell-tests/Types/ParametersSpec.hs
+36 −10 haskell-tests/Types/PayloadSerializationSpec.hs
+4 −0 haskell-tests/Types/TransactionSummarySpec.hs
+2 −0 haskell-tests/Types/UpdatesSpec.hs
+2 −2 identity-provider-service/Cargo.lock
+2 −2 idiss/Cargo.lock
+4 −0 mobile_wallet/CHANGELOG.md
+3 −3 mobile_wallet/Cargo.lock
+1 −1 mobile_wallet/Cargo.toml
+16 −6 mobile_wallet/src/lib.rs
+2 −2 rust-bins/Cargo.lock
+17 −1 rust-src/concordium_base/src/transactions.rs
+1 −1 smart-contracts/contracts-common/concordium-contracts-common/src/schema.rs
+7 −0 smart-contracts/wasm-chain-integration/CHANGELOG.md
+2 −2 smart-contracts/wasm-chain-integration/Cargo.lock
+3 −3 smart-contracts/wasm-chain-integration/Cargo.toml
+2 −0 smart-contracts/wasm-transform/CHANGELOG.md
+1 −1 smart-contracts/wasm-transform/Cargo.toml
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ library:
- string-interpolate
- scientific
- cookie
- singletons-base

executables:
concordium-client:
Expand Down
8 changes: 8 additions & 0 deletions src/Concordium/Client/GRPC2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ instance FromProto Proto.AccountStakingInfo where
Nothing -> return NoChange
Just ch -> fmap timestampToUTCTime <$> fromProto ch
asiPoolInfo <- fromProtoMaybe $ baker ^. ProtoFields.maybe'poolInfo
let asiIsSuspended = baker ^. ProtoFields.isSuspended
return AccountStakingBaker{..}

instance FromProto Proto.ArThreshold where
Expand Down Expand Up @@ -842,6 +843,7 @@ instance FromProto Proto.ProtocolVersion where
Proto.PROTOCOL_VERSION_5 -> return P5
Proto.PROTOCOL_VERSION_6 -> return P6
Proto.PROTOCOL_VERSION_7 -> return P7
Proto.PROTOCOL_VERSION_8 -> return P8
Proto.ProtocolVersion'Unrecognized _ ->
fromProtoFail "Unable to convert 'ProtocolVersion'."

Expand Down Expand Up @@ -2270,6 +2272,12 @@ instance FromProto (Proto.AccountAddress, Proto.BakerEvent) where
let edrAccount = sender
edrDelegatorId <- fromProto $ delRemoved ^. ProtoFields.delegatorId
return DelegationRemoved{..}
ProtoFields.BakerEvent'BakerSuspended' bkrSuspended -> do
ebsBakerId <- fromProto $ bkrSuspended ^. ProtoFields.bakerId
return BakerSuspended{..}
ProtoFields.BakerEvent'BakerResumed' bkrResumed -> do
ebrBakerId <- fromProto $ bkrResumed ^. ProtoFields.bakerId
return BakerResumed{..}

instance FromProto Proto.BlockItemStatus where
type Output Proto.BlockItemStatus = TransactionStatus
Expand Down
247 changes: 137 additions & 110 deletions src/Concordium/Client/Output.hs

Large diffs are not rendered by default.

31 changes: 11 additions & 20 deletions src/Concordium/Client/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,20 +1145,14 @@ getNextPaydayTime = do
-- | Returns the UTCTime date when the baker cooldown on reducing stake/removing a baker will end, using on chain parameters
getBakerCooldown :: Queries.EChainParametersAndKeys -> ClientMonad IO UTCTime
getBakerCooldown (Queries.EChainParametersAndKeys (ecpParams :: ChainParameters' cpv) _) =
case Types.chainParametersVersion @cpv of
Types.SChainParametersV0 -> do
case sCooldownParametersVersionFor $ Types.chainParametersVersion @cpv of
SCooldownParametersVersion0 -> do
cs <- getResponseValueOrDie =<< getConsensusInfo
let epochTime = toInteger (Time.durationMillis $ Queries.csEpochDuration cs) % 1000
let cooldownTime = fromRational $ epochTime * ((cooldownEpochsV0 ecpParams + 2) % 1)
currTime <- liftIO getCurrentTime
return $ addUTCTime cooldownTime currTime
Types.SChainParametersV1 -> do
cooldownStart <- getNextPaydayTime
let cooldownDuration =
fromIntegral . Types.durationSeconds $
ecpParams ^. cpCooldownParameters . cpPoolOwnerCooldown
return $ addUTCTime cooldownDuration cooldownStart
Types.SChainParametersV2 -> do
SCooldownParametersVersion1 -> do
cooldownStart <- getNextPaydayTime
let cooldownDuration =
fromIntegral . Types.durationSeconds $
Expand All @@ -1171,14 +1165,10 @@ getBakerCooldown (Queries.EChainParametersAndKeys (ecpParams :: ChainParameters'
-- | Returns the UTCTime date when the delegator cooldown on reducing stake/removing delegation will end, using on chain parameters
getDelegatorCooldown :: Queries.EChainParametersAndKeys -> ClientMonad IO (Maybe UTCTime)
getDelegatorCooldown (Queries.EChainParametersAndKeys (ecpParams :: ChainParameters' cpv) _) = do
case Types.chainParametersVersion @cpv of
Types.SChainParametersV0 -> do
case sCooldownParametersVersionFor $ Types.chainParametersVersion @cpv of
SCooldownParametersVersion0 -> do
return Nothing
Types.SChainParametersV1 -> do
paydayTime <- getNextPaydayTime
let cooldownTime = fromIntegral . Types.durationSeconds $ ecpParams ^. cpCooldownParameters . cpDelegatorCooldown
return $ Just $ addUTCTime cooldownTime paydayTime
Types.SChainParametersV2 -> do
SCooldownParametersVersion1 -> do
paydayTime <- getNextPaydayTime
let cooldownTime = fromIntegral . Types.durationSeconds $ ecpParams ^. cpCooldownParameters . cpDelegatorCooldown
return $ Just $ addUTCTime cooldownTime paydayTime
Expand Down Expand Up @@ -1434,10 +1424,9 @@ getBakerStakeThresholdOrDie = do
case res of
Left err -> logFatal ["Could not retrieve the validator stake threshold: " <> err]
Right (Queries.EChainParametersAndKeys (ecpParams :: ChainParameters' cpv) _) ->
return $ case Types.chainParametersVersion @cpv of
Types.SChainParametersV0 -> ecpParams ^. cpPoolParameters . ppBakerStakeThreshold
Types.SChainParametersV1 -> ecpParams ^. cpPoolParameters . ppMinimumEquityCapital
Types.SChainParametersV2 -> ecpParams ^. cpPoolParameters . ppMinimumEquityCapital
return $ case sPoolParametersVersionFor $ Types.chainParametersVersion @cpv of
SPoolParametersVersion0 -> ecpParams ^. cpPoolParameters . ppBakerStakeThreshold
SPoolParametersVersion1 -> ecpParams ^. cpPoolParameters . ppMinimumEquityCapital

getAccountUpdateCredentialsTransactionData ::
-- | A file with new credentials.
Expand Down Expand Up @@ -3191,6 +3180,8 @@ processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCa
putStrLn ""
let cbMetadataURL = fmap (Types.UrlText . Text.pack) metadataURL
(bakerKeys, cbKeysWithProofs) <- readInputKeysFile baseCfg
-- TODO: support setting the suspend flag. Issue #326
let cbSuspend = Nothing
let payload = Types.encodePayload Types.ConfigureBaker{..}
nrgCost _ = case cbKeysWithProofs of
Nothing -> return . Just $ bakerConfigureEnergyCostWithoutKeys (Types.payloadSize payload)
Expand Down
3 changes: 2 additions & 1 deletion test/SimpleClientTests/AccountSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ exampleBakerInfoResult pc =
_bakerSignatureVerifyKey = snd $ unsafePerformIO newKeyPair
},
asiPendingChange = pc,
asiPoolInfo = Just exampleBakerPoolInfo
asiPoolInfo = Just exampleBakerPoolInfo,
asiIsSuspended = False
}

exampleDelegatorStakingInfo :: StakePendingChange' UTCTime -> AccountStakingInfo
Expand Down

0 comments on commit 3ab7485

Please sign in to comment.