Skip to content

Commit

Permalink
Merge branch 'develop' into dev-tools/sig-convert
Browse files Browse the repository at this point in the history
  • Loading branch information
lzpap authored Oct 31, 2024
2 parents 9850409 + ab851b5 commit a0fcee8
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 83 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/fastcrypto_pull.yml

This file was deleted.

2 changes: 1 addition & 1 deletion crates/iota-core/tests/staged/iota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ ExecutionFailureStatus:
29:
CertificateDenied: UNIT
30:
IotaMoveVerificationTimedout: UNIT
IotaMoveVerificationTimeout: UNIT
31:
SharedObjectOperationNotAllowed: UNIT
32:
Expand Down
9 changes: 8 additions & 1 deletion crates/iota-rest-api/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,7 @@
"error": {
"type": "string",
"enum": [
"iota_move_verification_timedout"
"iota_move_verification_timeout"
]
}
}
Expand Down Expand Up @@ -4394,10 +4394,17 @@
{
"type": "object",
"required": [
"events",
"kind",
"objects"
],
"properties": {
"events": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Event"
}
},
"kind": {
"type": "string",
"enum": [
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-types/tests/staged/exec_failure_status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
27: PackageUpgradeError
28: WrittenObjectsTooLarge
29: CertificateDenied
30: IotaMoveVerificationTimedout
30: IotaMoveVerificationTimeout
31: SharedObjectOperationNotAllowed
32: InputObjectDeleted
33: ExecutionCancelledDueToSharedObjectCongestion
Expand Down
24 changes: 18 additions & 6 deletions crates/iota/genesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,28 @@ $ iota genesis-ceremony add-validator \
--project-url https://www.iota.org
```

3. Add token allocation for the faucet
3. Initialize token-distribution schedule

Add allocation for any faucet that might have been launched.
Set the initial token-distribution schedule through a csv file. E.g.

```csv
recipient-address,amount-nanos,staked-with-validator,staked-with-timelock-expiration
<faucet-address>,1500000000000000,,
<validator-1-address>,1500000000000000,<validator-1-address>,
<validator-2-address>,1500000000000000,<validator-2-address>,
```
$ iota genesis-ceremony add-token-allocation \
--recipient-address <IotaAddress> \
--amount-nanos <# of iota coins>

This is useful for allocating funds for a faucet, or for distributing the initial
stake to validators.

The resulting distribution schedule is amended only if any migration sources are
passed in the "Build Genesis" step.

```
$ iota genesis-ceremony init-token-distribution-schedule \
--token-allocations-path <path-to-token-allocations-csv-file>
$ git add .
$ git commit -m "add faucet token allocation"
$ git commit -m "initialize token distribution schedule"
$ git push
```

Expand Down
45 changes: 20 additions & 25 deletions crates/iota/src/genesis_ceremony.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::path::PathBuf;
use std::{fs::File, path::PathBuf};

use anyhow::Result;
use camino::Utf8PathBuf;
use clap::Parser;
use fastcrypto::encoding::{Encoding, Hex};
use iota_config::{
IOTA_GENESIS_FILENAME,
genesis::{TokenAllocation, TokenDistributionScheduleBuilder, UnsignedGenesis},
genesis::{TokenDistributionScheduleBuilder, UnsignedGenesis},
};
use iota_genesis_builder::{
Builder, GENESIS_BUILDER_PARAMETERS_FILE, SnapshotSource, SnapshotUrl,
Expand Down Expand Up @@ -95,12 +95,14 @@ pub enum CeremonyCommand {
#[clap(long)]
project_url: Option<String>,
},
/// Add token allocation for the given address.
AddTokenAllocation {
#[clap(long)]
recipient_address: IotaAddress,
#[clap(long)]
amount_nanos: u64,
/// Initialize token distribution schedule.
InitTokenDistributionSchedule {
#[clap(
long,
help = "The path to the csv file with the token allocations",
name = "token_allocations.csv"
)]
token_allocations_path: PathBuf,
},
/// List the current validators in the Genesis builder.
ListValidators,
Expand All @@ -113,12 +115,7 @@ pub enum CeremonyCommand {
)]
#[arg(num_args(0..))]
local_migration_snapshots: Vec<PathBuf>,
#[clap(
long,
name = "iota|<full-url>",
help = "Remote migration snapshots.",
default_values_t = vec![SnapshotUrl::Iota],
)]
#[clap(long, name = "iota|<full-url>", help = "Remote migration snapshots.")]
#[arg(num_args(0..))]
remote_migration_snapshots: Vec<SnapshotUrl>,
},
Expand Down Expand Up @@ -163,21 +160,19 @@ pub async fn run(cmd: Ceremony) -> Result<()> {
);
}

CeremonyCommand::AddTokenAllocation {
recipient_address,
amount_nanos,
CeremonyCommand::InitTokenDistributionSchedule {
token_allocations_path,
} => {
let mut builder = Builder::load(&dir).await?;
let token_allocation = TokenAllocation {
recipient_address,
amount_nanos,
staked_with_validator: None,
staked_with_timelock_expiration: None,
};
let mut schedule_builder = TokenDistributionScheduleBuilder::new();
schedule_builder.add_allocation(token_allocation);
builder = builder.with_token_distribution_schedule(schedule_builder.build());

let token_allocations_csv = File::open(token_allocations_path)?;
let mut reader = csv::Reader::from_reader(token_allocations_csv);
for allocation in reader.deserialize() {
schedule_builder.add_allocation(allocation?);
}

builder = builder.with_token_distribution_schedule(schedule_builder.build());
builder.save(dir)?;
}

Expand Down
29 changes: 20 additions & 9 deletions docs/content/references/cli/ceremony.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: IOTA Genesis Ceremony CLI
description: The IOTA Genesis Ceremony CLI provides commands for building a Genesis blob file.
---

The IOTA CLI `genesis-ceremony` command allows the orchestration of an IOTA Genesis Ceremony,
The IOTA CLI `genesis-ceremony` command allows the orchestration of an IOTA Genesis Ceremony,
where multiple remote validators can sign a genesis blob. Each step persists in a file structure
that can be shared (for instance, via GitHub) with the validators.

Expand Down Expand Up @@ -41,7 +41,7 @@ The following example demonstrates how to build a genesis blob.

### Initialize the Genesis Builder

This command creates a structure in the file system to persist the genesis builder.
This command creates a structure in the file system to persist the genesis builder.
Afterward, the below commands can be used to set additional configurations.

```shell
Expand Down Expand Up @@ -126,15 +126,26 @@ validator1 0xba55e3ce221bb7edfbbef4d59b68893f5550b6302a9456b738ad8cf06919be0

</details>

### Add Token Allocation
### Initialize the Token Distribution Schedule

This command allocates tokens to a given address for the genesis transaction,
and can be used to provide tokens to the faucet address.
Set the initial token distribution schedule through a `.csv` file:

```csv
recipient-address,amount-nanos,staked-with-validator,staked-with-timelock-expiration
<faucet-address>,1500000000000000,,
<validator-1-address>,1500000000000000,<validator-1-address>,
<validator-2-address>,1500000000000000,<validator-2-address>,
```

This is useful for allocating funds for a faucet, or for distributing the initial
stake to validators.

The resulting distribution schedule is amended only if any migration sources are
passed in the [Build the Unsigned Checkpoint](#build-the-unsigned-checkpoint) step.

```shell
iota genesis-ceremony add-token-allocation \
--recipient-address 0x923f43e0d325cd298c28a148858bb755921cfb032deeb0d2fb7772d6b4b168e0 \
--amount-nanos 1500000000000000
$ iota genesis-ceremony init-token-distribution-schedule \
--token-allocations-path <path-to-token-allocations-csv-file>
```

### Validate the Genesis State
Expand All @@ -153,7 +164,7 @@ iota genesis-ceremony build-unsigned-checkpoint

### Examine the Genesis Checkpoint

This command opens the Genesis Inspector, a responsive command-line tool which allows viewing various
This command opens the Genesis Inspector, a responsive command-line tool which allows viewing various
attributes of the current built checkpoint.

```shell
Expand Down

0 comments on commit a0fcee8

Please sign in to comment.