Skip to content

Commit 03da5cb

Browse files
authored
Merge pull request #1447 from Concordium/plt-merge
Merge the PLT feature branch
2 parents 11cc1f4 + ba92a37 commit 03da5cb

File tree

154 files changed

+9717
-2813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+9717
-2813
lines changed

.github/workflows/build-test.yaml

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ name: Check formatting, build and run tests
2121

2222
on:
2323
push:
24-
branches: main
24+
branches:
25+
- main
2526
paths:
2627
- '.github/workflows/build-test.yaml'
2728
- '**/Cargo.toml'
@@ -35,7 +36,8 @@ on:
3536
- 'concordium-node/rustfmt.toml'
3637

3738
pull_request:
38-
branches: main
39+
branches:
40+
- main
3941
types: [opened, synchronize, reopened, ready_for_review]
4042
paths:
4143
- '.github/workflows/build-test.yaml'
@@ -51,9 +53,8 @@ on:
5153
workflow_dispatch: # allow manual trigger
5254

5355
env:
54-
dummy: 16 # change to force cache invalidation
56+
dummy: 17 # change to force cache invalidation
5557
CARGO_TERM_COLOR: always # implicitly adds '--color=always' to all cargo commands
56-
TEST_LEVEL: 1 # for stack tests
5758

5859
jobs:
5960

@@ -65,9 +66,16 @@ jobs:
6566
- name: Download fourmolu
6667
uses: supplypike/setup-bin@v1
6768
with:
68-
uri: 'https://github.com/fourmolu/fourmolu/releases/download/v0.13.1.0/fourmolu-0.13.1.0-linux-x86_64'
69+
uri: 'https://github.com/fourmolu/fourmolu/releases/download/v0.18.0.0/fourmolu-0.18.0.0-linux-x86_64'
6970
name: 'fourmolu'
70-
version: '0.13.1.0'
71+
version: '0.18.0.0'
72+
73+
- name: Download hpack
74+
run: |
75+
curl -L https://github.com/sol/hpack/releases/download/0.38.1/hpack_linux.gz -o hpack.gz
76+
gunzip hpack.gz
77+
chmod +x hpack
78+
mv hpack /usr/local/bin/
7179
7280
- name: Checkout project
7381
uses: actions/checkout@v2
@@ -78,7 +86,8 @@ jobs:
7886
# needed to generate a cabal file from the package.yaml.
7987
- name: Setup the project
8088
run: |
81-
stack --stack-yaml concordium-consensus/stack.yaml setup
89+
cd concordium-consensus
90+
hpack package.yaml
8291
8392
- name: Run fourmolu
8493
run: |
@@ -126,7 +135,7 @@ jobs:
126135
matrix:
127136
plan:
128137
- rust: 1.82
129-
ghc: 9.6.6
138+
ghc: 9.10.2
130139

