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

Testnet 7.1 staging #279

Merged
merged 53 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
aacf6e9
Add 'testnet' feature to default features
mappum Feb 7, 2024
4847eeb
Count fees_collected as sats
mappum Feb 7, 2024
6d607b0
Update testnet header checkpoint
mappum Feb 7, 2024
2393134
Add call to pay fees with nbtc
keppel Feb 7, 2024
f32aede
Update orga
keppel Feb 7, 2024
43bba64
Bump CONSENSUS_VERSION
mappum Feb 8, 2024
844bc26
Remove VersionedPubkey
mappum Feb 8, 2024
a2e27af
Merge branch 'develop' into testnet-7.1
mappum Feb 12, 2024
d0ace74
Merge branch 'develop' into testnet-7.1
mappum Feb 12, 2024
a91baf5
Remove hand-implemented Migrate for Pubkey
mappum Feb 9, 2024
9d5b70c
Add `recover-deposit` subcommand
mappum Feb 13, 2024
e8068d8
Fix warnings
mappum Feb 13, 2024
a20b445
Pay nBTC fees into reward pool/fee pool
mappum Feb 13, 2024
04da194
Add --min_checkpoint_minutes flag to signer
keppel Jan 10, 2024
64950e7
Clarify --min_checkpoint_minutes doc comment
keppel Jan 10, 2024
2872438
Only check extra conditions for checkpoints in Signing status
keppel Jan 10, 2024
b1a02a8
Fix tests
keppel Feb 13, 2024
cd6a7fc
Increase default HeaderQueue max_age value
mappum Feb 13, 2024
aa05e22
Denominate signer checkpoint interval in Bitcoin blocks
keppel Feb 13, 2024
1c3a43b
Use previous completed checkpoint index for min interval check
keppel Feb 13, 2024
367f39d
Handle signer checkpoint interval check case where index is 0
keppel Feb 13, 2024
af00852
Make `recover-deposit` take in remote address instead of remote prefix
mappum Feb 14, 2024
7ae02c7
Use correct threshold and network in `recover-deposit`
mappum Feb 14, 2024
ae7c27b
Bump InnerApp to V5
mappum Feb 14, 2024
510d6c6
Increase default checkpoint max_age to 90 days
mappum Feb 14, 2024
8167e5e
Add transfer_to_fee_pool call
mappum Feb 14, 2024
03e3945
Add `pay-to-fee-pool` subcommand
mappum Feb 14, 2024
5050e13
Turn `signer` limit reset index into a flag
mappum Feb 14, 2024
947c677
Remove legacy-bin from default features
mappum Feb 14, 2024
779b5c0
Multiply quoted fee by user fee factor in relayer /sigset endpoint
mappum Feb 14, 2024
7830294
Config tweaks
mappum Feb 14, 2024
2f36905
Credit addresses with initial coins in testnet init_chain
mappum Feb 14, 2024
4aed5dd
Pay set recovery address call fee with nbtc
keppel Feb 14, 2024
9688a9b
Add minimum amount for transfer_to_fee_pool call
mappum Feb 14, 2024
f8abc1a
Add SDK call conversion for nomic/PayToFeePool
mappum Feb 14, 2024
e477ff2
Fix warnings
mappum Feb 14, 2024
c354775
Add missing V5 field attribute
mappum Feb 14, 2024
0601614
Fix check_change_rates test
mappum Feb 14, 2024
4f7f131
Fix clippy warnings
mappum Feb 14, 2024
963189d
Update testnet network config
mappum Feb 14, 2024
2bb69bc
v7.1.0
mappum Feb 14, 2024
6b4d851
Update default state sync RPC addresses in testnet config
mappum Feb 14, 2024
7813bdf
Add legacy_version field to testnet config
mappum Feb 14, 2024
70aaec2
Merge branch 'develop' into testnet-7.1
cwlittle Feb 14, 2024
75542a1
Support legacy-bin feature when no legacy_version is configured in bu…
mappum Feb 14, 2024
82e3688
Fix bitcoin test
mappum Feb 14, 2024
f6e9960
Fix bitcoin test
mappum Feb 14, 2024
85254fd
Don't push new checkpoints if bitcoin headers are being backfilled
mappum Feb 14, 2024
29dd138
Set default value for SignerCmd::min_blocks_per_checkpoint to 6
mappum Feb 14, 2024
f641afb
Update config values for regtest
cwlittle Feb 15, 2024
70abed6
Add timeout to poll_for_updated_balance
cwlittle Feb 15, 2024
e4e5e09
Update Bitcoin test
cwlittle Feb 15, 2024
06ebd7f
Use actions/cache@v4
cwlittle Feb 15, 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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
toolchain: nightly-2023-05-08
override: true
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo
Expand All @@ -51,7 +51,7 @@ jobs:
toolchain: nightly-2023-05-08
override: true
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo
Expand All @@ -76,7 +76,7 @@ jobs:
toolchain: nightly-2023-05-08
override: true
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
override: true
- name: Cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
components: clippy
override: true
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "nomic"
version = "7.0.0"
version = "7.1.0"
authors = ["The Turbofish Team <[email protected]>"]
edition = "2021"
default-run = "nomic"

