Skip to content

Commit

Permalink
Merge pull request #329 from Concordium/suspend_resume
Browse files Browse the repository at this point in the history
Support for supend/resume transactions.
  • Loading branch information
drsk0 authored Nov 15, 2024
2 parents 4e58082 + 8c2d71a commit ecbca49
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Support node version 8 and protocol version 8.
- Support for suspend/resume in validator update transactions.
- 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
2 changes: 1 addition & 1 deletion deps/concordium-base
Submodule concordium-base updated 64 files
+1 −1 .github/workflows/build-test-contracts-common.yaml
+1 −1 .github/workflows/build-test-smart-contracts.yaml
+4 −4 .github/workflows/build-test-sources.yaml
+15 −0 .github/workflows/release-identity-provider-service.yaml
+3 −3 README.md
+41 −41 Setup.hs
+842 −535 identity-provider-service/Cargo.lock
+1 −1 identity-provider-service/Cargo.toml
+1 −1 identity-provider-service/src/bin/identity_verifier.rs
+0 −1 identity-provider-service/src/bin/main.rs
+374 −354 idiss/Cargo.lock
+1 −1 idiss/README.md
+13 −29 idiss/src/cs_exports.rs
+407 −428 mobile_wallet/Cargo.lock
+0 −11 mobile_wallet/Cargo.toml
+3 −0 mobile_wallet/src/lib.rs
+546 −543 rust-bins/Cargo.lock
+1 −1 rust-bins/src/bin/anonymity_revocation.rs
+1 −1 rust-bins/src/bin/keygen-genesis.rs
+0 −0 rust-src/.cargo/config.toml
+318 −285 rust-src/Cargo.lock
+1 −1 rust-src/concordium_base/Cargo.toml
+0 −2 rust-src/concordium_base/src/aggregate_sig/ffi.rs
+3 −1 rust-src/concordium_base/src/bulletproofs/inner_product_proof.rs
+1 −1 rust-src/concordium_base/src/common/version.rs
+1 −1 rust-src/concordium_base/src/ecvrf/public.rs
+0 −1 rust-src/concordium_base/src/encrypted_transfers/ffi.rs
+129 −93 rust-src/concordium_base/src/encrypted_transfers/proofs/generate_proofs.rs
+5 −8 rust-src/concordium_base/src/id/account_holder.rs
+2 −2 rust-src/concordium_base/src/id/chain.rs
+18 −20 rust-src/concordium_base/src/id/ffi.rs
+4 −1 rust-src/concordium_base/src/id/id_proof_types.rs
+1 −0 rust-src/concordium_base/src/id/id_prover.rs
+2 −0 rust-src/concordium_base/src/id/id_verifier.rs
+3 −2 rust-src/concordium_base/src/id/identity_provider.rs
+7 −4 rust-src/concordium_base/src/id/types.rs
+4 −3 rust-src/concordium_base/src/id/utils.rs
+2 −2 rust-src/concordium_base/src/random_oracle/mod.rs
+1 −0 rust-src/concordium_base/src/sigma_protocols/com_enc_eq.rs
+1 −0 rust-src/concordium_base/src/sigma_protocols/com_eq.rs
+2 −0 rust-src/concordium_base/src/sigma_protocols/common.rs
+2 −0 scripts/identity-provider-service.Dockerfile
+0 −0 smart-contracts/rust-contracts/example-contracts/counter/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/erc20/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/escrow/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/fib/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/lockup/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/rate-limited/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/simple-game/.cargo/config.toml
+0 −0 smart-contracts/rust-contracts/example-contracts/use-all-host-functions/.cargo/config.toml
+350 −339 smart-contracts/wasm-chain-integration/Cargo.lock
+1 −1 smart-contracts/wasm-chain-integration/benches/trie_benches.rs
+1 −1 smart-contracts/wasm-chain-integration/benches/wasm.rs
+3 −3 smart-contracts/wasm-chain-integration/src/utils.rs
+14 −14 smart-contracts/wasm-chain-integration/src/v0/mod.rs
+3 −1 smart-contracts/wasm-chain-integration/src/v1/ffi.rs
+21 −21 smart-contracts/wasm-chain-integration/src/v1/mod.rs
+6 −6 smart-contracts/wasm-chain-integration/src/v1/tests.rs
+2 −2 smart-contracts/wasm-test/Cargo.lock
+2 −2 smart-contracts/wasm-test/src/main.rs
+2 −2 smart-contracts/wasm-transform/src/machine.rs
+4 −4 smart-contracts/wasm-transform/src/parse.rs
+1 −1 smart-contracts/wasm-transform/src/tests.rs
+5 −1 stack.yaml
5 changes: 5 additions & 0 deletions src/Concordium/Client/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ data BakerCmd
bcTransactionFeeCommission :: !(Maybe AmountFraction),
bcBakingRewardCommission :: !(Maybe AmountFraction),
bcFinalizationRewardCommission :: !(Maybe AmountFraction),
bcSuspend :: !(Maybe Bool),
bcInputKeyFile :: !(Maybe FilePath),
bcOutputKeyFile :: !(Maybe FilePath)
}
Expand Down Expand Up @@ -1800,6 +1801,10 @@ bakerConfigureCmd =
<*> optional (option (eitherReader amountFractionFromStringInform) (long "delegation-transaction-fee-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on transaction fee rewards. " ++ rangesHelpString "transaction fee commission")))
<*> optional blockCommission
<*> optional (option (eitherReader amountFractionFromStringInform) (long "delegation-finalization-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on finalization rewards. " ++ rangesHelpString "finalization reward commission")))
<*> optional
( flag' True (long "suspend" <> help "Suspend the validator. The validator will not participate in the consensus anymore.")
<|> flag' False (long "resume" <> help "Resume the validator.")
)
<*> optional (strOption (long "keys-in" <> metavar "FILE" <> help "File containing validator credentials."))
<*> optional (strOption (long "keys-out" <> metavar "FILE" <> help "File to write updated validator credentials to, in case of successful transaction. These can be used to start the node."))
)
Expand Down
24 changes: 12 additions & 12 deletions src/Concordium/Client/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3009,12 +3009,14 @@ processBakerConfigureCmd ::
Maybe Types.AmountFraction ->
-- | Finalization commission.
Maybe Types.AmountFraction ->
-- | Whether to suspend/resume baker.
Maybe Bool ->
-- | File to read baker keys from.
Maybe FilePath ->
-- | File to write baker keys to.
Maybe FilePath ->
IO ()
processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCapital cbRestakeEarnings cbOpenForDelegation metadataURL cbTransactionFeeCommission cbBakingRewardCommission cbFinalizationRewardCommission inputKeysFile outputKeysFile = do
processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCapital cbRestakeEarnings cbOpenForDelegation metadataURL cbTransactionFeeCommission cbBakingRewardCommission cbFinalizationRewardCommission cbSuspend inputKeysFile outputKeysFile = do
let intOpts = toInteractionOpts txOpts
let outFile = toOutFile txOpts
(bakerKeys, txCfg, pl) <- transactionForBakerConfigure (ioConfirm intOpts)
Expand Down Expand Up @@ -3180,8 +3182,6 @@ 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 Expand Up @@ -3744,7 +3744,7 @@ processBakerUpdateStakeCmd baseCfgDir verbose backend txOpts newStake = do
askConfirmation $ Just "confirm that you want to remove validator"
else return True
when ok $
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just newStake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just newStake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing

