Skip to content

Commit

Permalink
Clenaup before code freeze (#572)
Browse files Browse the repository at this point in the history
* Clenaup before code freeze

* updated code
  • Loading branch information
markopoloparadox authored Apr 26, 2024
1 parent 7f288d1 commit 0980715
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 110 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ A development chain is typically used for testing and development purposes.
cargo run --locked --release -- --dev
```

#### Testnet New
#### Testnet Turing
```bash
cargo run --locked --release -- --chain new
cargo run --locked --release -- --chain turing
```

#### Mainnet
Expand Down
107 changes: 1 addition & 106 deletions changelog_migrations.md
Original file line number Diff line number Diff line change
@@ -1,106 +1 @@
# Introduction
Label Legend:
- TRA: Transaction/Extrinsic
- RPC: RPC
- TYP: Types

# v2.0.0.0 Changelog
## Native
- Binary name changed from `data-avail` to `avail-node`
- Added chain specification for new testnet and mainnet.
- Updated Polkadot-SDK dependency to v1.7.1
- **Batch calls that contain DataSubmit txs or Bridge txs are now banned from usage.**
- **Data root in the header extension now contains two hashes**
- `blob data` hash - hashed data submit calls
- `bridge data` hash - hashed bridge calls
## Runtime
- The following pallets were renamed:
- `succinct` -> `vector`
- **Only DataSumit txs now go into the matrix.**
- previously it was all transactions.
- Removed Nomad Bridge.
- Removed Bounties.
- Removed Technical Membership.
- Added Treasury Committee.

## SDKs
- Updated Avail-subxt subxt dependency from v0.29 to v0.34

## Examples
- The following deno example were updated or added:
- `balance_transfer_basic.ts`
- `balance_transfer_advanced.ts`
- `da_submitdata_basic.ts`
- `da_submitdata_advanced.ts`
- `kate_query_app_data.ts`
- `kate_query_block_length.ts`
- `kate_query_data_proof.ts`
- `kate_query_proof.ts`
- `kate_query_rows.ts`
- `register_validator.ts`
- `staking_bond_basic.ts`
- `staking_bond_advanced.ts`

# Migration Guide: 1.11.0.0 to 2.0.0.0

## Removed Balances::transfer transaction [TRA]
`Balances::transfer` transaction was removed and replaced by `Balances::transferAll`, `Balances::transferAllowDeath` and `Balances::transferKeepAlive`.

```js
// JS/Deno Example
const alice = new Keyring({ type: "sr25519" }).addFromUri("//Alice");
const bobAddress = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty";
const oneAvl = new BN("1000000000000000000");

// v1.11.0.0
const hash = await api.tx.balances.transfer(bobAddress, oneAvl).signAndSend(alice);

// V2.0.0.0
const hash = await api.tx.balances.transferKeepAlive(bobAddress, oneAvl).signAndSend(alice);
```

## New types introduced to Kate RPC [TYP]
```rust
pub type GRawScalar = U256;
pub type GRow = Vec<GRawScalar>;
pub type GProof = [u8; 48];
pub type GDataProof = (GRawScalar, GProof);

pub type MaxCells = ConstU32<10_000>;
pub type Cells = BoundedVec<Cell, MaxCells>;
```

## Changed Kate::queryRows output from `Vec<Vec<u8>>` to `Vec<Grow>` [RPC, TYP]
```rust
// Subxt example
let rows = &[2];
let block_hash: H256 = // Hash

// v1.11.0.0
let mut params = RpcParams::new();
params.push(rows)?;
params.push(Some(block_hash))?;
let rows: Vec<Vec<u8>> = rpc.request("kate_queryRows", params).await?;

// v2.0.0.0
let rows: Vec<Grow> = client.rpc_methods().query_rows(rows, block_hash).await?;

```

## Changed Kate::queryProof output from `Vec<u8>` to `Vec<GDataProof>` [RPC, TYP]
```rust
// Subxt example
let block_hash: H256 = // Hash
let cell = Cell { row: BlockLengthRows(0), col: BlockLengthColumns(0) };
let cells: Vec<Cell> = vec![cell];

// v1.11.0.0
let mut params = RpcParams::new();
params.push(cells)?;
params.push(Some(block_hash))?;
let proof: Vec<u8> = rpc.request("kate_queryProof", params).await?;

// v2.0.0.0
let cells = Cells::try_from(cells)?;
let proof: Vec<GDataProof> = client.rpc_methods().query_proof(Cells::try_from(cells).unwrap(), block_hash).await?;
```
# Placeholder
1 change: 1 addition & 0 deletions misc/genesis/checksums.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9a6a88337064a66e3032981074e0bf41 mainnet.chain.spec.raw.json
4 changes: 2 additions & 2 deletions runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl pallet_sudo::Config for Runtime {
impl pallet_mandate::Config for Runtime {
type ApprovedOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCollective, 1, 2>,
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 5, 7>,
>;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -644,7 +644,7 @@ parameter_types! {
}

pub type TreasurySpender =
pallet_collective::EnsureProportionMoreThan<AccountId, TreasuryCollective, 1, 2>;
pallet_collective::EnsureProportionAtLeast<AccountId, TreasuryCollective, 5, 7>;

impl pallet_treasury::Config for Runtime {
type ApproveOrigin = EnsureRoot<AccountId>;
Expand Down
19 changes: 19 additions & 0 deletions scripts/chainspec/mainnet/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

ENGINE="${ENGINE:-docker}"

IMAGE="ubuntu-2204.Dockerfile"
DOCKER_FILE="./scripts/chainspec/mainnet/$IMAGE"
DOCKER_IGNORE_FILE="./scripts/chainspec/mainnet/ignore.dockerignore"

mkdir -p "output/"

# Build the image
"$ENGINE" build -t availnodet --ignorefile=$DOCKER_IGNORE_FILE -f $DOCKER_FILE .

selinuxenabled
if [ $? -ne 0 ]; then
"$ENGINE" run --rm -v ./output/$ARCH/$DISTRO:/output availnodet
else
"$ENGINE" run --rm -v ./output/$ARCH/$DISTRO:/output:z availnodet
fi
17 changes: 17 additions & 0 deletions scripts/chainspec/mainnet/ignore.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ignore everything
*

# Allow files and directories
!/runtime
!/rpc
!/patricia-merkle-trie
!/pallets
!/node
!/misc
!/client
!/base
!Cargo.toml
!Cargo.lock
!rust-toolchain.toml
!rustfmt.toml
!.git
23 changes: 23 additions & 0 deletions scripts/chainspec/mainnet/ubuntu-2204.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:22.04 as builder

# This installs all dependencies that we need (besides Rust).
RUN apt update -y && \
apt install build-essential git clang curl libssl-dev llvm libudev-dev make cmake protobuf-compiler -y

# This installs Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust_install.sh && chmod u+x rust_install.sh && ./rust_install.sh -y

ADD . ./workdir
WORKDIR "/workdir"

# This installs the right toolchain
RUN $HOME/.cargo/bin/rustup show

# This builds the binary.
RUN $HOME/.cargo/bin/cargo build --locked --release

# Create output folder
RUN mkdir -p output

VOLUME ["/output"]
CMD ./target/release/avail-node build-spec --chain ./misc/genesis/mainnet.chain.spec.json --raw > /output/mainnet.chain.spec.raw.json

0 comments on commit 0980715

Please sign in to comment.