Skip to content

Commit c98853c

Browse files
Extend fix to entity case
1 parent 7db340e commit c98853c

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

execution_engine_testing/tests/src/test/system_contracts/genesis.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ static ACCOUNT_3_PUBLIC_KEY: Lazy<PublicKey> = Lazy::new(|| {
3939
let secret_key = SecretKey::ed25519_from_bytes([45; SecretKey::ED25519_LENGTH]).unwrap();
4040
PublicKey::from(&secret_key)
4141
});
42-
static ACCOUNT_3_ADDR: Lazy<AccountHash> = Lazy::new(|| AccountHash::from(&*ACCOUNT_3_PUBLIC_KEY));
4342

4443
static GENESIS_CUSTOM_ACCOUNTS: Lazy<Vec<GenesisAccount>> = Lazy::new(|| {
4544
let account_1 = {
@@ -139,6 +138,16 @@ fn should_run_genesis() {
139138
#[ignore]
140139
#[test]
141140
fn should_track_total_token_supply_in_mint() {
141+
should_track_total_token(false)
142+
}
143+
144+
#[ignore]
145+
#[test]
146+
fn should_track_total_token_supply_in_mint_with_enable_addressable_entity() {
147+
should_track_total_token(true)
148+
}
149+
150+
fn should_track_total_token(enable_ae: bool) {
142151
let accounts = GENESIS_CUSTOM_ACCOUNTS.clone();
143152
let wasm_config = *DEFAULT_WASM_CONFIG;
144153
let system_config = *DEFAULT_SYSTEM_CONFIG;
@@ -160,6 +169,7 @@ fn should_track_total_token_supply_in_mint() {
160169
.with_unbonding_delay(unbonding_delay)
161170
.with_genesis_timestamp_millis(genesis_timestamp)
162171
.with_storage_costs(*DEFAULT_STORAGE_COSTS)
172+
.with_enable_addressable_entity(enable_ae)
163173
.build();
164174

165175
let genesis_request = GenesisRequest::new(
@@ -169,7 +179,9 @@ fn should_track_total_token_supply_in_mint() {
169179
DEFAULT_CHAINSPEC_REGISTRY.clone(),
170180
);
171181

172-
let mut builder = LmdbWasmTestBuilder::default();
182+
let chainspec_config = ChainspecConfig::default().with_enable_addressable_entity(enable_ae);
183+
184+
let mut builder = LmdbWasmTestBuilder::new_temporary_with_config(chainspec_config);
173185

174186
builder.run_genesis(genesis_request);
175187

storage/src/system/genesis/entity_installer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ where
356356
) in genesis_delegators.iter()
357357
{
358358
if (*validator_public_key).clone() == public_key.clone() {
359+
total_staked_amount += delegator_delegated_amount.value();
359360
let purse_uref =
360361
self.create_purse(delegator_delegated_amount.value())?;
361362

0 commit comments

Comments
 (0)