Skip to content

Commit

Permalink
Merge branch 'develop' into dev-tools/reenable-coverage-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Dec 4, 2024
2 parents c8faab0 + cedefa7 commit 2245843
Show file tree
Hide file tree
Showing 58 changed files with 852 additions and 628 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Read Rust toolchain version from TOML
id: read_toolchain
run: |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//')
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV
- name: Log Rust toolchain version
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

Expand Down Expand Up @@ -78,6 +87,8 @@ jobs:
with:
context: .
file: docker/iota-node/Dockerfile
build-args: |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm
platforms: linux/amd64
tags: ${{ steps.meta-node.outputs.tags }}
push: true
Expand All @@ -94,6 +105,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Read Rust toolchain version from TOML
id: read_toolchain
run: |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//')
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV
- name: Log Rust toolchain version
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

Expand Down Expand Up @@ -137,6 +157,8 @@ jobs:
with:
context: .
file: docker/iota-indexer/Dockerfile
build-args: |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm
platforms: linux/amd64
tags: ${{ steps.meta-indexer.outputs.tags }}
push: true
Expand All @@ -153,6 +175,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Read Rust toolchain version from TOML
id: read_toolchain
run: |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//')
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV
- name: Log Rust toolchain version
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

Expand Down Expand Up @@ -196,6 +227,8 @@ jobs:
with:
context: .
file: docker/iota-tools/Dockerfile
build-args: |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm
platforms: linux/amd64
tags: ${{ steps.meta-tools.outputs.tags }}
push: true
Expand All @@ -212,6 +245,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Read Rust toolchain version from TOML
id: read_toolchain
run: |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//')
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV
- name: Log Rust toolchain version
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

Expand Down Expand Up @@ -255,6 +297,8 @@ jobs:
with:
context: .
file: docker/iota-graphql-rpc/Dockerfile
build-args: |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm
platforms: linux/amd64
tags: ${{ steps.meta-tools.outputs.tags }}
push: true
Expand Down
1 change: 1 addition & 0 deletions apps/core/src/hooks/stake/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './useTotalDelegatedRewards';
export * from './useTotalDelegatedStake';
export * from './useValidatorInfo';
export * from './useStakeTxnInfo';
export * from './useStakingGasBudgetEstimation';
46 changes: 46 additions & 0 deletions apps/core/src/hooks/stake/useStakingGasBudgetEstimation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { useMemo } from 'react';
import { useIotaClient } from '@iota/dapp-kit';
import { useQuery } from '@tanstack/react-query';
import { createStakeTransaction } from '../../utils';

interface UseStakingGasBudgetEstimationOptions {
senderAddress: string | null;
validatorAddress: string;
amount: bigint;
}

export function useStakingGasBudgetEstimation({
senderAddress,
validatorAddress,
amount,
}: UseStakingGasBudgetEstimationOptions) {
const client = useIotaClient();

const transaction = useMemo(() => {
return createStakeTransaction(amount, validatorAddress);
}, [amount, validatorAddress]);

return useQuery({
// eslint-disable-next-line @tanstack/query/exhaustive-deps
queryKey: [
'staking-tx-gas-budget-estimate',
senderAddress,
validatorAddress,
transaction.getData(),
],
queryFn: async () => {
if (!senderAddress || !transaction) {
return null;
}

transaction.setSender(senderAddress);

await transaction.build({ client });

return transaction.getData().gasData.budget;
},
});
}
2 changes: 1 addition & 1 deletion apps/explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Set Up

**Requirements**: Node 18.0.0 or later.
**Requirements**: Node 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the iota repository:

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Set Up

