Skip to content

Commit

Permalink
Merge branch 'main' into deferred-pool
Browse files Browse the repository at this point in the history
  • Loading branch information
mpguerra authored Jul 22, 2024
2 parents b841d21 + 6436bf6 commit 1a775d3
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sub-build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
# Build and push image to Google Artifact Registry, and possibly DockerHub
- name: Build & push
id: docker_build
uses: docker/build-push-action@v6.3.0
uses: docker/build-push-action@v6.4.1
with:
target: ${{ inputs.dockerfile_target }}
context: .
Expand Down
1 change: 0 additions & 1 deletion book/src/dev/crate-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ cargo new new-crate-name
cd new-crate-name
cargo release publish --verbose --package new-crate-name --execute
cargo owner --add oxarbitrage
cargo owner --add teor2345
cargo owner --add github:zcashfoundation:owners
```

Expand Down
2 changes: 1 addition & 1 deletion release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ push = false
tag = false

# Owners for new crates
owners = [ 'oxarbitrage', 'teor2345', 'zcashfoundation/owners' ]
owners = [ 'oxarbitrage', 'zcashfoundation/owners' ]
25 changes: 25 additions & 0 deletions zebra-chain/src/parameters/network/tests/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,28 @@ fn check_network_name() {
"network must be displayed as configured network name"
);
}

#[test]
fn check_full_activation_list() {
let network = testnet::Parameters::build()
.with_activation_heights(ConfiguredActivationHeights {
nu5: Some(1),
..Default::default()
})
.to_network();

// We expect the first 8 network upgrades to be included, up to NU5
let expected_network_upgrades = &NETWORK_UPGRADES_IN_ORDER[..8];
let full_activation_list_network_upgrades: Vec<_> = network
.full_activation_list()
.into_iter()
.map(|(_, nu)| nu)
.collect();

for expected_network_upgrade in expected_network_upgrades {
assert!(
full_activation_list_network_upgrades.contains(expected_network_upgrade),
"full activation list should contain expected network upgrade"
);
}
}
12 changes: 12 additions & 0 deletions zebra-chain/src/parameters/network_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ impl Network {
/// When the environment variable TEST_FAKE_ACTIVATION_HEIGHTS is set
/// and it's a test build, this returns a list of fake activation heights
/// used by some tests.
///
/// Note: This skips implicit network upgrade activations, use [`Network::full_activation_list`]
/// to get an explicit list of all network upgrade activations.
pub fn activation_list(&self) -> BTreeMap<block::Height, NetworkUpgrade> {
match self {
// To prevent accidentally setting this somehow, only check the env var
Expand All @@ -282,6 +285,15 @@ impl Network {
Testnet(params) => params.activation_heights().clone(),
}
}

/// Returns a vector of all implicit and explicit network upgrades for `network`,
/// in ascending height order.
pub fn full_activation_list(&self) -> Vec<(block::Height, NetworkUpgrade)> {
NETWORK_UPGRADES_IN_ORDER
.into_iter()
.map_while(|nu| Some((NetworkUpgrade::activation_height(&nu, self)?, nu)))
.collect()
}
}

impl NetworkUpgrade {
Expand Down
2 changes: 1 addition & 1 deletion zebra-rpc/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ where
//
// Get the network upgrades in height order, like `zcashd`.
let mut upgrades = IndexMap::new();
for (activation_height, network_upgrade) in network.activation_list() {
for (activation_height, network_upgrade) in network.full_activation_list() {
// Zebra defines network upgrades based on incompatible consensus rule changes,
// but zcashd defines them based on ZIPs.
//
Expand Down

0 comments on commit 1a775d3

Please sign in to comment.