[dependencies]
bitcoin = { version = "0.29.2", features = ["serde", "rand"] }
orga = { git = "https://github.com/nomic-io/orga.git", rev = "38682a1eafc9c3566aa5de4601a1aff06eb79c4f", features = [
orga = { git = "https://github.com/nomic-io/orga.git", rev = "bd9b07a96c21669bf0de52640ad81eaf8d7f0aae", features = [
"merk-verify",
] }
thiserror = "1.0.30"
Expand Down Expand Up @@ -66,7 +66,7 @@ toml = { version = "0.7.2", features = ["parse"] }
semver = "1.0.18"

[features]
default = ["full", "feat-ibc", "legacy-bin"]
default = ["full", "feat-ibc", "testnet"]
full = [
"bitcoincore-rpc-async",
"clap",
Expand Down
16 changes: 8 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ fn main() {
include_str!("networks/stakenet.toml")
};
let config: toml::Value = toml::from_str(toml).unwrap();
config
.as_table()
.unwrap()
.get("legacy_version")
.unwrap()
.as_str()
.unwrap()
.to_string()
if let Some(legacy_version) = config.as_table().unwrap().get("legacy_version") {
legacy_version.as_str().unwrap().to_string()
} else {
println!("No legacy_version set in network config");
println!("cargo:rustc-env=NOMIC_LEGACY_BUILD_PATH=/dev/null");
println!("cargo:rustc-env=NOMIC_LEGACY_BUILD_VERSION=");
return;
}
};
if version_req_str.chars().next().unwrap().is_numeric() {
version_req_str = format!("={}", version_req_str);
Expand Down
40 changes: 22 additions & 18 deletions networks/testnet.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
state_sync_rpc = [
"http://147.182.171.216:26667",
"http://147.182.171.216:26677",
"https://rpc.nomic-testnet.basementnodes.ca"
]
tendermint_flags = [
"--p2p.seeds",
"""
tendermint_flags = ["--p2p.seeds", """
[email protected]:26656,\
""",
]
btc_relayer = [
"https://relayer.nomic-testnet.mappum.io:8443"
]

legacy_version = "6.4"
"""]
btc_relayer = ["https://relayer.nomic-testnet.mappum.io:8443"]

genesis = """
{
"genesis_time": "2022-10-05T00:00:00Z",
"chain_id": "nomic-testnet-4d",
"initial_height": "0",
"app_hash": "",
"chain_id": "nomic-testnet-5",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",
"max_age_num_blocks": "100000",
"max_bytes": "1048576"
},
"validator": {
"pub_key_types": ["ed25519"]
"pub_key_types": [
"ed25519"
]
},
"version": {}
},
"validators": [],
"app_hash": ""
"genesis_time": "2024-02-14T19:53:11.939148Z",
"initial_height": "0",
"validators": [
{
"address": "044AD55B10017D73B72269396305A71B82CD1216",
"name": "",
"power": "10",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "orlC75T55Qe9hgqGZzkPMIOeTn7kvsA2+/d2gZWHL2g="
}
}
]
}
"""
53 changes: 44 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const STRATEGIC_RESERVE_ADDRESS: &str = "nomic1d5n325zrf4elfu0heqd59gna5j6xyunhe
const VALIDATOR_BOOTSTRAP_ADDRESS: &str = "nomic1fd9mxxt84lw3jdcsmjh6jy8m6luafhqd8dcqeq";

const IBC_FEE_USATS: u64 = 1_000_000;
const DECLARE_FEE_USATS: u64 = 100_000_000;
const CALL_FEE_USATS: u64 = 100_000_000;

#[orga(version = 4)]
#[orga(version = 5)]
pub struct InnerApp {
#[call]
pub accounts: Accounts<Nom>,
Expand All @@ -93,7 +93,7 @@ pub struct InnerApp {
#[call]
pub ibc: Ibc,
#[cfg(not(feature = "testnet"))]
#[orga(version(V4))]
#[orga(version(V4, V5))]
#[call]
pub ibc: Ibc,

Expand All @@ -105,13 +105,13 @@ pub struct InnerApp {
#[cfg(feature = "testnet")]
pub cosmos: Cosmos,
#[cfg(not(feature = "testnet"))]
#[orga(version(V4))]
#[orga(version(V4, V5))]
pub cosmos: Cosmos,
}

#[orga]
impl InnerApp {
pub const CONSENSUS_VERSION: u8 = 10;
pub const CONSENSUS_VERSION: u8 = 11;

#[cfg(feature = "full")]
fn configure_faucets(&mut self) -> Result<()> {
Expand Down Expand Up @@ -328,16 +328,21 @@ impl InnerApp {

#[call]
pub fn declare_with_nbtc(&mut self, declaration: Declaration) -> Result<()> {
self.deduct_nbtc_fee(DECLARE_FEE_USATS.into())?;
self.deduct_nbtc_fee(CALL_FEE_USATS.into())?;
let signer = self.signer()?;
self.staking.declare(signer, declaration, 0.into())
}

#[call]
pub fn pay_nbtc_fee(&mut self) -> Result<()> {
self.deduct_nbtc_fee(CALL_FEE_USATS.into())
}

fn deduct_nbtc_fee(&mut self, amount: Amount) -> Result<()> {
disable_fee();
let signer = self.signer()?;
self.bitcoin.accounts.withdraw(signer, amount)?.burn();

let fee = self.bitcoin.accounts.withdraw(signer, amount)?;
self.bitcoin.give_rewards(fee)?;
Ok(())
}

Expand Down Expand Up @@ -424,6 +429,18 @@ mod abci {
.current_version
.insert((), vec![Self::CONSENSUS_VERSION].try_into().unwrap())?;

#[cfg(feature = "testnet")]
{
self.upgrade.activation_delay_seconds = 20 * 60;

include_str!("../testnet_addresses.csv")
.lines()
.try_for_each(|line| {
let address = line.parse().unwrap();
self.accounts.deposit(address, Coin::mint(10_000_000_000))
})?;
}

Ok(())
}
}
Expand Down Expand Up @@ -923,12 +940,30 @@ impl ConvertSdkTx for InnerApp {
crate::bitcoin::adapter::Adapter::new(recovery_addr.script_pubkey());

let funding_amt = MIN_FEE;
let payer = build_call!(self.accounts.take_as_funding(funding_amt.into()));
let payer = build_call!(self.pay_nbtc_fee());
let paid = build_call!(self.bitcoin.set_recovery_script(script.clone()));

Ok(PaidCall { payer, paid })
}

"nomic/PayToFeePool" => {
let msg = msg
.value
.as_object()
.ok_or_else(|| Error::App("Invalid message value".to_string()))?;

let amount: u64 = msg["amount"]
.as_str()
.ok_or_else(|| Error::App("Invalid amount".to_string()))?
.parse()
.map_err(|e: std::num::ParseIntError| Error::App(e.to_string()))?;

let payer = build_call!(self.bitcoin.transfer_to_fee_pool(amount.into()));
let paid = build_call!(self.app_noop());

Ok(PaidCall { payer, paid })
}

_ => Err(Error::App("Unsupported message type".into())),
}
}
Expand Down
29 changes: 28 additions & 1 deletion src/app/migrations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::incentives::Incentives;

use super::{InnerAppV0, InnerAppV1, InnerAppV2, InnerAppV3, InnerAppV4};
use super::{InnerAppV0, InnerAppV1, InnerAppV2, InnerAppV3, InnerAppV4, InnerAppV5};
use orga::{
coins::Take,
ibc::Ibc,
Expand Down Expand Up @@ -87,3 +87,30 @@ impl MigrateFrom<InnerAppV3> for InnerAppV4 {
})
}
}

impl MigrateFrom<InnerAppV4> for InnerAppV5 {
fn migrate_from(other: InnerAppV4) -> Result<Self> {
#[cfg(not(feature = "testnet"))]
{
todo!()
}

Ok(Self {
accounts: other.accounts,
staking: other.staking,
airdrop: other.airdrop,
community_pool: other.community_pool,
incentive_pool: other.incentive_pool,
staking_rewards: other.staking_rewards,
dev_rewards: other.dev_rewards,
community_pool_rewards: other.community_pool_rewards,
incentive_pool_rewards: other.incentive_pool_rewards,
bitcoin: other.bitcoin,
reward_timer: other.reward_timer,
upgrade: other.upgrade,
incentives: other.incentives,
ibc: other.ibc,
cosmos: other.cosmos,
})
}
}
Loading
Loading