Skip to content

Commit

Permalink
Fix contract account sufficients (#146)
Browse files Browse the repository at this point in the history
* Update sufficient

* Inc sufficient for contract account

* Fix

* Use new style
  • Loading branch information
boundless-forest authored Dec 22, 2022
1 parent 08b703a commit 8b46c6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tool/state-processor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ impl State {
self
}

fn contains_key(&self, key: &str) -> bool {
self.0.contains_key(key)
}

// fn inc_consumers(&mut self, who: &str) {}

// fn transfer(&mut self, from: &str, to: &str, amount: u128) {}
Expand Down
11 changes: 11 additions & 0 deletions tool/state-processor/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ impl Processor {
};

if let Some(k) = try_get_evm_address(&key) {
// If the evm account is a contract contract with sufficients, then we should
// increase the sufficients by one.
if self.solo_state.contains_key(&full_key(
b"EVM",
b"AccountCodes",
&blake2_128_concat_to_string(k),
)) && a.sufficients == 0
{
a.sufficients += 1;
}

self.shell_state.insert_value(
b"System",
b"Account",
Expand Down

0 comments on commit 8b46c6c

Please sign in to comment.