Cannot add another entry since the register entry cap has been reached: 1024

So I was messing with a wee script to stress DBC transactions. Running on a 30 node testnet it puts the genesis DBC into WALLET01 and then reissues 10SNT and deposits that into WALLET02 1000 times.

But after 511 loops, this happens

Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525519019.999996430 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 5100.000000000 safecoins
[
  "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o",
  "dbc-08699f29"
]
Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525519009.999996423 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 5110.000000000 safecoins
Error: 
   0: ClientError: Cannot add another entry since the register entry cap has been reached: 1024
   1: Cannot add another entry since the register entry cap has been reached: 1024

Location:
   sn_cli/src/subcommands/wallet.rs:235

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: 
   0: Could not deserialize specified hex string to a DBC: io error: unexpected end of file

Aaaaaand…

total balance of 4525519009.999996423

so how come I’m missing 0.000000007 SNT per Tx? Are we already implementing fees?

Easier to see from the top of the log

Spendable DBC deposited (4525524120.000000000 safecoins) with name 'dbc-83698983' in wallet located at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o"
Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525524120.000000000 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 0.000000000 safecoins
-------------------------------------------


[
  "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o",
  "dbc-56bffa7f"
]
Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525524109.999999993 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 10.000000000 safecoins
[
  "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o",
  "dbc-8b7d2450"
]
Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525524099.999999986 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 20.000000000 safecoins
[
  "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o",
  "dbc-13c79c02"
]
Wallet at "safe://hyryynyzj5msffzwgasujkrk6u5ieug7pzdoo867mxzz1pk3cu75ir74mnhb6o" has a total balance of 4525524089.999999979 safecoins
Wallet at "safe://hyryynys9hyj86rsps83xeg3fbny6t3gexcrrsasfmcm9yrg8ehdduuq1rab6o" has a total balance of 30.000000000 safecoins
5 Likes

This is fees, yes :slight_smile:
A hardcoded 1 nano per Elder (so 7 nanos per input in a tx).

The wallet has so far been implemented over a single register, so that’s the limitation it’s had.

14 Likes

OK so for now in stress testing DBCs I should keep below ~500 Tx per wallet? Is that like 1 credit, 1 debit internally so we soon get to 1024?

If I start a node with the -w, --wallet-id <WALLET_ID> flag would these nanoSNT show up there or is that only for farming (as it was once known)

This bit of the safenode --help docs needs brought into line with the “FFS don’t call it farming” policy

3 Likes

Exercise for DBC and CPU

try this script.

#!/usr/bin/env bash

set_env_vars () {
    export SAFE_ROOT=$HOME/.safe
    export SAFE_BIN=/usr/local/bin
    export WALLET_DATA=$SAFE_ROOT/tmp
    export TESTNET_BIN=$HOME/projects/maidsafe/safe_network/target/release
}

spacer () {
    echo "-------------------------------------------"
    echo ""
    echo ""
}

clean_up () {
    #clean up from any previous run
    pkill safenode > /dev/null
    [ -f "$WALLET_DATA " ] && rm -v $WALLET_DATA   #make sure this is cleared    
    cd $SAFE_ROOT/node
    trash-put -r -v ./baby* ./local*
    mkdir -p $WALLET_DATA
    spacer
}

init_testnet () {
    $TESTNET_BIN/testnet -c20 -i 2000
    spacer
}

check_network () {
    #$SAFE_BIN/safe networks switch $TESTNET_NAME
    $SAFE_BIN/safe networks
    $SAFE_BIN/safe networks check
    $SAFE_BIN/safe networks sections
    spacer
}

create_wallets_and_fund () {  
    safe keys create --for-cli
    safe wallet create --json > $WALLET_DATA/wallet01.txt
    safe wallet create --json > $WALLET_DATA/wallet02.txt    
    export WALLET01=$(cat $WALLET_DATA/wallet01.txt|cut -d '"' -f 2)
    export WALLET02=$(cat $WALLET_DATA/wallet02.txt|cut -d '"' -f 2)
    echo $WALLET01
    echo $WALLET02
    safe wallet deposit --force --dbc ~/.safe/node/local-test-network/safenode-genesis/genesis_dbc $WALLET01
    safe wallet balance $WALLET01
    safe wallet balance $WALLET02
    spacer
}

stress_Txs () { 
    for i in {1..500};
        do
        AMOUNT=10 #$(( (RANDOM % 80) + 20 ))
        $SAFE_BIN/safe wallet reissue --json --from $WALLET01 $AMOUNT > $WALLET_DATA/dbc
        $SAFE_BIN/safe wallet deposit --json --dbc $WALLET_DATA/dbc $WALLET02
        echo $($SAFE_BIN/safe wallet balance $WALLET01)
        echo $($SAFE_BIN/safe wallet balance $WALLET02)
        done
}    

set_env_vars
clean_up
init_testnet
check_network
create_wallets_and_fund
stress_Txs

note you will need to change line7 to point to the location of the testnet binary on your box.

This will warm up your CPU :slight_smile:

Change line 56 to pay a random amount on each Tx

AMOUNT=10 #$(( (RANDOM % 80) + 20 ))

delete 10 # and it will deposit between 20 and 100 SNT on each Tx

have fun :slight_smile:

on line 47 the --force flag is redundant now as we are starting a new testnet and hence genesis DBC on each run. was handy for testing though.

1 Like

I posted this on the wrong thread

1 Like

Are there plans to migrate the wallet to its own data structure that will allow for >1024 entries?
I think we need this fairly soon to allow for proper intensive testing.

1 Like

The plan for payment-network was to start with a local wallet. I have that implementation going already. And it is designed with storage in network in mind. So the structure and patterns are directly applicable on the network data structure, for when the time for that comes.

And that is, at a first stage, chained registers.

But a couple of years ago now, I made an implementation of a B+tree over the MutableData/AppendOnly structures we had before, and AppendOnly is what became a register. (Ever expanding database, is a search phrase that might turn up something here.)

Anyway, if I dive into that again, then we’re looking at a db fundament, with indexing. Much more scalable than a simple chained register.

Now, I don’t think a wallet couldn’t be satisfactorily designed without a B+tree, especially in early phases. But with that I know you would never need to worry about capacity and keep acceptable access times :slight_smile:

5 Likes

Thank you for that and thank you for your efforts in general.

I need to go away and read up on a few things. I was never taught CompSci - nor in fact anything other than BASIC at college so I am a bit lost on B+trees and database theory in general.
I’ll do some reading then look at your answer above and see if I am much wiser then.

Ill start with a search on Ever expanding database :slight_smile:

2 Likes

This topic was automatically closed after 60 days. New replies are no longer allowed.