witnet-rust icon indicating copy to clipboard operation
witnet-rust copied to clipboard

Use same storage with different consensus constants in mainnet

Open lrubiorod opened this issue 3 years ago • 3 comments

lrubiorod avatar Nov 05 '20 09:11 lrubiorod

This is one of the problems that are blocking #1583. The simplest solution would be to return an error if there is already a ChainState with different consensus constants.

tmpolaczyk avatar Nov 05 '20 13:11 tmpolaczyk

Now the node checks if there is more than one ChainState in the storage before starting, and it panics if there is more than one, or if the one in the storage has a different magic number than expected.

See here:

https://github.com/witnet/witnet-rust/blob/c36f3b11fa2e385f4f9bc6f6de672f23c5da9740/node/src/actors/chain_manager/actor.rs#L434

But it still doesn't allow to change the mainnet consensus constants, as that results in an error.

tmpolaczyk avatar Jan 31 '23 11:01 tmpolaczyk

That would certainly be a first step towards changing the magic numbers through a TAPI upgrade.

The other part would be to make TAPI select the magic number sent in protocol messages (change number only after activation), but keep accepting messages with the former number, so as to prevent all nodes dropping and icing peers at once.

aesedepece avatar Jan 31 '23 11:01 aesedepece