Skip to content

Commit

Permalink
Release 2.0.2. (#323)
Browse files Browse the repository at this point in the history
* Fix: log full address of sender in submit call (#321)
* Feat(engine): log storage writes from applying transactions (#322)

Co-authored-by: Joshua J. Bouw <joshua@aurora.dev>
Co-authored-by: Arto Bendiken <arto@aurora.dev>
  • Loading branch information
3 people authored Nov 3, 2021
1 parent 8b1439f commit c5454c1
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.2] - 2021-11-01

### Added

- Logging number of storage writes by [@birchmd]. ([#322](https://github.com/aurora-is-near/aurora-engine/pull/322))

### Fixed

- Show full address in logging transaction sender on `submit` by [@birchmd]. ([#321](https://github.com/aurora-is-near/aurora-engine/pull/321))

## [2.0.1] - 2021-11-01

### Added
Expand Down Expand Up @@ -123,6 +133,8 @@ struct SubmitResult {
## [1.0.0] - 2021-05-12

[Unreleased]: https://github.com/aurora-is-near/aurora-engine/compare/2.0.0...master
[2.0.2]: https://github.com/aurora-is-near/aurora-engine/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/aurora-is-near/aurora-engine/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/aurora-is-near/aurora-engine/compare/1.7.0...2.0.0
[1.7.0]: https://github.com/aurora-is-near/aurora-engine/compare/1.6.4...1.7.0
[1.6.4]: https://github.com/aurora-is-near/aurora-engine/compare/1.6.3...1.6.4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ documentation.

Network | Contract ID | Chain ID | Version
------- | ------------------- | ---------- | ------
Mainnet | [`aurora`][Mainnet] | 1313161554 | 1.6.4
Testnet | [`aurora`][Testnet] | 1313161555 | 1.6.4
Betanet | [`aurora`][Betanet] | 1313161556 | 1.6.4
Local | `aurora.test.near` | 1313161556 | 1.6.4
Mainnet | [`aurora`][Mainnet] | 1313161554 | 2.0.2
Testnet | [`aurora`][Testnet] | 1313161555 | 2.0.2
Betanet | [`aurora`][Betanet] | 1313161556 | 2.0.2
Local | `aurora.test.near` | 1313161556 | 2.0.2

[Mainnet]: https://explorer.near.org/accounts/aurora
[Testnet]: https://explorer.testnet.near.org/accounts/aurora
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aurora-engine"
version = "2.0.1"
version = "2.0.2"
authors = ["NEAR <hello@near.org>"]
edition = "2018"
description = ""
Expand Down
25 changes: 24 additions & 1 deletion engine/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,8 @@ impl ApplyBackend for Engine {
I: IntoIterator<Item = (H256, H256)>,
L: IntoIterator<Item = Log>,
{
let mut writes_counter: usize = 0;
let mut code_bytes_written: usize = 0;
for apply in values {
match apply {
Apply::Modify {
Expand All @@ -1049,9 +1051,17 @@ impl ApplyBackend for Engine {
let generation = Self::get_generation(&address);
Engine::set_nonce(&address, &basic.nonce);
Engine::set_balance(&address, &Wei::new(basic.balance));
writes_counter += 2; // 1 for nonce, 1 for balance

if let Some(code) = code {
Engine::set_code(&address, &code)
Engine::set_code(&address, &code);
code_bytes_written = code.len();
sdk::log!(crate::prelude::format!(
"code_write_at_address {:?} {}",
address,
code_bytes_written,
)
.as_str());
}

let next_generation = if reset_storage {
Expand All @@ -1067,6 +1077,7 @@ impl ApplyBackend for Engine {
} else {
Engine::set_storage(&address, &index, &value, next_generation)
}
writes_counter += 1;
}

// We only need to remove the account if:
Expand All @@ -1079,14 +1090,26 @@ impl ApplyBackend for Engine {
&& generation == next_generation
{
Engine::remove_account(&address, generation);
writes_counter += 1;
}
}
Apply::Delete { address } => {
let generation = Self::get_generation(&address);
Engine::remove_account(&address, generation);
writes_counter += 1;
}
}
}
// These variable are only used if logging feature is enabled.
// In production logging is always enabled so we can ignore the warnings.
#[allow(unused_variables)]
let total_bytes = 32 * writes_counter + code_bytes_written;
#[allow(unused_assignments)]
if code_bytes_written > 0 {
writes_counter += 1;
}
sdk::log!(crate::prelude::format!("total_writes_count {}", writes_counter).as_str());
sdk::log!(crate::prelude::format!("total_written_bytes {}", total_bytes).as_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ mod contract {
.sdk_expect("ERR_INVALID_ECDSA_SIGNATURE");

#[cfg(feature = "log")]
sdk::log(crate::prelude::format!("signer_public_key 0x{}", sender).as_str());
sdk::log(crate::prelude::format!("signer_address {:?}", sender).as_str());

Engine::check_nonce(&sender, signed_transaction.nonce()).sdk_unwrap();

Expand Down
2 changes: 1 addition & 1 deletion etc/state-migration-test/Cargo.lock

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

0 comments on commit c5454c1

Please sign in to comment.