aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
5.93k stars 3.58k forks source link

[Bug] aptos genesis generate-genesis #1723

Closed imduchuyyy closed 2 years ago

imduchuyyy commented 2 years ago

🐛 Bug

Expected Behavior

Error when run

aptos genesis generate-genesis --assume-yes --local-repository-dir $HOME/.aptos --output-dir $HOME/.aptos

Receive Message

MISSING_DEPENDENCY, sub_status: None, message: None, exec_state: None, location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000001, name: Identifier(\"Account\") }), indices: [(FunctionHandle, 0)], offsets: [] }"}
thread 'main' panicked at 'Error calling Genesis.initialize: status UNEXPECTED_VERIFIER_ERROR of type Invariant violation', aptos-move/vm-genesis/src/lib.rs:156:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
imduchuyyy commented 2 years ago

Full Script Run

wget -qO aptos-cli.zip https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-0.2.0/aptos-cli-0.2.0-Ubuntu-x86_64.zip
unzip -o aptos-cli.zip
chmod +x aptos
mv aptos /usr/local/bin 

#create folder,download config    
IPADDR=$(curl ifconfig.me) 
sleep 2   
mkdir -p $HOME/.aptos
cd $HOME/.aptos
wget -O $HOME/.aptos/docker-compose.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/docker-compose.yaml
wget -O $HOME/.aptos/validator.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/validator.yaml
#wget -O fullnode.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/fullnode.yaml

aptos genesis generate-keys --assume-yes --output-dir $HOME/.aptos

aptos genesis set-validator-configuration \
    --keys-dir $HOME/.aptos --local-repository-dir $HOME/.aptos \
    --username $APTOS_NODENAME \
    --validator-host $IPADDR:6180

#aptos key generate --assume-yes --output-file root_key.txt
#KEYTXT=$(cat ~/.aptos/root_key.txt.pub) 
#KEY="0x"$KEYTXT 

echo "---
root_key: \"F22409A93D1CD12D2FC92B5F8EB84CDCD24C348E32B3E7A720F3D2E288E63394\"
users:
  - \"$APTOS_NODENAME\"
chain_id: 40
min_stake: 0
max_stake: 100000
min_lockup_duration_secs: 0
max_lockup_duration_secs: 2592000
epoch_duration_secs: 86400
initial_lockup_timestamp: 1656615600
min_price_per_gas_unit: 1
allow_new_validators: true" >layout.yaml

wget -O $HOME/.aptos/framework.zip https://github.com/aptos-labs/aptos-core/releases/download/aptos-framework-v0.2.0/framework.zip
unzip -o framework.zip
aptos genesis generate-genesis --assume-yes --local-repository-dir $HOME/.aptos --output-dir $HOME/.aptos
sleep 2
docker-compose down -v
sleep 2
docker compose up -d
imduchuyyy commented 2 years ago

Error when execute aptos genesis generate-genesis --assume-yes --local-repository-dir $HOME/.aptos --output-dir $HOME/.aptos

levicook commented 2 years ago

I ran into this earlier today; in my case the root cause was stale git tags.

This installed 0.1.2 instead of 0.2.0

cargo install --git https://github.com/aptos-labs/aptos-core.git aptos --tag aptos-cli-latest

To get 0.2.0 I had to run

cargo install --git https://github.com/aptos-labs/aptos-core.git aptos --tag aptos-cli-v0.2.0

After completing, the updated binary still reported 0.1.2, but was functionally 0.2.0 and was able to run this command successfully. Also note that the step before this needed to be re-run because there were some fields added and/or renamed in the yaml files it depends on.

magnum6actual commented 2 years ago

@gregnazario

imduchuyyy commented 2 years ago

I fix it by clean cache in my server, many thanks

I ran into this earlier today; in my case the root cause was stale git tags.

This installed 0.1.2 instead of 0.2.0

cargo install --git https://github.com/aptos-labs/aptos-core.git aptos --tag aptos-cli-latest

To get 0.2.0 I had to run

cargo install --git https://github.com/aptos-labs/aptos-core.git aptos --tag aptos-cli-v0.2.0

After completing, the updated binary still reported 0.1.2, but was functionally 0.2.0 and was able to run this command successfully. Also note that the step before this needed to be re-run because there were some fields added and/or renamed in the yaml files it depends on.

gregnazario commented 2 years ago

Sorry about that, I've been really busy working on other components, and forgot all about the tags!

There should now be up to date tags where: aptos-cli-latest = aptos-cli-0.2.0 = aptos-cli-v0.2.0 and all of them should say 0.2.0 in the binary.

imduchuyyy commented 2 years ago

Many thanks for support!!!