ArweaveTeam / arweave

The Arweave server and App Developer Toolkit.
https://www.arweave.org
GNU General Public License v2.0
913 stars 201 forks source link

Issue with Mining Initialization on Custom NETWORK_NAME and Port #600

Closed xgocn closed 1 month ago

xgocn commented 1 month ago

I am attempting to set up a custom Arweave network for educational purposes on port 1979 and encountered an issue when trying to start mining.

root@youshu:~# ls /root/hisweave-data
wallets

root@youshu:~# ls /root/hisweave-data/wallets
arweave_keyfile_H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs.json

root@youshu:~# sudo ./hisweave/bin/start debug init data_dir /root/hisweave-data mining_addr H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs stora
ge_module 0,H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs mine  max_disk_
pool_buffer_mb 1  port 1979 

Arweave launch script: ./hisweave/bin/start
Arweave launch script: /root/hisweave/bin/arweave
Arweave launch options: +Ktrue +A1024 +SDio1024     +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf     +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long     +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi
debug init data_dir /root/hisweave-data mining_addr H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs storage_module 0,H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs mine max_disk_pool_buffer_mb 1 port 1979
Custom Erlang Options: 
Launching Erlang Virtual Machine...
Exec: /root/hisweave/erts-12.3.2.17/bin/erlexec -noinput +Bd -boot /root/hisweave/releases/2.7.4/start -mode embedded -boot_var SYSTEM_LIB_DIR /root/hisweave/lib -config /root/hisweave/releases/2.7.4/sys.config -args_file /root/hisweave/releases/2.7.4/vm.args -- foreground +Ktrue +A1024 +SDio1024 +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi -run ar main debug init data_dir /root/hisweave-data mining_addr H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs storage_module 0,H4To1SisNDbKMOkxiXL2b9t4mWcOMelHKXLylnW6hTs mine max_disk_pool_buffer_mb 1 port 1979
Root: /root/hisweave
/root/hisweave
=INFO REPORT==== 12-Aug-2024::17:31:44.966377 ===
    alarm_handler: {set,{system_memory_high_watermark,[]}}

VDF step computed in 0.05 seconds.

