Skip to content

Commit 6d861c8

Browse files
aleksussbirchmdmrLSDkarim-en
authored
Release 3.1.0 (#839)
- 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 <[email protected]> Co-authored-by: Evgeny Ukhanov <[email protected]> Co-authored-by: Karim <[email protected]>
1 parent 1a2e7c6 commit 6d861c8

Some content is hidden

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

60 files changed

+3044
-1065
lines changed

CHANGES.md

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

88
## [Unreleased]
99

10+
## [3.1.0] 2023-09-25
11+
12+
- Added the possibility to use native NEAR instead of wNEAR on Aurora by [@karim-en]. ([#750])
13+
14+
- Added hashchain integration by [@birchmd]. ([#831])
15+
16+
- Added functions for setting and getting metadata of ERC-20 contracts deployed with `deploy_erc20_token` transaction
17+
by [@aleksuss]. ([#837])
18+
19+
[#750]: https://github.com/aurora-is-near/aurora-engine/pull/750
20+
[#831]: https://github.com/aurora-is-near/aurora-engine/pull/831
21+
[#837]: https://github.com/aurora-is-near/aurora-engine/pull/837
22+
1023
## [3.0.0] 2023-08-28
1124

1225
### Fixes
@@ -530,6 +543,7 @@ struct SubmitResult {
530543
[@guidovranken]: https://github.com/guidovranken
531544
[@hskang9]: https://github.com/hskang9
532545
[@joshuajbouw]: https://github.com/joshuajbouw
546+
[@karim-en]: https://github.com/karim-en
533547
[@mandreyel]: https://github.com/mandreyel
534548
[@matklad]: https://github.com/matklad
535549
[@mfornet]: https://github.com/mfornet

Cargo.lock

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

Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ publish = false
99

1010
[workspace.dependencies]
1111
aurora-engine = { path = "engine", default-features = false }
12+
aurora-engine-hashchain = { path = "engine-hashchain", default-features = false }
1213
aurora-engine-precompiles = { path = "engine-precompiles", default-features = false }
1314
aurora-engine-sdk = { path = "engine-sdk", default-features = false }
1415
aurora-engine-transactions = { path = "engine-transactions", default-features = false }
@@ -31,12 +32,13 @@ byte-slice-cast = { version = "1", default-features = false }
3132
criterion = "0.5"
3233
digest = "0.10"
3334
ethabi = { version = "18", default-features = false }
34-
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false }
35-
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std"] }
36-
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std", "tracing"] }
37-
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.38.3-aurora", default-features = false, features = ["std", "tracing"] }
35+
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false }
36+
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std"] }
37+
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std", "tracing"] }
38+
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", tag = "v0.39.1", default-features = false, features = ["std", "tracing"] }
3839
fixed-hash = { version = "0.8.0", default-features = false}
39-
git2 = "0.17"
40+
function_name = "0.3.0"
41+
git2 = "0.18"
4042
hex = { version = "0.4", default-features = false, features = ["alloc"] }
4143
ibig = { version = "0.3", default-features = false, features = ["num-traits"] }
4244
impl-serde = { version = "0.4.0", default-features = false}

Makefile.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ run_task = "build-engine-flow-docker"
300300
[tasks.build-docker]
301301
category = "Build"
302302
script = '''
303-
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-de975ed75e0f6a840c7aeb57e3414959cb59bc00-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
303+
docker run --volume $PWD:/host -w /host -i --rm nearprotocol/contract-builder:master-f033430c4fc619aaf8b88eb2fcb976bb8d24d65d-amd64 ./scripts/docker-entrypoint.sh ${PROFILE}
304304
'''
305305

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

318318
[tasks.test-contracts]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0
1+
3.1.0

engine-hashchain/src/bloom.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
//! Link: <https://github.com/paritytech/parity-common/blob/master/ethbloom/src/lib.rs>
33
//!
44
//! Reimplemented here since there is a large mismatch in types and dependencies.
5-
#![allow(clippy::expl_impl_clone_on_copy)]
5+
#![allow(
6+
clippy::expl_impl_clone_on_copy,
7+
// TODO: rust-2023-08-24 clippy::incorrect_clone_impl_on_copy_type
8+
)]
69

710
use aurora_engine_sdk::keccak;
811
use aurora_engine_types::borsh::{self, BorshDeserialize, BorshSerialize};

engine-hashchain/src/hashchain.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use aurora_engine_sdk::keccak;
33
use aurora_engine_types::{
44
account_id::AccountId,
55
borsh::{self, maybestd::io, BorshDeserialize, BorshSerialize},
6+
format,
67
types::RawH256,
78
Cow, Vec,
89
};

engine-hashchain/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
#![cfg_attr(not(feature = "std"), no_std)]
2+
13
pub mod bloom;
24
pub mod error;
35
pub mod hashchain;
46
pub mod merkle;
57
#[cfg(test)]
68
mod tests;
9+
pub mod wrapped_io;

engine-hashchain/src/wrapped_io.rs

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
//! This module contains `CachedIO`, a light wrapper over any IO instance
2+
//! which will cache the input read and output written by the underlying instance.
3+
//! It has no impact on the storage access functions of the trait.
4+
//! The purpose of this struct is to capture the input and output from the underlying
5+
//! IO instance for the purpose of passing it to `Hashchain::add_block_tx`.
6+
7+
use aurora_engine_sdk::io::{StorageIntermediate, IO};
8+
use aurora_engine_types::Vec;
9+
use core::cell::RefCell;
10+
11+
#[derive(Debug, Clone, Copy)]
12+
pub struct CachedIO<'cache, I> {
13+
inner: I,
14+
cache: &'cache RefCell<IOCache>,
15+
}
16+
17+
#[derive(Debug, Clone, PartialEq, Eq)]
18+
pub enum WrappedInput<T> {
19+
Input(Vec<u8>),
20+
Wrapped(T),
21+
}
22+
23+
#[derive(Debug, Clone, Default, PartialEq, Eq)]
24+
pub struct IOCache {
25+
pub input: Vec<u8>,
26+
pub output: Vec<u8>,
27+
}
28+
29+
impl<'cache, I> CachedIO<'cache, I> {
30+
pub fn new(io: I, cache: &'cache RefCell<IOCache>) -> Self {
31+
Self { inner: io, cache }
32+
}
33+
}
34+
35+
impl IOCache {
36+
pub fn set_input(&mut self, value: Vec<u8>) {
37+
self.input = value;
38+
}
39+
40+
pub fn set_output(&mut self, value: Vec<u8>) {
41+
self.output = value;
42+
}
43+
}
44+
45+
impl<T: StorageIntermediate> StorageIntermediate for WrappedInput<T> {
46+
fn len(&self) -> usize {
47+
match self {
48+
Self::Input(bytes) => bytes.len(),
49+
Self::Wrapped(x) => x.len(),
50+
}
51+
}
52+
53+
fn is_empty(&self) -> bool {
54+
match self {
55+
Self::Input(bytes) => bytes.is_empty(),
56+
Self::Wrapped(x) => x.is_empty(),
57+
}
58+
}
59+
60+
fn copy_to_slice(&self, buffer: &mut [u8]) {
61+
match self {
62+
Self::Input(bytes) => buffer.copy_from_slice(bytes),
63+
Self::Wrapped(x) => x.copy_to_slice(buffer),
64+
}
65+
}
66+
}
67+
68+
impl<'cache, I: IO> IO for CachedIO<'cache, I> {
69+
type StorageValue = WrappedInput<I::StorageValue>;
70+
71+
fn read_input(&self) -> Self::StorageValue {
72+
let input = self.inner.read_input().to_vec();
73+
self.cache.borrow_mut().set_input(input.clone());
74+
WrappedInput::Input(input)
75+
}
76+
77+
fn return_output(&mut self, value: &[u8]) {
78+
self.cache.borrow_mut().set_output(value.to_vec());
79+
self.inner.return_output(value);
80+
}
81+
82+
fn read_storage(&self, key: &[u8]) -> Option<Self::StorageValue> {
83+
self.inner.read_storage(key).map(WrappedInput::Wrapped)
84+
}
85+
86+
fn storage_has_key(&self, key: &[u8]) -> bool {
87+
self.inner.storage_has_key(key)
88+
}
89+
90+
fn write_storage(&mut self, key: &[u8], value: &[u8]) -> Option<Self::StorageValue> {
91+
self.inner
92+
.write_storage(key, value)
93+
.map(WrappedInput::Wrapped)
94+
}
95+
96+
fn write_storage_direct(
97+
&mut self,
98+
key: &[u8],
99+
value: Self::StorageValue,
100+
) -> Option<Self::StorageValue> {
101+
match value {
102+
WrappedInput::Wrapped(x) => self
103+
.inner
104+
.write_storage_direct(key, x)
105+
.map(WrappedInput::Wrapped),
106+
WrappedInput::Input(bytes) => self
107+
.inner
108+
.write_storage(key, &bytes)
109+
.map(WrappedInput::Wrapped),
110+
}
111+
}
112+
113+
fn remove_storage(&mut self, key: &[u8]) -> Option<Self::StorageValue> {
114+
self.inner.remove_storage(key).map(WrappedInput::Wrapped)
115+
}
116+
}

engine-precompiles/src/alt_bn256.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ impl<HF: HardFork> Bn256Add<HF> {
189189
pub const ADDRESS: Address = make_address(0, 6);
190190

191191
#[must_use]
192-
pub fn new() -> Self {
193-
Self(PhantomData::default())
192+
pub const fn new() -> Self {
193+
Self(PhantomData)
194194
}
195195
}
196196

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

296296
#[must_use]
297-
pub fn new() -> Self {
298-
Self(PhantomData::default())
297+
pub const fn new() -> Self {
298+
Self(PhantomData)
299299
}
300300
}
301301

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

404404
#[must_use]
405-
pub fn new() -> Self {
406-
Self(PhantomData::default())
405+
pub const fn new() -> Self {
406+
Self(PhantomData)
407407
}
408408
}
409409

0 commit comments

Comments
 (0)