diff --git a/core/node/consensus/src/storage/connection.rs b/core/node/consensus/src/storage/connection.rs index ad27490bfa81..5d76934d7005 100644 --- a/core/node/consensus/src/storage/connection.rs +++ b/core/node/consensus/src/storage/connection.rs @@ -237,6 +237,7 @@ impl<'a> Connection<'a> { .start_transaction(ctx) .await .wrap("start_transaction()")?; + let old = txn.genesis(ctx).await.wrap("genesis()")?; if let Some(old) = &old { if &config::GenesisSpec::from_genesis(old) == spec { @@ -244,6 +245,7 @@ impl<'a> Connection<'a> { return Ok(()); } } + tracing::info!("Performing a hard fork of consensus."); let genesis = validator::GenesisRaw { chain_id: spec.chain_id, @@ -251,13 +253,13 @@ impl<'a> Connection<'a> { .as_ref() .map_or(validator::ForkNumber(0), |old| old.fork_number.next()), first_block: txn.next_block(ctx).await.context("next_block()")?, - protocol_version: spec.protocol_version, validators: spec.validators.clone(), - attesters: None, + attesters: spec.attesters.clone(), leader_selection: spec.leader_selection.clone(), } .with_hash(); + txn.try_update_genesis(ctx, &genesis) .await .wrap("try_update_genesis()")?; diff --git a/etc/env/consensus_config.yaml b/etc/env/consensus_config.yaml index 4a1f24c58e71..304ea31fac9c 100644 --- a/etc/env/consensus_config.yaml +++ b/etc/env/consensus_config.yaml @@ -1,5 +1,5 @@ -server_addr: '127.0.0.1:3054' -public_addr: '127.0.0.1:3054' +server_addr: "127.0.0.1:3054" +public_addr: "127.0.0.1:3054" max_payload_size: 2500000 gossip_dynamic_inbound_limit: 1 # LOCALHOST TEST CONFIGURATION ONLY, don't copy to other environments. @@ -7,6 +7,11 @@ genesis_spec: chain_id: 1337 protocol_version: 1 validators: - - key: 'validator:public:bls12_381:b14e3126668ae79e689a2d65c56522889a3812ef5433097c33bd7af601b073dcdddf46e188883aa381725c49e08f90c705df1f78bf918e1978912cebeadff0d0084b1a4fe2ddee243e826348045f528803207f5de303c6a95bc1a701a190dbcf' + - key: "validator:public:bls12_381:b14e3126668ae79e689a2d65c56522889a3812ef5433097c33bd7af601b073dcdddf46e188883aa381725c49e08f90c705df1f78bf918e1978912cebeadff0d0084b1a4fe2ddee243e826348045f528803207f5de303c6a95bc1a701a190dbcf" + weight: 1 + leader: "validator:public:bls12_381:b14e3126668ae79e689a2d65c56522889a3812ef5433097c33bd7af601b073dcdddf46e188883aa381725c49e08f90c705df1f78bf918e1978912cebeadff0d0084b1a4fe2ddee243e826348045f528803207f5de303c6a95bc1a701a190dbcf" + attesters: + - key: "attester:public:secp256k1:038b2762ad382b35090bb42992a3f6442d638425ea5528e800ffe5a9f7d4185589" + weight: 1 + - key: "attester:public:secp256k1:0330914e41b225fb6f8518d5278f0c014a9861018c8054f9bb425bb6538538f1c9" weight: 1 - leader: 'validator:public:bls12_381:b14e3126668ae79e689a2d65c56522889a3812ef5433097c33bd7af601b073dcdddf46e188883aa381725c49e08f90c705df1f78bf918e1978912cebeadff0d0084b1a4fe2ddee243e826348045f528803207f5de303c6a95bc1a701a190dbcf' diff --git a/etc/env/consensus_secrets.yaml b/etc/env/consensus_secrets.yaml index fdceef5e8e47..8235185d5fd2 100644 --- a/etc/env/consensus_secrets.yaml +++ b/etc/env/consensus_secrets.yaml @@ -1,4 +1,6 @@ # 'validator:public:bls12_381:b14e3126668ae79e689a2d65c56522889a3812ef5433097c33bd7af601b073dcdddf46e188883aa381725c49e08f90c705df1f78bf918e1978912cebeadff0d0084b1a4fe2ddee243e826348045f528803207f5de303c6a95bc1a701a190dbcf' -validator_key: 'validator:secret:bls12_381:3cf20d771450fcd0cbb3839b21cab41161af1554e35d8407a53b0a5d98ff04d4' +validator_key: "validator:secret:bls12_381:3cf20d771450fcd0cbb3839b21cab41161af1554e35d8407a53b0a5d98ff04d4" # 'node:public:ed25519:a9995979f228c91e4f387f7e141a9afe409196ee0c4fca0045c1c6b6e7892cb5' -node_key: 'node:secret:ed25519:9a40791b5a6b1627fc538b1ddecfa843bd7c4cd01fc0a4d0da186f9d3e740d7c' +node_key: "node:secret:ed25519:9a40791b5a6b1627fc538b1ddecfa843bd7c4cd01fc0a4d0da186f9d3e740d7c" +# 'attester:public:secp256k1:038b2762ad382b35090bb42992a3f6442d638425ea5528e800ffe5a9f7d4185589' +attester_key: "attester:secret:secp256k1:efc2431bd337d8ed1a16a21aa1f9916fade00cb9d1e849d493735df21e2d75ed" diff --git a/etc/env/en_consensus_secrets.yaml b/etc/env/en_consensus_secrets.yaml index 3f3407a7035b..00a433b07116 100644 --- a/etc/env/en_consensus_secrets.yaml +++ b/etc/env/en_consensus_secrets.yaml @@ -1,2 +1,4 @@ # 'node:public:ed25519:2621c2ae111901d4a9b46e96e64f71282b9209fc6b5e4df3d4208d3de28a482d' -node_key: 'node:secret:ed25519:19bc1ddd9fd2921d1b919e7dcfa465babdcf61a60a21e5df9b3f105bd9cfcb2c' +node_key: "node:secret:ed25519:19bc1ddd9fd2921d1b919e7dcfa465babdcf61a60a21e5df9b3f105bd9cfcb2c" +# 'attester:public:secp256k1:0330914e41b225fb6f8518d5278f0c014a9861018c8054f9bb425bb6538538f1c9' +attester_key: "attester:secret:secp256k1:899b0caa073f5db0a07e1fe953c94b05256f2c92fd03f0c33ef870622bc778ab"