2024-08-12T17:31:48.212039+08:00 [error] gen_server:error_info/7:949 Generic server ar_wallets terminating. Reason: {{badmatch,false},[{ar_wallets,set_current,4,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,382}]},{ar_wallets,initialize_state,2,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,255}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}. Last message: {'$gen_cast',{init,[{block,<<>>,<<>>,1723455107,1723455107,113982837842983129870077688367927159293062641155239930226341059257789486989312,0,<<>>,<<220,57,175,117,70,131,198,117,110,43,143,238,196,238,76,233,43,89,22,151,191,127,245,19,193,74,147,213,64,150,189,149,156,155,118,100,252,9,12,212,204,234,179,96,245,167,196,31>>,[{tx,1,<<50,75,6,247,11,234,240,104,5,33,176,215,123,173,113,16,127,27,110,206,48,36,177,88,72,241,178,89,10,20,116,124>>,<<>>,<<176,147,56,174,28,81,121,81,234,208,164,152,148,163,98,250,84,30,189,255,31,189,163,49,123,244,38,244,81,105,226,252,134,168,250,110,123,45,130,144,123,200,139,101,93,34,238,223,234,157,106,248,249,155,209,148,148,35,210,37,48,200,82,218,111,117,88,132,49,119,41,203,242,119,174,211,24,203,14,157,191,49,31,29,232,83,174,237,181,249,41,86,14,218,106,52,247,124,19,10,207,13,24,203,80,18,181,79,248,217,35,236,122,211,37,1,156,115,59,224,48,12,151,14,82,78,18,185,82,206,106,164,134,194,38,202,118,191,225,12,76,69,152,54,147,120,130,241,70,242,79,155,61,47,177,36,190,159,70,242,213,193,111,154,21,49,178,221,166,63,116,39,138,231,233,167,24,73,199,193,128,132,222,225,206,132,37,239,181,128,208,28,5,23,22,78,94,13,187,162,179,29,13,171,7,138,117,250,89,32,171,19,199,83,227,90,163,65,205,76,45,142,127,64,254,237,133,176,14,193,27,53,241,30,...>>,[],<<>>,0,<<154,35,247,251,146,189,135,97,42,144,61,120,119,17,206,199,25,37,166,117,11,157,81,204,2,229,65,35,38,255,61,178,97,83,130,56,69,90,37,234,85,158,223,13,76,243,211,57,70,120,169,214,233,58,175,110,101,102,49,57,181,136,64,14,100,194,94,22,61,251,146,230,238,77,105,9,48,254,158,33,133,137,136,126,81,228,4,141,139,199,205,255,60,85,138,161,21,165,95,163,65,104,195,240,159,194,132,242,46,80,220,144,47,139,130,7,31,95,110,54,168,65,58,38,111,3,151,166,193,96,81,228,196,169,51,191,217,39,177,23,165,140,247,215,84,97,38,249,42,231,230,51,142,165,159,229,3,140,128,176,44,121,106,41,27,14,73,9,117,22,91,162,212,28,243,110,20,39,0,213,113,83,247,99,4,210,141,146,208,233,109,215,94,126,117,199,251,125,203,108,211,4,240,28,191,115,210,25,230,240,62,176,146,125,133,55,191,100,46,29,93,12,43,140,43,202,226,34,226,133,...>>,786432,[],<<>>,<<31,63,88,49,234,140,85,190,107,217,66,81,127,40,243,231,93,50,11,241,117,134,97,104,142,190,175,116,134,203,61,178,158,74,192,1,252,73,78,236,144,121,167,247,151,100,105,180,121,194,122,228,128,224,62,216,35,138,164,241,246,199,14,185,170,231,12,219,3,228,94,113,160,56,18,143,119,222,209,211,62,14,107,149,187,112,23,231,47,55,249,32,171,63,201,5,142,223,38,245,46,35,89,5,22,199,108,3,19,111,97,111,81,128,37,218,111,252,230,146,154,237,138,184,200,10,41,13,131,177,237,198,38,144,9,11,236,200,108,219,118,88,248,4,30,189,92,12,95,187,15,173,191,224,187,153,37,53,20,98,37,32,203,190,8,97,204,45,122,33,145,196,94,183,95,244,79,213,229,95,33,40,100,120,174,177,201,253,56,66,55,144,60,12,91,239,219,149,231,18,13,153,200,128,0,202,10,198,203,104,193,21,55,165,101,41,174,199,67,238,131,9,119,56,55,116,...>>,0,0,{rsa,65537}}],<<245,122,12,7,43,38,195,178,232,47,83,229,252,59,127,58,137,107,203,239,42,16,45,252,28,34,199,125,103,210,111,239>>,[],unset,<<>>,<<205,103,115,233,179,75,53,132,5,69,31,55,225,243,54,165,79,49,121,145,57,37,46,195,56,67,190,167,11,224,214,154,207,159,241,148,141,181,169,117,140,201,86,19,158,57,106,152>>,unclaimed,[],0,786432,786432,0,[{{<<50,75,6,247,11,234,240,104,5,33,176,215,123,173,113,16,127,27,110,206,48,36,177,88,72,241,178,89,10,20,116,124>>,<<165,219,231,90,221,48,12,201,25,99,48,213,102,201,61,103,21,90,94,160,167,35,156,131,162,19,145,130,228,54,94,47>>},786432}],{poa,1,<<>>,<<>>,<<>>},{1,5},{1,5},0,786432,#{root => {no_parent,{2,{<<31>>,nil,{<<151>>,nil,nil}}},no_hash,no_prefix,no_value},size => 2,<<31>> => {root,{0,nil},no_hash,<<132,232,213,40,172,52,54,202,48,233,49,137,114,246,111,219,120,153,103,14,49,233,71,41,114,242,150,117,186,133,59>>,{v,{1000000000000000000000000,<<>>}}},<<151>> => {root,{0,nil},no_hash,<<147,171,74,226,186,126,159,110,95,38,125,121,192,196,45,77,243,130,226,200,60,58,64,19,202,128,221,42,86,23,175>>,{v,{0,<<50,75,6,247,11,234,240,104,5,33,176,215,123,173,113,16,127,27,110,206,48,36,177,88,72,241,178,89,10,20,116,124>>}}}},<<>>,undefined,0,<<>>,undefined,{nonce_limiter_info,<<>>,<<>>,<<>>,<<>>,0,0,1,[],[],2,2},{poa,1,<<>>,<<>>,<<>>},undefined,<<>>,undefined,0,0,undefined,[],0,1,0,1,0,undefined,0,undefined,undefined,undefined,undefined,[],undefined,undefined,undefined}],[{from_state,100}]}}. State: {#{<<>> => {sink,#{root => {no_parent,{0,nil},no_hash,no_prefix,no_value},size => 0},{0,not_set}}},<<>>,#{<<>> => {set,0,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}}}.
2024-08-12T17:31:49.466501+08:00 [error] proc_lib:crash_report/4:525 crasher: initial call: ar_wallets:init/1, pid: <0.1021.0>, registered_name: ar_wallets, error: {{badmatch,false},[{ar_wallets,set_current,4,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,382}]},{ar_wallets,initialize_state,2,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,255}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}, ancestors: [ar_node_worker,ar_node_sup,ar_sup,<0.825.0>], message_queue_len: 0, messages: [], links: [<0.972.0>], dictionary: [], trap_exit: true, status: running, heap_size: 6189440, stack_size: 29, reductions: 13980749; neighbours: []
2024-08-12T17:31:49.467462+08:00 [error] ar_node_worker:handle_info/2:591 event: unhandled_info, module: ar_node_worker, message: {'EXIT',<0.1021.0>,{{badmatch,false},[{ar_wallets,set_current,4,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,382}]},{ar_wallets,initialize_state,2,[{file,"/root/arweave/apps/arweave/src/ar_wallets.erl"},{line,255}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}

how to resolve the errors?

Thank you for your help!

xgocn commented 1 month ago

the second node:

root@xiangtu:~# hisweave/bin/start peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGB IgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Arweave launch script: hisweave/bin/start Arweave launch script: /root/hisweave/bin/arweave Arweave launch options: +Ktrue +A1024 +SDio1024 +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Custom Erlang Options: Launching Erlang Virtual Machine... Exec: /root/hisweave/erts-12.2.1/bin/erlexec -noinput +Bd -boot /root/hisweave/releases/2.7.4/start -mode embedded -boot_var SYSTEM_LIB_DIR /root/hisweave/lib -config /root/hisweave/releases/2.7.4/sys.config -args_file /root/hisweave/releases/2.7.4/vm.args -- foreground +Ktrue +A1024 +SDio1024 +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi -run ar main peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Root: /root/hisweave /root/hisweave =INFO REPORT==== 12-Aug-2024::17:56:36.774914 === alarm_handler: {set,{system_memory_high_watermark,[]}}

VDF step computed in 0.05 seconds.

2024-08-12T17:57:08.238882+08:00 [error] ar_join:get_block_index/2:88 event: failed_to_fetch_block_index [os_mon] cpu supervisor port (cpu_sup): Erlang has closed [os_mon] memory supervisor port (memsup): Erlang has closed Arweave Heartbeat: Server terminated safely.

xgocn commented 1 month ago

when I restart the second node:

root@xiangtu:~# hisweave/bin/start peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Arweave launch script: hisweave/bin/start Arweave launch script: /root/hisweave/bin/arweave Arweave launch options: +Ktrue +A1024 +SDio1024 +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Custom Erlang Options: Launching Erlang Virtual Machine... Exec: /root/hisweave/erts-12.2.1/bin/erlexec -noinput +Bd -boot /root/hisweave/releases/2.7.4/start -mode embedded -boot_var SYSTEM_LIB_DIR /root/hisweave/lib -config /root/hisweave/releases/2.7.4/sys.config -args_file /root/hisweave/releases/2.7.4/vm.args -- foreground +Ktrue +A1024 +SDio1024 +MBsbct 103424 +MBsmbcs 10240 +MBlmbcs 410629 +MBmmmbc 1024 +MBas aobf +sbwtvery_long +sbwtdcpuvery_long +sbwtdiovery_long +swtvery_low +swtdcpuvery_low +swtdiovery_low +Bi -run ar main peer node1IP:1979 data_dir /root/hisweave-data mining_addr Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA storage_module 0,Y0vGBIgGBHCSgCEgaxju-9_9wiXpYueaaptbctPrYAA mine max_disk_pool_buffer_mb 1 port 1979 Root: /root/hisweave /root/hisweave =INFO REPORT==== 12-Aug-2024::18:03:15.097893 === alarm_handler: {set,{system_memory_high_watermark,[]}}

VDF step computed in 0.05 seconds.

dets: file "/root/hisweave-data/ar_tx_blacklist/ar_tx_blacklist" not properly closed, repairing ... dets: file "/root/hisweave-data/ar_tx_blacklist/ar_tx_blacklist_pending_headers" not properly closed, repairing ... dets: file "/root/hisweave-data/ar_tx_blacklist/ar_tx_blacklist_pending_data" not properly closed, repairing ... dets: file "/root/hisweave-data/ar_tx_blacklist/ar_tx_blacklist_offsets" not properly closed, repairing ... dets: file "/root/hisweave-data/ar_tx_blacklist/ar_tx_blacklist_pending_restore_headers" not properly closed, repairing ... 2024-08-12T18:03:46.471533+08:00 [error] ar_join:get_block_index/2:88 event: failed_to_fetch_block_index [os_mon] memory supervisor port (memsup): Erlang has closed [os_mon] cpu supervisor port (cpu_sup): Erlang has closed Arweave Heartbeat: Server terminated safely.

xgocn commented 1 month ago

GET http://node1IP:1979/info

{"version":5,"release":71,"queue_length":0,"peers":1,"node_state_latency":0,"network":"hisweave","height":-1,"current":"not_joined","blocks":0}

shizzard commented 1 month ago

@xgocn I think the problem here is that you really need to build the localnet release from scratch. To do that you need to

Alternatively, if you want to hack the arweave source code or play with something else, you can take a look at localnet profile, you will see the list of parameters you can alter with ERL_COMPILER_OPTIONS env variable. Note, that these will only make any difference if you will be recompiling the source from scratch (ensure to run ./rebar3 clean or just remove the _build directory)

xgocn commented 1 month ago

thank you for your help.

I have followed the setup instructions and configured the hisweave profile in rebar.config. However, when I attempt to start mining, I encounter the following error:

error: {{badmatch,false},[{ar_wallets,set_current,4,[{file,"/root/arweave/apps/ar_wallets.erl"},{line,382}]},{ar_wallets,initialize_state,2,[{file,"/root/arweave/apps/ar_wallets.erl"},{line,255}]}...

Steps to Reproduce:

  1. Modify rebar.config to add a new profile hisweave with the following configuration:

       {hisweave, [
           {relx, [
               {dev_mode, false},
               {include_erts, true}
           ]},
           {erl_opts, [
               {d, 'DEBUG', debug},
               {d, 'NETWORK_NAME', "hisweave"}
           ]}
       ]}
  2. Install Erlang and dependencies:

    sudo apt update
    sudo apt install -y erlang
  3. Build the release:

    ./rebar3 as hisweave tar
  4. Extract and configure the node:

    mv _build/hisweave/rel/arweave/arweave-2.7.4.tar.gz ./
    tar -zxvf arweave-2.7.4.tar.gz -C ./hisweave
    ~/hisweave/bin/create-wallet ~/hisweave-data
  5. Attempt to start mining:

    ./hisweave/bin/start init data_dir /root/hisweave-data mining_addr <my_address> storage_module 0,<my_address> mine max_disk_pool_buffer_mb 1 port 1979

was this right?

shizzard commented 1 month ago

@xgocn The part you're missing is {d, 'FORKS_RESET', true} setting in localnet profile. What this actually does is resetting the hardfork heights to zero, allowing you to start the new weave with the latest code. Try to add this option to your profile, delete the _build directory and rebuild the release.

xgocn commented 1 month ago

ok. thank you, I'll try it

xgocn commented 1 month ago

IT WORKS!

By the way, if I add {d, 'DEBUG', debug} and {d, 'TEST', true}, will these two options prevent hisweave from becoming a production environment?Or, what difference will it bring to the running results?

shizzard commented 1 month ago

@xgocn actually there are two ways to ensure this: change the network name and the list of trusted peers. The network name is changed with compilation flag, and the list of peers is defined in the start arguments of the node.

shizzard commented 1 month ago

I'll close this issue as resolved for now. If you have any further questions, consider joining the Arweave discord server and asking the questions there.

xgocn commented 1 month ago

ok,thank u!