**Requirements**: Node 18.17.0 or later.
**Requirements**: Node 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the repository:

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "jest"
},
"engines": {
"node": ">= v18.17.0"
"node": ">= 20"
},
"dependencies": {
"@growthbook/growthbook": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Chrome extension wallet for [IOTA](https://iota.org).

# Set Up

**Requirements**: 18.0.0 or later.
**Requirements**: 20.0.0 or later.

Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by installing dependencies in the root of the iota repository:

Expand Down
10 changes: 6 additions & 4 deletions apps/wallet/src/ui/app/WalletSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export abstract class WalletSigner {
if (isTransaction(transaction)) {
// If the sender has not yet been set on the transaction, then set it.
// NOTE: This allows for signing transactions with mismatched senders, which is important for sponsored transactions.
transaction.setSenderIfNotSet(await this.getAddress());
if (!transaction.getData().sender) {
transaction.setSender(await this.getAddress());
}

return await transaction.build({
client: this.client,
});
Expand Down Expand Up @@ -84,13 +87,12 @@ export abstract class WalletSigner {
transactionBlock: Uint8Array | Transaction;
options?: IotaTransactionBlockResponseOptions;
}): Promise<IotaTransactionBlockResponse> {
const bytes = await this.prepareTransaction(input.transactionBlock);
const signed = await this.signTransaction({
transaction: bytes,
transaction: input.transactionBlock,
});

return this.client.executeTransactionBlock({
transactionBlock: bytes,
transactionBlock: signed.bytes,
signature: signed.signature,
options: input.options,
});
Expand Down
25 changes: 14 additions & 11 deletions apps/wallet/src/ui/app/staking/stake/StakeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
parseAmount,
useCoinMetadata,
useFormatCoin,
useStakingGasBudgetEstimation,
} from '@iota/core';
import { Field, type FieldProps, Form, useFormikContext } from 'formik';
import { memo, useEffect, useMemo } from 'react';
Expand Down Expand Up @@ -36,7 +37,12 @@ function StakeForm({ validatorAddress, coinBalance, coinType, epoch }: StakeFrom
if (!values.amount || !decimals) return null;
if (Number(values.amount) < 0) return null;
const amountWithoutDecimals = parseAmount(values.amount, decimals);
return createStakeTransaction(amountWithoutDecimals, validatorAddress);
const transaction = createStakeTransaction(amountWithoutDecimals, validatorAddress);
if (activeAddress) {
transaction.setSender(activeAddress);
}

return transaction;
}, [values.amount, validatorAddress, decimals]);

const { data: txDryRunResponse } = useTransactionDryRun(
Expand All @@ -46,18 +52,15 @@ function StakeForm({ validatorAddress, coinBalance, coinType, epoch }: StakeFrom

const gasSummary = txDryRunResponse ? getGasSummary(txDryRunResponse) : undefined;

const stakeAllTransaction = useMemo(() => {
return createStakeTransaction(coinBalance, validatorAddress);
}, [coinBalance, validatorAddress]);

const { data: stakeAllTransactionDryRun } = useTransactionDryRun(
activeAddress ?? undefined,
stakeAllTransaction,
);
const { data: stakeAllGasBudget } = useStakingGasBudgetEstimation({
senderAddress: activeAddress,
amount: coinBalance,
validatorAddress,
});

const gasBudget = BigInt(stakeAllTransactionDryRun?.input.gasData.budget ?? 0);
const gasBudget = BigInt(stakeAllGasBudget ?? 0);

// do not remove: gasBudget field is used in the validation schema apps/wallet/src/ui/app/staking/stake/utils/validation.ts
// do not remove: gasBudget field is used in the validation schema apps/core/src/utils/stake/createValidationSchema.ts
useEffect(() => {
setFieldValue('gasBudget', gasBudget);
}, [gasBudget]);
Expand Down
2 changes: 1 addition & 1 deletion bridge/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project leverages [Foundry](https://github.com/foundry-rs/foundry) to manag
Duplicate rename the `.env.example` file to `.env`. You'll need accounts and api keys for **Infura** and **Etherscan** as well as the necessary RPC URLs. Be sure to add the required values in your newly created `.env` file.

> **Note**
> The OZ foundry upgrades library uses node to verify upgrade safety. Make sure you have node version 18.17 or higher as well as npm version 10.4 or higher installed.
> The OZ foundry upgrades library uses node to verify upgrade safety. Make sure you have node version 20.0.0 or higher as well as npm version 10.4 or higher installed.
#### Dependencies

Expand Down
2 changes: 1 addition & 1 deletion crates/iota-rosetta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This will generate the `rosetta-cli.json` and `iota.ros` file to be used by the
#### 1. CD into the Dockerfile directory

```shell
cd <iota project directory>/crate/iota-rosetta/docker/iota-rosetta-local
cd <iota project directory>/docker/iota-rosetta-local
```

#### 2. Build the image
Expand Down
33 changes: 0 additions & 33 deletions crates/iota-rosetta/docker/iota-rosetta-devnet/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions crates/iota-rosetta/docker/iota-rosetta-devnet/build.sh

This file was deleted.

35 changes: 0 additions & 35 deletions crates/iota-rosetta/docker/iota-rosetta-local/Dockerfile

This file was deleted.

Loading

0 comments on commit 2245843

Please sign in to comment.