Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do not merge] Grarco/test draft #3309

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2951ace
Track the origin of emitted events
sug0 May 18, 2024
210879f
Test event emission origin
sug0 May 20, 2024
89bd08b
Activate `debug` feat when `testing` is active
sug0 May 20, 2024
df4b4f7
Changelog for #3268
sug0 May 20, 2024
298a33f
empty commit
brentstone May 24, 2024
35014c8
Merge branch 'tiago/track-caller-events' (#3268)
tzemanovic May 24, 2024
48709ce
Fixes fee payment
grarco May 20, 2024
57e5f46
Refactors tx execution of `finalize_block` into separate functions
grarco May 20, 2024
d1eafb2
Reorganizes arguments for tx execution
grarco May 20, 2024
5711946
Cache wrapper transaction to avoid second deserialization
grarco May 20, 2024
a329373
Refactors the arguments of `dispatch_tx` for every tx type
grarco May 21, 2024
2bd2650
Removes unused wasm caches for wrapper execution
grarco May 21, 2024
efe95cc
Pass tx by reference in `apply_wrapper_tx`
grarco May 21, 2024
b27f45e
Fixes unit tests
grarco May 21, 2024
b0d7708
Removes useless check on tx type for reprot management
grarco May 21, 2024
bd6df8d
Removes useless operations on wrapper transactions
grarco May 21, 2024
d5cab98
Adds integration test for enforced fees
grarco May 22, 2024
b6f200a
Misc adjustments to v36
grarco May 22, 2024
3c526c4
Fixes typo
grarco May 23, 2024
e82d57d
Changelog #3075
grarco May 22, 2024
d063ac1
Fmt
grarco May 24, 2024
8eaa020
Adds new masp `Action`
grarco May 13, 2024
5cfa7ad
Removes masp vp dependency on `Transfer`
grarco May 13, 2024
7da6dc2
Updates wasm transaction to push masp action
grarco May 13, 2024
8657963
Removes unused error variant
grarco May 14, 2024
b8000db
Emit masp sections references in the events
grarco May 14, 2024
d16e198
Updates sdk to retrieve masp data based on events
grarco May 23, 2024
2b88265
Misc refactors
grarco May 23, 2024
1b05850
Moves masp events data to core
grarco May 23, 2024
c3bd934
Helper function for masp action handling
grarco May 23, 2024
f018033
Reworks masp tx indexing
grarco May 23, 2024
0b709e7
Fixes broken doc link
grarco May 23, 2024
4bf8fcc
Changelog #3232
grarco May 23, 2024
ef33d62
Fmt
grarco May 24, 2024
afd812d
Merge branch 'grarco/force-fee-payment' (#3294)
tzemanovic May 24, 2024
37dd21e
Merge branch 'grarco/masp-no-transfer-dep' (#3232)
grarco May 24, 2024
19e7899
fixup! Merge branch 'grarco/masp-no-transfer-dep' (#3232)
grarco May 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/3075-force-fee-payment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fixed the fee collection logic in `finalize_block` to match that of
`process_proposal`. ([\#3075](https://github.com/anoma/namada/issues/3075))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Removed any dependency on the specific transaction data from the masp vp.
([\#3232](https://github.com/anoma/namada/pull/3232))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Add a new event attribute facility to track events to their origin
in Namada's source code. This is useful for debugging purposes.
([\#3268](https://github.com/anoma/namada/pull/3268))
19 changes: 19 additions & 0 deletions crates/core/src/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};

use crate::address::{Address, DecodeError, HASH_HEX_LEN, MASP};
use crate::hash::Hash;
use crate::impl_display_and_from_str_via_format;
use crate::storage::Epoch;
use crate::string_encoding::{
Expand Down Expand Up @@ -532,3 +533,21 @@ impl FromStr for MaspValue {
})
}
}

/// The masp transactions' references of a given batch
#[derive(Default, Clone, Serialize, Deserialize)]
pub struct MaspTxRefs(pub Vec<Hash>);

impl Display for MaspTxRefs {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}

impl FromStr for MaspTxRefs {
type Err = serde_json::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_str(s)
}
}
3 changes: 2 additions & 1 deletion crates/events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ version.workspace = true

[features]
default = []
debug = []
mainnet = []
migrations = [
"namada_migrations",
"linkme",
]
testing = []
testing = ["debug"]

[dependencies]
namada_core = {path = "../core"}
Expand Down
24 changes: 5 additions & 19 deletions crates/events/src/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::str::FromStr;

use namada_core::collections::HashMap;
use namada_core::hash::Hash;
use namada_core::masp::MaspTxRefs;
use namada_core::storage::{BlockHeight, TxIndex};

use super::*;
Expand Down Expand Up @@ -498,28 +499,13 @@ impl EventAttributeEntry<'static> for MaspTxBlockIndex {
}
}

/// A displyable collection of hashes.
#[derive(Serialize, Deserialize)]
pub struct DisplayableHashVec(Vec<Hash>);

impl Display for DisplayableHashVec {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}

impl From<Vec<Hash>> for DisplayableHashVec {
fn from(value: Vec<Hash>) -> Self {
Self(value)
}
}

/// Extend an [`Event`] with `masp_tx_batch_refs` data, indicating the specific
/// inner transactions inside the batch that are valid masp txs.
pub struct MaspTxBatchRefs(pub DisplayableHashVec);
/// inner transactions inside the batch that are valid masp txs and the
/// references to the relative masp sections.
pub struct MaspTxBatchRefs(pub MaspTxRefs);

impl EventAttributeEntry<'static> for MaspTxBatchRefs {
type Value = DisplayableHashVec;
type Value = MaspTxRefs;
type ValueOwned = Self::Value;

const KEY: &'static str = "masp_tx_batch_refs";
Expand Down
2 changes: 2 additions & 0 deletions crates/events/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
pub mod extend;
#[cfg(any(test, feature = "testing"))]
pub mod testing;
#[cfg(any(test, feature = "debug"))]
pub mod tracer;

use std::borrow::Cow;
use std::collections::BTreeMap;
Expand Down
Loading
Loading