-- | Process a 'baker ...' command.
processBakerCmd :: BakerCmd -> Maybe FilePath -> Verbose -> Backend -> IO ()
Expand Down Expand Up @@ -3807,23 +3807,23 @@ processBakerCmd action baseCfgDir verbose backend =
transactionFeeCommission = ebadTransactionFeeCommission <$> extraData
bakingRewardCommission = ebadBakingRewardCommission <$> extraData
finalizationRewardCommission = ebadFinalizationRewardCommission <$> extraData
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just initialStake) (Just autoRestake) openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission (Just bakerKeysFile) outputFile
BakerConfigure txOpts capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission inputKeysFile outputKeysFile ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts True capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission inputKeysFile outputKeysFile
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just initialStake) (Just autoRestake) openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission Nothing (Just bakerKeysFile) outputFile
BakerConfigure txOpts capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission suspend inputKeysFile outputKeysFile ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts True capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission suspend inputKeysFile outputKeysFile
BakerSetKeys file txOpts outfile -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerSetKeysCmd baseCfgDir verbose backend txOpts file outfile
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing Nothing Nothing Nothing Nothing (Just file) outfile
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing (Just file) outfile
BakerRemove txOpts -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerRemoveCmd baseCfgDir verbose backend txOpts
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just 0) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just 0) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateStake newStake txOpts -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
Expand All @@ -3837,11 +3837,11 @@ processBakerCmd action baseCfgDir verbose backend =
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerUpdateRestakeCmd baseCfgDir verbose backend txOpts restake
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing (Just restake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing (Just restake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateMetadataURL url txOpts ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing (Just url) Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing (Just url) Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateOpenDelegationStatus status txOpts ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing (Just status) Nothing Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing (Just status) Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerGetEarliestWinTime bakerId useLocalTime doPoll -> do
winTimestamp <- getWinTimestamp
putStrLn [i|Validator #{bakerId} is expected to produce a block no sooner than:|]
Expand Down

0 comments on commit ecbca49

Please sign in to comment.