Skip to content

Commit

Permalink
Merge pull request #604 from threefoldtech/v2.2.0
Browse files Browse the repository at this point in the history
V2.2.0
  • Loading branch information
DylanVerstraete authored Feb 15, 2023
2 parents c706be7 + 08c4396 commit 8335325
Show file tree
Hide file tree
Showing 96 changed files with 10,204 additions and 5,987 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN apt update && \
lldb \
software-properties-common \
tar \
zstd && \
zstd \
protobuf-compiler && \
add-apt-repository ppa:deadsnakes/ppa && \
apt install -y python3.10 && \
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py && \
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build-and-test:
runs-on: [self-hosted, poc]
container:
image: threefolddev/tfchain:1
image: threefolddev/tfchain:2
env:
DEBIAN_FRONTEND: noninteractive
steps:
Expand All @@ -25,8 +25,8 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
substrate-node/target/
key: ${{ runner.os }}-tfchain-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-tfchain-cargo-
key: ${{ runner.os }}-tfchain-build-cache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-tfchain-build-cache

- name: Build
run: |
Expand All @@ -47,3 +47,9 @@ jobs:
cd substrate-node/tests
robot -d _output_tests/ .
- uses: actions/upload-artifact@v3
if: always()
with:
name: integration test output
path: substrate-node/tests/_output_tests/

1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @DylanVerstraete @brandonpille @renauter @robvanmieghem @leesmet
28 changes: 28 additions & 0 deletions docs/architecture/0002-smart-contract-billing-changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 2. Changed smart contract billing workflow

Date: 2022-10-12

## Status

Accepted

## Context

TFchain bills contract using an internal feature of susbtrate called `on_finalize`. This function / hook is executed after every block, in this function the time to compute is limited since this runs before the block production is finished. We are worried that if the usage of the grid grows, this on finalize method would need to do too much computations and that the block time would be impacted.

## Decision

We searched for an alternative to this `on_finalize` method within the substrate framework. We found a hook that fires after a block is produced, but in that hook the result of some computation must be submitted onchain with an extrinsic. This offchain worker cannot modify chain storage directly, rather it can only do that through an extrinsic.

## Consequences

### the good

- The billing for a contract is now executed after a block is produced and not within that same block.
- Atleast one offchain worker must run with the `smct` keytype in order to bill contracts.
- Contracts billing cycles do not rely anymore on a previously successful bill.
- External users can call `bill_contract` but don't need to.

### the worrying

- If no validators run an offchain worker with the `smct` keytype, no contracts will be billed.
25 changes: 25 additions & 0 deletions docs/architecture/0003-third-party-service-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 3. Third party service contract

Date: 2022-10-17

## Status

Accepted

## Context

See [here](https://github.com/threefoldtech/tfchain/issues/445) for more details.

## Decision

The third party service contract flow is described [here](../../substrate-node/pallets/pallet-smart-contract/third-party_service_contract.md#flow).

## Consequences

### the good

- It is now possible to create generic contract between two `TFChain` users (without restriction of account type) for some service and bill for it.

### the worrying

- Keep eyes on potential abuses and be prepared to handle all the malicious cases that can show up.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Ensure you have the following installed first:
- libclang-dev
- clang lldb lld
- build-essential
- protoc

You will also need rust and nightly installed.

Expand Down
Loading

0 comments on commit 8335325

Please sign in to comment.