Skip to content

Commit dc3f3c3

Browse files
aleksussbirchmddependabot[bot]
committed
Release 3.5.0 (#880)
## 3.5.0 2023-12-06 ### Additions - Added a new transaction `upgrade` which allows upgrading the contract and invoking the `state_migration` callback with one call by [@aleksuss]. ([#878]) ### Fixes - Updated the logic of upgrading XCC router which works properly on both `mainnet` and `testnet` by [@birchmd]. ([#877]) [#877]: #877 [#878]: #878 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Michael Birch <michael.birch@aurora.dev> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 4e67385 commit dc3f3c3

15 files changed

Lines changed: 157 additions & 30 deletions

File tree

.github/workflows/builds.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Build
77
jobs:
88
build:
99
name: Build contracts
10-
runs-on: [self-hosted, heavy]
10+
runs-on: github-hosted-heavy-runner
1111
strategy:
1212
matrix:
1313
profile: [mainnet, mainnet-silo, testnet, testnet-silo]
@@ -17,7 +17,15 @@ jobs:
1717
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
1818
- name: Clone the repository
1919
uses: actions/checkout@v3
20-
- run: |
20+
- name: Install Rust
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
override: true
25+
- name: Install cargo-make
26+
run: cargo install --no-default-features --force cargo-make
27+
- name: Compile smart contracts
28+
run: |
2129
cargo make --profile ${{ matrix.profile }} build-docker
2230
cargo make --profile ${{ matrix.profile }} build-xcc-docker
2331
- run: ls -lH bin/aurora-*${{ matrix.profile }}.wasm
@@ -29,7 +37,7 @@ jobs:
2937

3038
publish:
3139
name: Publish contracts
32-
runs-on: [self-hosted, heavy]
40+
runs-on: github-hosted-heavy-runner
3341
needs: build
3442
steps:
3543
- name: Download artifacts

CHANGES.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [3.5.0] 2023-12-06
11+
12+
### Additions
13+
14+
- Added a new transaction `upgrade` which allows upgrading the contract and invoking the `state_migration` callback
15+
with one call by [@aleksuss]. ([#878])
16+
17+
### Fixes
18+
19+
- Updated the logic of upgrading XCC router which works properly on both `mainnet` and `testnet` by [@birchmd]. ([#877])
20+
21+
[#877]: https://github.com/aurora-is-near/aurora-engine/pull/877
22+
[#878]: https://github.com/aurora-is-near/aurora-engine/pull/878
23+
1024
## [3.4.0] 2023-11-28
1125

1226
### Additions
@@ -573,7 +587,8 @@ struct SubmitResult {
573587

574588
## [1.0.0] - 2021-05-12
575589

576-
[Unreleased]: https://github.com/aurora-is-near/aurora-engine/compare/3.4.0...develop
590+
[Unreleased]: https://github.com/aurora-is-near/aurora-engine/compare/3.5.0...develop
591+
[3.5.0]: https://github.com/aurora-is-near/aurora-engine/compare/3.5.0...3.4.0
577592
[3.4.0]: https://github.com/aurora-is-near/aurora-engine/compare/3.3.1...3.4.0
578593
[3.3.1]: https://github.com/aurora-is-near/aurora-engine/compare/3.3.0...3.3.1
579594
[3.3.0]: https://github.com/aurora-is-near/aurora-engine/compare/3.2.0...3.3.0

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ skip_core_tasks = true
1616
CARGO = "cargo"
1717
ENGINE_CARGO_TARGET = "wasm32-unknown-unknown"
1818
SWEEP_DAYS = 30
19+
BUILDER_HASH_COMMIT = "00226858199419aaa8c99f756bd192851666fb36" # https://hub.docker.com/r/nearprotocol/contract-builder/tags
1920

2021
[tasks.sweep]
2122
category = "Cleanup"
@@ -319,7 +320,7 @@ run_task = "build-engine-flow-docker"
319320
[tasks.build-docker]
320321
category = "Build"
321322
script = '''
322-
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-9b27b37941a4419acdba3b8d5fd1d0ac8c99b37e-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
323+
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-${BUILDER_HASH_COMMIT}-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
323324
'''
324325

325326
[tasks.build-xcc-router-docker-inner]
@@ -332,7 +333,7 @@ run_task = "build-xcc-router-flow-docker"
332333
condition = { profiles = ["mainnet", "testnet"] }
333334
category = "Build"
334335
script = '''
335-
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-9b27b37941a4419acdba3b8d5fd1d0ac8c99b37e-amd64 ./scripts/docker-xcc-router-entrypoint.sh ${PROFILE}
336+
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-${BUILDER_HASH_COMMIT}-amd64 ./scripts/docker-xcc-router-entrypoint.sh ${PROFILE}
336337
'''
337338

338339
[tasks.test-contracts]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.0
1+
3.5.0

engine-precompiles/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ serde_json.workspace = true
3434
default = ["std"]
3535
std = ["aurora-engine-types/std", "aurora-engine-sdk/std", "bn/std", "evm/std", "libsecp256k1/std", "ripemd/std", "sha2/std", "sha3/std", "ethabi/std"]
3636
borsh-compat = ["aurora-engine-types/borsh-compat", "aurora-engine-sdk/borsh-compat"]
37-
contract = []
37+
contract = ["aurora-engine-sdk/contract"]
3838
log = []
3939
error_refund = []
4040
ext-connector = []

engine-tests/src/tests/upgrade.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ use crate::utils::workspace::deploy_engine;
44

55
#[tokio::test]
66
async fn test_code_upgrade() {
7+
let aurora = deploy_engine().await;
8+
// do upgrade
9+
let result = aurora
10+
.upgrade(contract_bytes())
11+
.max_gas()
12+
.transact()
13+
.await
14+
.unwrap();
15+
assert!(result.is_success());
16+
17+
// call a new method
18+
let result = aurora
19+
.as_raw_contract()
20+
.view("some_new_fancy_function")
21+
.await
22+
.unwrap();
23+
24+
let output: [u32; 7] = result.borsh().unwrap();
25+
assert_eq!(output, [3, 1, 4, 1, 5, 9, 2]);
26+
}
27+
28+
#[tokio::test]
29+
async fn test_code_upgrade_with_stage() {
730
let aurora = deploy_engine().await;
831
// do upgrade
932
let result = aurora

engine-transactions/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ hex.workspace = true
2424
[features]
2525
std = ["aurora-engine-types/std", "aurora-engine-sdk/std", "aurora-engine-precompiles/std", "evm/std", "rlp/std"]
2626
impl-serde = ["aurora-engine-types/impl-serde", "serde"]
27+
contract = ["aurora-engine-sdk/contract", "aurora-engine-precompiles/contract"]

engine-types/src/parameters/xcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct WithdrawWnearToRouterArgs {
2727
pub struct CodeVersion(pub u32);
2828

2929
impl CodeVersion {
30-
pub const ONE: Self = Self(1);
30+
pub const ZERO: Self = Self(0);
3131

3232
#[must_use]
3333
pub const fn increment(self) -> Self {

engine-workspace/src/contract.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use crate::operation::{
1111
CallSetEthConnectorContractAccount, CallSetEthConnectorContractData, CallSetFixedGas,
1212
CallSetKeyManager, CallSetOwner, CallSetPausedFlags, CallSetSiloParams, CallSetWhitelistStatus,
1313
CallStageUpgrade, CallStateMigration, CallStorageDeposit, CallStorageUnregister,
14-
CallStorageWithdraw, CallSubmit, CallWithdraw, ViewAccountsCounter, ViewBalance, ViewBlockHash,
15-
ViewBridgeProver, ViewChainId, ViewCode, ViewErc20FromNep141, ViewFactoryWnearAddress,
16-
ViewFtBalanceOf, ViewFtBalanceOfEth, ViewFtMetadata, ViewFtTotalEthSupplyOnAurora,
17-
ViewFtTotalEthSupplyOnNear, ViewFtTotalSupply, ViewGetErc20Metadata,
18-
ViewGetEthConnectorContractAccount, ViewGetFixedGas, ViewGetSiloParams, ViewGetWhitelistStatus,
19-
ViewIsUsedProof, ViewNep141FromErc20, ViewNonce, ViewOwner, ViewPausedFlags,
20-
ViewPausedPrecompiles, ViewStorageAt, ViewStorageBalanceOf, ViewUpgradeIndex, ViewVersion,
21-
ViewView,
14+
CallStorageWithdraw, CallSubmit, CallUpgrade, CallWithdraw, ViewAccountsCounter, ViewBalance,
15+
ViewBlockHash, ViewBridgeProver, ViewChainId, ViewCode, ViewErc20FromNep141,
16+
ViewFactoryWnearAddress, ViewFtBalanceOf, ViewFtBalanceOfEth, ViewFtMetadata,
17+
ViewFtTotalEthSupplyOnAurora, ViewFtTotalEthSupplyOnNear, ViewFtTotalSupply,
18+
ViewGetErc20Metadata, ViewGetEthConnectorContractAccount, ViewGetFixedGas, ViewGetSiloParams,
19+
ViewGetWhitelistStatus, ViewIsUsedProof, ViewNep141FromErc20, ViewNonce, ViewOwner,
20+
ViewPausedFlags, ViewPausedPrecompiles, ViewStorageAt, ViewStorageBalanceOf, ViewUpgradeIndex,
21+
ViewVersion, ViewView,
2222
};
2323
use crate::transaction::{CallTransaction, ViewTransaction};
2424
use aurora_engine_types::account_id::AccountId;
@@ -267,6 +267,10 @@ impl EngineContract {
267267
CallFactorySetWNearAddress::call(&self.contract).args_borsh(address)
268268
}
269269

270+
pub fn upgrade(&self, bytes: Vec<u8>) -> CallUpgrade {
271+
CallUpgrade::call(&self.contract).args(bytes)
272+
}
273+
270274
pub fn stage_upgrade(&self, bytes: Vec<u8>) -> CallStageUpgrade {
271275
CallStageUpgrade::call(&self.contract).args(bytes)
272276
}

0 commit comments

Comments
 (0)