-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from Concordium/kb/merge-contract-testing-lib
Merge contract testing library
- Loading branch information
Showing
33 changed files
with
8,659 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: "Testing library: Format, lint, build, and test" | ||
|
||
# This job runs: | ||
# - rustfmt | ||
# - clippy linting | ||
# - tests | ||
# for the smart contract testing library. | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
pull_request: | ||
branches: main | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
paths: | ||
- 'contract-testing/**/*.rs' | ||
- 'contract-testing/**/*.toml' | ||
- 'rustfmt.toml' | ||
- 'concordium-rust-sdk' | ||
|
||
workflow_dispatch: # allows manual trigger | ||
|
||
env: | ||
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu | ||
RUST_CLIPPY: 1.66 | ||
|
||
jobs: | ||
"lint_fmt": | ||
name: ${{ matrix.build-dir }} lint:fmt | ||
# Don't run on draft pull requests | ||
if: ${{ !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
build-dir: | ||
- 'concordium-smart-contract-testing' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.RUST_FMT }} | ||
override: true | ||
components: rustfmt | ||
- name: Format | ||
working-directory: ${{ matrix.build-dir }} | ||
run: | | ||
cargo fmt -- --color=always --check | ||
"lint_clippy": | ||
name: ${{ matrix.build-dir }} lint:clippy | ||
# Don't run on draft pull requests | ||
if: ${{ !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
build-dir: | ||
- 'concordium-smart-contract-testing' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.RUST_CLIPPY }} | ||
override: true | ||
components: clippy | ||
- name: Clippy | ||
working-directory: ${{ matrix.build-dir }} | ||
run: | | ||
git config --global url."https://github.com/".insteadOf "[email protected]:" | ||
cargo clippy --color=always --tests --benches -- -Dclippy::all | ||
"cargo_test": | ||
name: ${{ matrix.build-dir }} cargo:test | ||
runs-on: ubuntu-latest | ||
needs: | ||
- cargo-concordium_cargo_build-bench | ||
strategy: | ||
matrix: | ||
build-dir: | ||
- 'concordium-smart-contract-testing' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.RUST_CLIPPY }} | ||
override: true | ||
- name: Test | ||
working-directory: ${{ matrix.build-dir }} | ||
run: cargo test -- --skip io_tests # Skip the I/O tests in the testing library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "concordium-contracts-common"] | ||
path = concordium-contracts-common | ||
url = ../concordium-contracts-common.git | ||
[submodule "concordium-rust-sdk"] | ||
path = concordium-rust-sdk | ||
url = ../concordium-rust-sdk.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule concordium-contracts-common
deleted from
9d1f25
Submodule concordium-rust-sdk
added at
0a2f89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Changelog | ||
|
||
## Unreleased changes | ||
|
||
- Add functionality for setting the exchange rates and block time of the chain based on queries from an external node. | ||
- Configured via a builder pattern, see `Chain::builder`. | ||
- Add methods to `Chain`: | ||
- `external_query_block` to get the default block used for external queries | ||
- `block_time` to get the block time | ||
- `tick_block_time` to increase the block time by a `Duration` | ||
- Add the following types by re-exporting them from internal crates: | ||
- `BlockHash` | ||
- `Timestamp` which `SlotTime` is an alias of. | ||
- `Duration` | ||
- `Endpoint` | ||
- Add methods to the `Chain` for adding external accounts and contracts and for invoking contracts on an external node. | ||
- See the `Chain` method `contract_invoke_external` for more details. | ||
- Bump minimum supported Rust version to `1.66`. | ||
|
||
## 3.0.0 | ||
|
||
- Support protocol 6 semantics, in particular validation assumes protocol 6 | ||
semantics now, allowing sign extension instructions and new operations for | ||
querying account's public keys, and checking signatures with account's keys. | ||
- Add `AccountSignatures` structure. | ||
- Add an `AccountAccessStructure` to the `Account` structure. This is a breaking | ||
change. Extend the constructors of `Account` to allow constructing accounts | ||
with this access structure. | ||
|
||
## 2.0.0 | ||
|
||
- Include `ContractTraceElement`s for failed contract executions, including internal failures. | ||
- Introduce the enum `DebugTraceElement`, which has information about trace elements, including failed ones and the cause of error, and the energy usage. | ||
- On the `ContractInvokeSuccess` type: | ||
- Change the type of the `trace_elements` field to be `Vec<DebugTraceElement>` instead of `Vec<ContractTraceElement>`. (breaking change) | ||
- Add a helper method, `effective_trace_elements()`, to retrieve the "effective" trace elements, i.e., elements that were *not* rolled back. | ||
- These are the elements that were previously returned in the `trace_elements` field. | ||
- There is also a version of the method which clones: `effective_trace_elements_cloned()`. | ||
- To migrate existing code, replace `some_update.trace_elements` with `some_update.effective_trace_elements_cloned()`. | ||
- Add a helper method, `rollbacks_occurred()`, to determine whether any internal failures or rollbacks occurred. | ||
- On the `ContractInvokeError` type: | ||
- Include the field `trace_elements` of type `Vec<DebugTraceElements>` with the trace elements that were hitherto discarded. (breaking change) | ||
- To migrate, include the new field or use `..` when pattern matching on the type. | ||
|
||
## 1.0.0 | ||
|
||
- The initial release of the library. |
Oops, something went wrong.