Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e6dc423
Remove traces of custom version upgrade testing.
GTC6244 Jan 6, 2026
40849f4
First few changes - start simplification.
GTC6244 Jan 6, 2026
ae72c84
restore key_types in staking contract, allow validator cloning.
GTC6244 Jan 8, 2026
1cb3927
Update to allow old version to load
GTC6244 Jan 8, 2026
b4ec5d0
Merge branch 'keysets' into feature/node-4923-refactor-upgrade-tests-…
GTC6244 Jan 8, 2026
6edf704
update local builds
GTC6244 Jan 8, 2026
308629a
debugging updates
GTC6244 Jan 8, 2026
5fe91d1
better logging, disable network checks between epoch changes ( for now )
GTC6244 Jan 9, 2026
d00707d
clippy!
GTC6244 Jan 9, 2026
49ba1fd
add a filnal check.
GTC6244 Jan 9, 2026
54a3e1b
Merge branch 'keysets' into feature/node-4923-refactor-upgrade-tests-…
GTC6244 Jan 9, 2026
67908ec
cargo fmt
GTC6244 Jan 9, 2026
ca23a22
clippy.
GTC6244 Jan 9, 2026
9c4aef1
Merge branch 'keysets' into feature/node-4923-refactor-upgrade-tests-…
GTC6244 Jan 9, 2026
14b59e1
Download an install old binaries as required.
GTC6244 Jan 10, 2026
baeb4c3
ignore upgrades by default.
GTC6244 Jan 10, 2026
04fc82a
re-include Pallas curves in deployment scripts.
GTC6244 Jan 10, 2026
dc81384
add functions to create proper upgrade envrionment for old nodes ( r…
GTC6244 Jan 10, 2026
7bc6b64
blockchain abi stales + cargo fmt.
GTC6244 Jan 10, 2026
09c727e
disable test ( with same port )
GTC6244 Jan 10, 2026
745b714
re-add >= to epoch change
GTC6244 Jan 10, 2026
2e64a33
Update contracts to include keysets_deprecated type in tests.
GTC6244 Jan 10, 2026
5c042b8
missing "deprecated" param in test
GTC6244 Jan 11, 2026
f255b07
Merge branch 'keysets' into feature/node-4923-refactor-upgrade-tests-…
GTC6244 Jan 11, 2026
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: 10 additions & 0 deletions blockchain/contracts/abis/Staking.abi
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down Expand Up @@ -5912,6 +5917,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down
1 change: 1 addition & 0 deletions blockchain/contracts/contracts/lit-node/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract Staking {
// Most of this is related to staking / delegation
s.globalConfig[0] = LibStakingStorage.GlobalConfig({
tokenRewardPerTokenPerEpoch: (10 ** 18) / 20, // 18 decimal places in token
keyTypes_deprecated: new uint256[](0),
rewardEpochDuration: 1 hours,
maxTimeLock: 4 * 365 days,
minTimeLock: 90 days,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ contract FunctionSelectorHelper {
functionSignatures[15] = "decreaseRewardPool(uint256,uint256)";
functionSignatures[
16
] = "setConfig((uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))";
] = "setConfig((uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))";
functionSignatures[
17
] = "setComplaintConfig(uint256,(uint256,uint256,uint256,uint256))";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ library LibStakingStorage {

struct GlobalConfig {
uint256 tokenRewardPerTokenPerEpoch;
uint256[] keyTypes_deprecated;
uint256 minimumValidatorCount;
/// @notice Keep this the same as the epoch length for now.
uint256 rewardEpochDuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ async function main() {
const updatedGlobalConfig = {
tokenRewardPerTokenPerEpoch:
currentGlobalConfig.tokenRewardPerTokenPerEpoch,
keyTypes: currentGlobalConfig.keyTypes,
keyTypes_deprecated: currentGlobalConfig.keyTypes_deprecated,
minimumValidatorCount: currentGlobalConfig.minimumValidatorCount,
rewardEpochDuration: currentGlobalConfig.rewardEpochDuration,
maxTimeLock: currentGlobalConfig.maxTimeLock,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/contracts/snapshots/StakingTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"claimRewardsOver3Months": "17744229"
"claimRewardsOver3Months": "15729202"
}
2 changes: 2 additions & 0 deletions blockchain/contracts/test/lit-node/Staking.js
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ describe('Staking', function () {
await expect(
stakingAdminFacet.setConfig({
tokenRewardPerTokenPerEpoch: 1,
keyTypes_deprecated: [],
minimumValidatorCount: 1,
rewardEpochDuration: 1,
maxTimeLock: 1,
Expand Down Expand Up @@ -1557,6 +1558,7 @@ async function updateMinimumValidatorCount(

await stakingAdminFacet.setConfig({
tokenRewardPerTokenPerEpoch: currentConfig.tokenRewardPerTokenPerEpoch,
keyTypes_deprecated: currentConfig.keyTypes_deprecated,
minimumValidatorCount: newMinimumValidatorCount,
rewardEpochDuration: currentConfig.rewardEpochDuration,
maxTimeLock: currentConfig.maxTimeLock,
Expand Down
4 changes: 2 additions & 2 deletions rust/lit-core/lit-blockchain-lite/abis/PKPHelper.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions rust/lit-core/lit-blockchain-lite/abis/Staking.json
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down Expand Up @@ -5916,6 +5921,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down
4 changes: 2 additions & 2 deletions rust/lit-core/lit-blockchain-lite/src/contracts/pkp_helper.rs

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions rust/lit-core/lit-blockchain-lite/src/contracts/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3539,6 +3539,11 @@ abi_functions.append(&mut __abi_functions_4());
kind: ::ethers::core::abi::ethabi::ParamType::Tuple(
::std::vec![
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Array(
::std::boxed::Box::new(
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
),
),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
Expand Down Expand Up @@ -5121,6 +5126,11 @@ abi_functions.append(&mut __abi_functions_4());
kind: ::ethers::core::abi::ethabi::ParamType::Tuple(
::std::vec![
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Array(
::std::boxed::Box::new(
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
),
),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
Expand Down Expand Up @@ -10327,13 +10337,13 @@ abi_errors.append(&mut __abi_errors_2());
.method_hash([68, 14, 141, 34], (reason, config))
.expect("method not found (this should never happen)")
}
///Calls the contract's `setConfig` (0xd94c412d) function
///Calls the contract's `setConfig` (0x077b0d40) function
pub fn set_config(
&self,
new_config: GlobalConfig,
) -> ::ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([217, 76, 65, 45], (new_config,))
.method_hash([7, 123, 13, 64], (new_config,))
.expect("method not found (this should never happen)")
}
///Calls the contract's `setContractResolver` (0xf95d71b1) function
Expand Down Expand Up @@ -17783,7 +17793,7 @@ abi_errors.append(&mut __abi_errors_2());
pub reason: ::ethers::core::types::U256,
pub config: ComplaintConfig,
}
///Container type for all input parameters for the `setConfig` function with signature `setConfig((uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))` and selector `0xd94c412d`
///Container type for all input parameters for the `setConfig` function with signature `setConfig((uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))` and selector `0x077b0d40`
#[derive(
Clone,
::ethers::contract::EthCall,
Expand All @@ -17793,7 +17803,7 @@ abi_errors.append(&mut __abi_errors_2());
)]
#[ethcall(
name = "setConfig",
abi = "setConfig((uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))"
abi = "setConfig((uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))"
)]
pub struct SetConfigCall {
pub new_config: GlobalConfig,
Expand Down Expand Up @@ -23015,7 +23025,7 @@ abi_errors.append(&mut __abi_errors_2());
pub start_time: ::ethers::core::types::U256,
pub last_advance_vote_time: ::ethers::core::types::U256,
}
///`GlobalConfig(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)`
///`GlobalConfig(uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)`
#[derive(
Clone,
::ethers::contract::EthAbiType,
Expand All @@ -23030,6 +23040,7 @@ abi_errors.append(&mut __abi_errors_2());
)]
pub struct GlobalConfig {
pub token_reward_per_token_per_epoch: ::ethers::core::types::U256,
pub key_types_deprecated: ::std::vec::Vec<::ethers::core::types::U256>,
pub minimum_validator_count: ::ethers::core::types::U256,
pub reward_epoch_duration: ::ethers::core::types::U256,
pub max_time_lock: ::ethers::core::types::U256,
Expand Down
4 changes: 2 additions & 2 deletions rust/lit-core/lit-blockchain/abis/PKPHelper.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions rust/lit-core/lit-blockchain/abis/Staking.json
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down Expand Up @@ -5916,6 +5921,11 @@
"name": "tokenRewardPerTokenPerEpoch",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "keyTypes_deprecated",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "minimumValidatorCount",
Expand Down
4 changes: 2 additions & 2 deletions rust/lit-core/lit-blockchain/src/contracts/pkp_helper.rs

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions rust/lit-core/lit-blockchain/src/contracts/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3514,6 +3514,11 @@ pub mod staking {
kind: ::ethers::core::abi::ethabi::ParamType::Tuple(
::std::vec![
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Array(
::std::boxed::Box::new(
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
),
),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
Expand Down Expand Up @@ -5085,6 +5090,11 @@ pub mod staking {
kind: ::ethers::core::abi::ethabi::ParamType::Tuple(
::std::vec![
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Array(
::std::boxed::Box::new(
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
),
),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
::ethers::core::abi::ethabi::ParamType::Uint(256usize),
Expand Down Expand Up @@ -10228,13 +10238,13 @@ pub mod staking {
.method_hash([68, 14, 141, 34], (reason, config))
.expect("method not found (this should never happen)")
}
///Calls the contract's `setConfig` (0xd94c412d) function
///Calls the contract's `setConfig` (0x077b0d40) function
pub fn set_config(
&self,
new_config: GlobalConfig,
) -> ::ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([217, 76, 65, 45], (new_config,))
.method_hash([7, 123, 13, 64], (new_config,))
.expect("method not found (this should never happen)")
}
///Calls the contract's `setContractResolver` (0xf95d71b1) function
Expand Down Expand Up @@ -17684,7 +17694,7 @@ pub mod staking {
pub reason: ::ethers::core::types::U256,
pub config: ComplaintConfig,
}
///Container type for all input parameters for the `setConfig` function with signature `setConfig((uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))` and selector `0xd94c412d`
///Container type for all input parameters for the `setConfig` function with signature `setConfig((uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))` and selector `0x077b0d40`
#[derive(
Clone,
::ethers::contract::EthCall,
Expand All @@ -17694,7 +17704,7 @@ pub mod staking {
)]
#[ethcall(
name = "setConfig",
abi = "setConfig((uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))"
abi = "setConfig((uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))"
)]
pub struct SetConfigCall {
pub new_config: GlobalConfig,
Expand Down Expand Up @@ -22916,7 +22926,7 @@ pub mod staking {
pub start_time: ::ethers::core::types::U256,
pub last_advance_vote_time: ::ethers::core::types::U256,
}
///`GlobalConfig(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)`
///`GlobalConfig(uint256,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)`
#[derive(
Clone,
::ethers::contract::EthAbiType,
Expand All @@ -22931,6 +22941,7 @@ pub mod staking {
)]
pub struct GlobalConfig {
pub token_reward_per_token_per_epoch: ::ethers::core::types::U256,
pub key_types_deprecated: ::std::vec::Vec<::ethers::core::types::U256>,
pub minimum_validator_count: ::ethers::core::types::U256,
pub reward_epoch_duration: ::ethers::core::types::U256,
pub max_time_lock: ::ethers::core::types::U256,
Expand Down
38 changes: 31 additions & 7 deletions rust/lit-node/lit-node-testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pub mod validator;
use self::testnet::Testnet;
use self::testnet::node_config::CustomNodeRuntimeConfig;
use self::validator::ValidatorCollection;
use crate::testnet::StakerAccountSetupMapper;
use crate::testnet::contracts::StakingContractRealmConfig;
use crate::testnet::{BeforeStartValidatorsFn, StakerAccountSetupMapper};
use crate::{end_user::EndUser, validator::default_datil_keyset_config};
use ethers::types::U256;
use futures::future::BoxFuture;
Expand Down Expand Up @@ -58,6 +58,9 @@ pub struct TestSetupBuilder {
staker_account_setup_mapper: Option<
Box<dyn StakerAccountSetupMapper<Future = BoxFuture<'static, Result<(), anyhow::Error>>>>,
>,
before_start_validators_fn: Option<
Box<dyn BeforeStartValidatorsFn<Future = BoxFuture<'static, Result<(), anyhow::Error>>>>,
>,
}

impl Default for TestSetupBuilder {
Expand All @@ -84,6 +87,7 @@ impl Default for TestSetupBuilder {
asleep_initially_override: None,
staker_account_setup_mapper: None,
low_kick_tolerance: false,
before_start_validators_fn: None,
}
}
}
Expand Down Expand Up @@ -196,6 +200,18 @@ impl TestSetupBuilder {
self
}

pub fn before_start_validators_fn(
mut self,
before_start_validators_fn: Option<
Box<
dyn BeforeStartValidatorsFn<Future = BoxFuture<'static, Result<(), anyhow::Error>>>,
>,
>,
) -> Self {
self.before_start_validators_fn = before_start_validators_fn;
self
}

pub fn include_datil_testnet(mut self, include_datil_testnet: DatilTestnetType) -> Self {
self.include_datil_testnet = include_datil_testnet;
self
Expand Down Expand Up @@ -238,19 +254,19 @@ impl TestSetupBuilder {
.epoch_length(self.epoch_length)
.max_presign_count_u64(self.max_presign_count)
.min_presign_count_u64(self.min_presign_count)
.default_key_set(Some(DEFAULT_KEY_SET_NAME.to_string()))
.build();

info!(
"Staking contract realm config: {:?}",
staking_contract_realm_config
);

let _testnet_contracts =
Testnet::setup_contracts(&mut testnet, None, Some(staking_contract_realm_config))
.await
.expect("Failed to setup contracts");

testnet
.actions()
.set_default_keyset_id(1, DEFAULT_KEY_SET_NAME)
.await
.expect("Failed to set default keyset id");

if self.low_kick_tolerance {
testnet
.actions()
Expand Down Expand Up @@ -367,6 +383,14 @@ impl TestSetupBuilder {
"lit-actions,testing".to_string()
};

if let Some(mut before_start_validators_fn) = self.before_start_validators_fn {
let actions = testnet.actions().clone();
before_start_validators_fn
.run(actions)
.await
.expect("Failed to run a required function before starting validators.");
}

let validator_collection = ValidatorCollection::builder()
.num_staked_nodes(num_staked_nodes)
.wait_initial_epoch(self.wait_initial_epoch)
Expand Down
18 changes: 18 additions & 0 deletions rust/lit-node/lit-node-testnet/src/testnet/actions/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,22 @@ impl Actions {
}
Ok(())
}

pub async fn clear_presigns(&self) -> Result<()> {
let r = self
.contracts
.staking
.emit_clear_offline_phase_data(U256::from(1))
.call()
.await;
if r.is_err() {
return Err(anyhow::anyhow!(
"Error clearing presigns: {:?}",
r.err().unwrap()
));
} else {
info!("Presigns cleared");
}
Ok(())
}
}
Loading