Skip to content

Commit

Permalink
Release 3.1.0 (#839)
Browse files Browse the repository at this point in the history
- Added the possibility to use native NEAR instead of wNEAR on Aurora by
[@karim-en]. ([#750])

- Added hashchain integration by [@birchmd]. ([#831])

- Added functions for setting and getting metadata of ERC-20 contracts
deployed with `deploy_erc20_token` transaction
  by [@aleksuss]. ([#837])

---------

Co-authored-by: Michael Birch <michael.birch@aurora.dev>
Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev>
Co-authored-by: Karim <karim@aurora.dev>
  • Loading branch information
4 people committed Sep 25, 2023
1 parent 1a2e7c6 commit 6d861c8
Show file tree
Hide file tree
Showing 60 changed files with 3,044 additions and 1,065 deletions.
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.0] 2023-09-25

- Added the possibility to use native NEAR instead of wNEAR on Aurora by [@karim-en]. ([#750])

- Added hashchain integration by [@birchmd]. ([#831])

- Added functions for setting and getting metadata of ERC-20 contracts deployed with `deploy_erc20_token` transaction
by [@aleksuss]. ([#837])

[#750]: https://github.com/aurora-is-near/aurora-engine/pull/750
[#831]: https://github.com/aurora-is-near/aurora-engine/pull/831
[#837]: https://github.com/aurora-is-near/aurora-engine/pull/837

## [3.0.0] 2023-08-28

### Fixes
Expand Down Expand Up @@ -530,6 +543,7 @@ struct SubmitResult {
[@guidovranken]: https://github.com/guidovranken
[@hskang9]: https://github.com/hskang9
[@joshuajbouw]: https://github.com/joshuajbouw
[@karim-en]: https://github.com/karim-en
[@mandreyel]: https://github.com/mandreyel
[@matklad]: https://github.com/matklad
[@mfornet]: https://github.com/mfornet
Expand Down
44 changes: 31 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false

[workspace.dependencies]
aurora-engine = { path = "engine", default-features = false }
aurora-engine-hashchain = { path = "engine-hashchain", default-features = false }
aurora-engine-precompiles = { path = "engine-precompiles", default-features = false }
aurora-engine-sdk = { path = "engine-sdk", default-features = false }
aurora-engine-transactions = { path = "engine-transactions", default-features = false }
Expand All @@ -31,12 +32,13 @@ byte-slice-cast = { version = "1", default-features = false }
criterion = "0.5"
digest = "0.10"
ethabi = { version = "18", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std", "tracing"] }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std", "tracing"] }
fixed-hash = { version = "0.8.0", default-features = false}
git2 = "0.17"
function_name = "0.3.0"
git2 = "0.18"
hex = { version = "0.4", default-features = false, features = ["alloc"] }
ibig = { version = "0.3", default-features = false, features = ["num-traits"] }
impl-serde = { version = "0.4.0", default-features = false}
Expand Down
4 changes: 2 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ run_task = "build-engine-flow-docker"
[tasks.build-docker]
category = "Build"
script = '''
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-de975ed75e0f6a840c7aeb57e3414959cb59bc00-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-f033430c4fc619aaf8b88eb2fcb976bb8d24d65d-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
'''

[tasks.build-xcc-router-docker-inner]
Expand All @@ -312,7 +312,7 @@ run_task = "build-xcc-router-flow-docker"
[tasks.build-xcc-docker]
category = "Build"
script = '''
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-de975ed75e0f6a840c7aeb57e3414959cb59bc00-amd64 ./scripts/docker-xcc-router-entrypoint.sh ${PROFILE}
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-f033430c4fc619aaf8b88eb2fcb976bb8d24d65d-amd64 ./scripts/docker-xcc-router-entrypoint.sh ${PROFILE}
'''

[tasks.test-contracts]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.1.0
5 changes: 4 additions & 1 deletion engine-hashchain/src/bloom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
//! Link: <https://github.com/paritytech/parity-common/blob/master/ethbloom/src/lib.rs>
//!
//! Reimplemented here since there is a large mismatch in types and dependencies.
#![allow(clippy::expl_impl_clone_on_copy)]
#![allow(
clippy::expl_impl_clone_on_copy,
// TODO: rust-2023-08-24 clippy::incorrect_clone_impl_on_copy_type
)]

use aurora_engine_sdk::keccak;
use aurora_engine_types::borsh::{self, BorshDeserialize, BorshSerialize};
Expand Down
1 change: 1 addition & 0 deletions engine-hashchain/src/hashchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use aurora_engine_sdk::keccak;
use aurora_engine_types::{
account_id::AccountId,
borsh::{self, maybestd::io, BorshDeserialize, BorshSerialize},
format,
types::RawH256,
Cow, Vec,
};
Expand Down
3 changes: 3 additions & 0 deletions engine-hashchain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub mod bloom;
pub mod error;
pub mod hashchain;
pub mod merkle;
#[cfg(test)]
mod tests;
pub mod wrapped_io;
116 changes: 116 additions & 0 deletions engine-hashchain/src/wrapped_io.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//! This module contains `CachedIO`, a light wrapper over any IO instance
//! which will cache the input read and output written by the underlying instance.
//! It has no impact on the storage access functions of the trait.
//! The purpose of this struct is to capture the input and output from the underlying
//! IO instance for the purpose of passing it to `Hashchain::add_block_tx`.

use aurora_engine_sdk::io::{StorageIntermediate, IO};
use aurora_engine_types::Vec;
use core::cell::RefCell;

#[derive(Debug, Clone, Copy)]
pub struct CachedIO<'cache, I> {
inner: I,
cache: &'cache RefCell<IOCache>,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum WrappedInput<T> {
Input(Vec<u8>),
Wrapped(T),
}

#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct IOCache {
pub input: Vec<u8>,
pub output: Vec<u8>,
}

impl<'cache, I> CachedIO<'cache, I> {
pub fn new(io: I, cache: &'cache RefCell<IOCache>) -> Self {
Self { inner: io, cache }
}
}

impl IOCache {
pub fn set_input(&mut self, value: Vec<u8>) {
self.input = value;
}

pub fn set_output(&mut self, value: Vec<u8>) {
self.output = value;
}
}

impl<T: StorageIntermediate> StorageIntermediate for WrappedInput<T> {
fn len(&self) -> usize {
match self {
Self::Input(bytes) => bytes.len(),
Self::Wrapped(x) => x.len(),
}
}

fn is_empty(&self) -> bool {
match self {
Self::Input(bytes) => bytes.is_empty(),
Self::Wrapped(x) => x.is_empty(),
}
}

fn copy_to_slice(&self, buffer: &mut [u8]) {
match self {
Self::Input(bytes) => buffer.copy_from_slice(bytes),
Self::Wrapped(x) => x.copy_to_slice(buffer),
}
}
}

impl<'cache, I: IO> IO for CachedIO<'cache, I> {
type StorageValue = WrappedInput<I::StorageValue>;

fn read_input(&self) -> Self::StorageValue {
let input = self.inner.read_input().to_vec();
self.cache.borrow_mut().set_input(input.clone());
WrappedInput::Input(input)
}

fn return_output(&mut self, value: &[u8]) {
self.cache.borrow_mut().set_output(value.to_vec());
self.inner.return_output(value);
}

fn read_storage(&self, key: &[u8]) -> Option<Self::StorageValue> {
self.inner.read_storage(key).map(WrappedInput::Wrapped)
}

fn storage_has_key(&self, key: &[u8]) -> bool {
self.inner.storage_has_key(key)
}

fn write_storage(&mut self, key: &[u8], value: &[u8]) -> Option<Self::StorageValue> {
self.inner
.write_storage(key, value)
.map(WrappedInput::Wrapped)
}

fn write_storage_direct(
&mut self,
key: &[u8],
value: Self::StorageValue,
) -> Option<Self::StorageValue> {
match value {
WrappedInput::Wrapped(x) => self
.inner
.write_storage_direct(key, x)
.map(WrappedInput::Wrapped),
WrappedInput::Input(bytes) => self
.inner
.write_storage(key, &bytes)
.map(WrappedInput::Wrapped),
}
}

fn remove_storage(&mut self, key: &[u8]) -> Option<Self::StorageValue> {
self.inner.remove_storage(key).map(WrappedInput::Wrapped)
}
}
12 changes: 6 additions & 6 deletions engine-precompiles/src/alt_bn256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ impl<HF: HardFork> Bn256Add<HF> {
pub const ADDRESS: Address = make_address(0, 6);

#[must_use]
pub fn new() -> Self {
Self(PhantomData::default())
pub const fn new() -> Self {
Self(PhantomData)
}
}

Expand Down Expand Up @@ -294,8 +294,8 @@ impl<HF: HardFork> Bn256Mul<HF> {
pub const ADDRESS: Address = make_address(0, 7);

#[must_use]
pub fn new() -> Self {
Self(PhantomData::default())
pub const fn new() -> Self {
Self(PhantomData)
}
}

Expand Down Expand Up @@ -402,8 +402,8 @@ impl<HF: HardFork> Bn256Pair<HF> {
pub const ADDRESS: Address = make_address(0, 8);

#[must_use]
pub fn new() -> Self {
Self(PhantomData::default())
pub const fn new() -> Self {
Self(PhantomData)
}
}

Expand Down

0 comments on commit 6d861c8

Please sign in to comment.