131140
steps:
132141
- name: Remove unnecessary files
@@ -141,13 +150,9 @@ jobs:
141150
- name: Install system packages and protoc
142151
run: |
143152
sudo apt-get update && sudo apt-get -y install liblmdb-dev gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
144-
wget https://github.com/google/flatbuffers/archive/refs/tags/v22.12.06.zip
145-
unzip v22.12.06.zip
146-
cd flatbuffers-22.12.06
147-
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
148-
make
149-
sudo make install
150-
cd ..
153+
wget https://github.com/google/flatbuffers/releases/download/v22.12.06/Linux.flatc.binary.g++-10.zip
154+
unzip Linux.flatc.binary.g++-10.zip
155+
sudo mv ./flatc /usr/bin/flatc
151156
flatc --version
152157
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.3/protoc-3.15.3-linux-x86_64.zip
153158
unzip protoc-3.15.3-linux-x86_64.zip
@@ -173,11 +178,13 @@ jobs:
173178
~/.cargo/git
174179
concordium-base/rust-src/target
175180
concordium-base/lib
176-
concordium-consensus/smart-contracts/wasm-chain-integration/target
177-
concordium-consensus/smart-contracts/lib
181+
concordium-base/smart-contracts/wasm-chain-integration/target
182+
concordium-base/smart-contracts/lib
178183
concordium-node/target
179-
key: ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
184+
collector/target
185+
key: ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ hashFiles('concordium-base/rust-src/**/*.rs','concordium-base/smart-contracts/wasm-chain-integration/**/*.rs')}}
180186
restore-keys: |
187+
${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
181188
${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}
182189
183190
# HASKELL #
@@ -188,6 +195,12 @@ jobs:
188195
# The cache entry keys depend on the GHC version and contents of 'package.yaml' and 'stack.yaml'
189196
# but will fall back to cache entries from different versions if no match is found.
190197

198+
- name: Compute cache keys
199+
id: cache-keys
200+
run: |
201+
echo "proto_hash=${{ hashFiles('**/*.proto') }}" >> $GITHUB_OUTPUT
202+
echo "base_hash=${{ hashFiles('concordium-base/**/*.hs') }}" >> $GITHUB_OUTPUT
203+
191204
- name: Cache stack global package DB
192205
id: stack-global
193206
uses: actions/cache@v4
@@ -196,14 +209,6 @@ jobs:
196209
key: ${{ runner.os }}-${{ env.dummy }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
197210
restore-keys: |
198211
${{ runner.os }}-${{ env.dummy }}-stack-global-${{ matrix.plan.ghc }}
199-
- name: Cache stack-installed programs in '~/.local/bin'
200-
id: stack-programs
201-
uses: actions/cache@v4
202-
with:
203-
path: ~/.local/bin
204-
key: ${{ runner.os }}-${{ env.dummy }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
205-
restore-keys: |
206-
${{ runner.os }}-${{ env.dummy }}-stack-programs-${{ matrix.plan.ghc }}
207212
- name: Cache '.stack-work'
208213
uses: actions/cache@v4
209214
with:
@@ -213,34 +218,16 @@ jobs:
213218
concordium-consensus/.stack-work
214219
concordium-consensus/haskell-lmdb/.stack-work
215220
216-
key: ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
221+
key: ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-${{ steps.cache-keys.outputs.proto_hash }}-${{ steps.cache-keys.outputs.base_hash }}
217222
restore-keys: |
223+
${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-${{ steps.cache-keys.outputs.proto_hash }}-
224+
${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-
218225
${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}
219226
220-
- name: Install GHC (unless it was cached)
221-
if: steps.stack-programs.outputs.cache-hit != 'true' || steps.stack-global.outputs.cache-hit != 'true'
222-
run: |
223-
stack setup --install-ghc
224-
- name: Build haskell dependencies (unless they were cached)
225-
if: steps.stack-programs.outputs.cache-hit != 'true' || steps.stack-global.outputs.cache-hit != 'true'
226-
run: |
227-
stack build --test --bench --only-dependencies --stack-yaml concordium-consensus/stack.yaml
228-
229227
# Compile Haskell sources. This must be done before running checks or tests on the Rust sources.
230-
- name: Build consensus
231-
run: |
232-
stack build --test --bench --force-dirty --stack-yaml concordium-consensus/stack.yaml --no-run-tests --no-run-benchmarks --ghc-options "-Werror"
233-
234-
# Test Haskell sources. Could be run in parallel with the steps below.
235-
- name: Test consensus
236-
run: |
237-
stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:consensus --bench --no-run-benchmarks --ta --level=${TEST_LEVEL}
238-
- name: Test globalstate
239-
run: |
240-
stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:globalstate --bench --no-run-benchmarks --ta --level=${TEST_LEVEL}
241-
- name: Test scheduler
228+
- name: Build consensus and run tests
242229
run: |
243-
stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:scheduler --bench --no-run-benchmarks
230+
stack build concordium-consensus --test --bench --force-dirty --no-run-benchmarks --ghc-options "-Werror" --ghc-options -j
244231
245232
# RUST #
246233

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ on:
2121

2222
env:
2323
UBUNTU_VERSION: '24.04'
24-
STATIC_LIBRARIES_IMAGE_TAG: 'rust-1.82_ghc-9.6.6-0'
24+
STATIC_LIBRARIES_IMAGE_TAG: 'rust-1.82_ghc-9.10.2'
2525
RUST_VERSION: '1.82'
26-
STACK_VERSION: '3.1.1'
26+
STACK_VERSION: '3.7.1'
2727
FLATBUFFERS_VERSION: '23.5.26'
28-
GHC_VERSION: '9.6.6'
28+
GHC_VERSION: '9.10.2'
2929
PROTOC_VERSION: '28.3'
3030
STATIC_NODE_BINARY_IMAGE_NAME: 'static-node-binaries'
3131
DOCKER_ARTIFACT_NAME: 'image'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ _rust_rocksdb*
1010
tags
1111
path
1212
.vscode
13+
.idea/
14+
concordium-node/.idea/
1315
.so
1416
.stack-work
1517
dist

CHANGELOG.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,76 @@
22

33
## Unreleased changes
44

5+
## 9.0.7
6+
57
- Docker base images upgraded from Ubuntu 20.04 to 24.04
68
- Node Docker image is now signed with Sigstore Cosign
9+
- Add P8 -> P9 update.
10+
- Update GHC version to 9.10.2 (lts-24.0).
11+
- Protocol-level tokens:
12+
- Change energy charging to occur as early as possible in the token module.
13+
- Added `touch` kernel method. The `touch` method initializes the token state
14+
of an account by setting its balance to zero. This method only affects
15+
accounts that have no existing state for the token.
16+
- Additional check in transaction verification asserting that the effective
17+
time equals zero of CreatePLT update transactions.
18+
19+
## 9.0.6 (DevNet)
20+
21+
- Protocol-level tokens:
22+
- Adjusted energy cost of mint/burn from 100 to 50
23+
- PLTs can now only be created with the module reference:
24+
5c5c2645db84a7026d78f2501740f60a8ccb8fae5c166dc2428077fd9a699a4a
25+
- Support for token pause/unpause operations.
26+
27+
## 9.0.5 (DevNet)
28+
29+
- Protocol-level tokens:
30+
- Simplified token transaction handling: Consolidated all token holder and
31+
governance operations for a single `TokenUpdateTransaction` type.
32+
- Moved authorization from the scheduler to the token module.
33+
- Fix a bug in checking authorization for CreatePLT update.
34+
35+
## 9.0.4 (DevNet)
36+
37+
- Protocol-level tokens:
38+
- Changes to event representation and serialization.
39+
40+
## 9.0.3 (DevNet)
41+
42+
- Protocol-level tokens:
43+
- `GetAccountInfo` reports the token module-defined state as CBOR-encoded, rather than directly
44+
exposing the allow/deny list membership at the GRPC level.
45+
- `metadata` in token module state (reported in `GetTokenInfo`) can now include the metadata
46+
hash as well as the URL.
47+
- A new set of authorized level-2 keys for the `CreatePLT` chain update.
48+
49+
## 9.0.2 (DevNet)
50+
51+
- Protocol-level tokens:
52+
- Token operations emit events. This includes `CreatePLT`.
53+
- Support for energy charging for token module execution.
54+
55+
## 9.0.1 (DevNet)
56+
57+
- Protocol-level tokens:
58+
- Support for token governance transactions (mint, burn, modify allow/deny lists).
59+
- Enforcement of allow and deny lists in transfer operations.
60+
- `GetTokenInfo` returns state from token module.
61+
- `GetAccountInfo` reports state of allow/deny lists.
62+
- Changes to the caching and storage of account-level token state.
63+
64+
65+
## 9.0.0 (DevNet)
66+
67+
- Preliminary support for protocol-level tokens (as part of protocol version 9), including:
68+
- Support for `CreatePLT` chain update for creating a new protocol-level token.
69+
- Support for transferring protocol-level tokens between accounts with the `TokenHolder`
70+
transaction type.
71+
- API support:
72+
- Add `GetTokenList` query for getting a list of all protocol-level tokens.
73+
- Add `GetTokenInfo` query for getting details about a specific protocol-level token.
74+
- `GetAccountInfo` query displays balances of protocol-level tokens held by an account.
775

876
## 8.1.0
977

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ dependencies must be pre-build, which is done automatically by the cabal setup
7878
script.
7979

8080
Code should be formatted using [`fourmolu`](https://github.com/fourmolu/fourmolu)
81-
version `0.13.1.0` and using the config `fourmolu.yaml` found in the project root.
81+
version `0.18.0.0` and using the config `fourmolu.yaml` found in the project root.
8282
The CI is setup to ensure the code follows this style.
8383

8484
To check the formatting locally run the following command from the project root:

collector/src/bin/collector.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ extern crate log;
1313

1414
#[allow(clippy::large_enum_variant, clippy::enum_variant_names)]
1515
mod grpc {
16+
mod plt {
17+
tonic::include_proto!("concordium.v2.plt");
18+
}
1619
tonic::include_proto!("concordium.v2");
1720
}
1821
use grpc::{node_info::node::ConsensusStatus, tokenomics_info::Tokenomics};

concordium-base

Submodule concordium-base updated 118 files

concordium-consensus/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ rustup default stable-x86_64-pc-windows-gnu
2929
```
3030

3131
### `user specified .o/.so/.DLL could not be loaded (addDLL: pthread or dependencies not loaded. (Win32 error 5)) whilst trying to load: (dynamic) pthread`
32-
Copy `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.6.6\mingw\bin\libwinpthread-1.dll` to `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.6.6\mingw\bin\pthread.dll`.
32+
Copy `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.10.2\mingw\bin\libwinpthread-1.dll` to `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.10.2\mingw\bin\pthread.dll`.
3333

3434
# The library and dependencies
3535

concordium-consensus/lib.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ EXPORTS
2323
stopImportingBlocks
2424

2525
getAccountInfoV2
26+
getTokenInfoV2
2627
getAccountListV2
28+
getTokenListV2
2729
getModuleListV2
2830
getModuleSourceV2
2931
getInstanceListV2

concordium-consensus/src-lib/Concordium/External/DryRun.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE GADTs #-}
44
{-# LANGUAGE RankNTypes #-}
55
{-# LANGUAGE ScopedTypeVariables #-}
6+
{-# LANGUAGE TypeAbstractions #-}
67
{-# LANGUAGE TypeApplications #-}
78
{-# LANGUAGE TypeFamilies #-}
89

@@ -238,7 +239,8 @@ runWithEBlockStateContext mvr (EBlockStateContextV1 vc1 drs) operation = do
238239
mvr
239240

240241
-- | Handle that identifies a particular dry-run session.
241-
data DryRunHandle = forall finconf.
242+
data DryRunHandle
243+
= forall finconf.
242244
DryRunHandle
243245
{ -- | Wrap the multi-version runner from the consensus runner.
244246
drhMVR :: !(MultiVersionRunner finconf),
@@ -686,7 +688,9 @@ dryRunTransaction dryRunPtr senderPtr energyLimit payloadPtr payloadLen sigPairs
686688
key <- KeyIndex <$> peekByteOff sigPairs (2 * i + 1)
687689
addSigs (i + 1) $!
688690
m
689-
& at' cred . nonEmpty . at' key
691+
& at' cred
692+
. nonEmpty
693+
. at' key
690694
?~ Sig.dummySignatureEd25519
691695
| otherwise = return m
692696
addSigs 0 Map.empty

0 commit comments

Comments
 (0)