diff --git a/convex-core/src/main/java/convex/core/cpos/CPoSConstants.java b/convex-core/src/main/java/convex/core/cpos/CPoSConstants.java index f207e88cb..d635ab3fb 100644 --- a/convex-core/src/main/java/convex/core/cpos/CPoSConstants.java +++ b/convex-core/src/main/java/convex/core/cpos/CPoSConstants.java @@ -57,10 +57,11 @@ public class CPoSConstants { * Minimum milliseconds to retain a proposal before switching */ public static final long KEEP_PROPOSAL_TIME = 100; + /** * Memory allowance for genesis user / peer accounts */ - public static final long INITIAL_ACCOUNT_ALLOWANCE = 1000000; + public static final long INITIAL_ACCOUNT_ALLOWANCE = 10000; /** * Maximum allowed encoded peer message length in bytes (50mb) diff --git a/convex-core/src/main/java/convex/core/init/Init.java b/convex-core/src/main/java/convex/core/init/Init.java index b5bcc89f3..6867b8296 100644 --- a/convex-core/src/main/java/convex/core/init/Init.java +++ b/convex-core/src/main/java/convex/core/init/Init.java @@ -76,6 +76,9 @@ public class Init { public static final AccountKey DEFAULT_GOV_KEY = AccountKey.fromHex("12EF73ee900eD1FE78A188f59bF8CedE467bAA66f5b60368aFAaA3B9521aB94d"); + private static final long RESERVED_USER_LIMIT = 64; + private static final long RESERVED_ACTOR_LIMIT = 128; + /** * Creates the base genesis state (before deployment of standard libraries and actors). This is the minimum state required for Convex operation. @@ -216,6 +219,11 @@ public static State createBaseState(AccountKey governanceKey, AccountKey genesis // Initial user account, follows genesis peer controller(s) accts=addAccount(accts,Address.create(accts.count()),FIRST_USER_KEY,0); + + // Reserve user accounts in base state + while(accts.count() addAccount(AVector accts, Ad long balance) { if (accts.count() != a.longValue()) throw new Error("Incorrect account address: " + a); AccountStatus as = AccountStatus.create(0L, balance, key); + as=as.withController(ADMIN_ADDRESS); as = as.withMemory(CPoSConstants.INITIAL_ACCOUNT_ALLOWANCE); accts = accts.conj(as); return accts; } + + public static AVector addReservedActorAccount(AVector accts, Address a) { + if (accts.count() != a.longValue()) throw new Error("Incorrect account address: " + a); + AccountStatus as = AccountStatus.create(0L, 0L, null); + as=as.withController(ADMIN_ADDRESS); + accts = accts.conj(as); + return accts; + } /** @@ -308,6 +327,9 @@ public static State createState(AccountKey governanceKey, AccountKey genesisKey, State s=createBaseState(governanceKey, genesisKey, peerKeys); s = addStandardLibraries(s); + + s=addReservedAccounts(s); + s = addTestingCurrencies(s); s = addCNSExtraTree(s); @@ -319,6 +341,16 @@ public static State createState(AccountKey governanceKey, AccountKey genesisKey, return s; } + private static State addReservedAccounts(State s) { + AVector accts = s.getAccounts(); + while(accts.count()