From 0f6863336dddfee2d3fe45d07eeb4f16c45ff10a Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 12 Jan 2024 10:50:50 +0100 Subject: [PATCH 01/38] upgraded sdk version to 0.11 --- CHANGELOG.md | 8 ++++++-- bootstraptool/pom.xml | 2 +- node/pom.xml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b546018..41a0e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # Changelog + +## 1.3.0 +* SDK dependency updated to version 0.11.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/dev/CHANGELOG.md)) + ## 1.2.0 -* SDK dependency updated to version 0.10.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/master/CHANGELOG.md)) +* SDK dependency updated to version 0.10.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.10.0/CHANGELOG.md)) * Fork configuration to enable new functionalities (ZenIP 42203/42206 support, ZenDao Multisig support) ## 1.1.0 -* SDK dependency updated to version 0.9.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/master/CHANGELOG.md)) +* SDK dependency updated to version 0.9.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.9.0/CHANGELOG.md)) * Fork configuration to enable Native<>Real smart contract interoperability * Added endpoints documentation diff --git a/bootstraptool/pom.xml b/bootstraptool/pom.xml index bf09493..0063906 100644 --- a/bootstraptool/pom.xml +++ b/bootstraptool/pom.xml @@ -16,7 +16,7 @@ io.horizen sidechains-sdk-account_sctools - 0.10.0 + 0.11.0-SNAPSHOT io.horizen diff --git a/node/pom.xml b/node/pom.xml index 5424836..17222f2 100644 --- a/node/pom.xml +++ b/node/pom.xml @@ -11,7 +11,7 @@ 11 3.8.1 3.1.1 - 0.10.0 + 0.11.0-SNAPSHOT From 345290b19f5f74c003019b72b5e9f0b81c7461c7 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 12 Jan 2024 10:53:26 +0100 Subject: [PATCH 02/38] bump version to 1.3.0 --- bootstraptool/pom.xml | 4 ++-- doc/index.md | 1 + doc/release/1.3.0.md | 7 +++++++ node/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 doc/release/1.3.0.md diff --git a/bootstraptool/pom.xml b/bootstraptool/pom.xml index 0063906..23c7f6c 100644 --- a/bootstraptool/pom.xml +++ b/bootstraptool/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen bootstraptool - 1.2.0 + 1.3.0-SNAPSHOT 2023 UTF-8 @@ -21,7 +21,7 @@ io.horizen eon - 1.2.0 + 1.3.0-SNAPSHOT compile diff --git a/doc/index.md b/doc/index.md index fc80b3e..ab2f41e 100644 --- a/doc/index.md +++ b/doc/index.md @@ -4,6 +4,7 @@ Find [here documentation](/doc/api/index.md) about how to interact with a runnin # EON Release Notes +## Version [1.3.0](/doc/release/1.3.0.md) ## Version [1.2.0](/doc/release/1.2.0.md) ## Version [1.1.0](/doc/release/1.1.0.md) ## Version [1.0.1](/doc/release/1.0.1.md) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md new file mode 100644 index 0000000..cc81c41 --- /dev/null +++ b/doc/release/1.3.0.md @@ -0,0 +1,7 @@ +# Release notes - version 1.3.0 +--- + +## Notes about new/updated Features + +--- +Full [Changelog](/CHANGELOG.md) available. \ No newline at end of file diff --git a/node/pom.xml b/node/pom.xml index 17222f2..c17191a 100644 --- a/node/pom.xml +++ b/node/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen eon - 1.2.0 + 1.3.0-SNAPSHOT 2023 UTF-8 diff --git a/pom.xml b/pom.xml index 7477070..2a4a748 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen eonproject - 1.2.0 + 1.3.0-SNAPSHOT pom 2023 From 4e66902dae714b073bc6e118297d4d0432dc7c5b Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 17 Jan 2024 09:56:11 +0100 Subject: [PATCH 03/38] little refactor of fork configurations --- .../io/horizen/eon/EonForkConfigurator.java | 181 +----------------- .../java/io/horizen/eon/forks/EONFork.java | 47 +++++ .../java/io/horizen/eon/forks/F1Fork.java | 62 ++++++ .../java/io/horizen/eon/forks/F2Fork.java | 68 +++++++ .../java/io/horizen/eon/forks/F3Fork.java | 57 ++++++ .../java/io/horizen/eon/forks/F4Fork.java | 53 +++++ .../java/io/horizen/eon/forks/F5Fork.java | 51 +++++ 7 files changed, 347 insertions(+), 172 deletions(-) create mode 100644 node/src/main/java/io/horizen/eon/forks/EONFork.java create mode 100644 node/src/main/java/io/horizen/eon/forks/F1Fork.java create mode 100644 node/src/main/java/io/horizen/eon/forks/F2Fork.java create mode 100644 node/src/main/java/io/horizen/eon/forks/F3Fork.java create mode 100644 node/src/main/java/io/horizen/eon/forks/F4Fork.java create mode 100644 node/src/main/java/io/horizen/eon/forks/F5Fork.java diff --git a/node/src/main/java/io/horizen/eon/EonForkConfigurator.java b/node/src/main/java/io/horizen/eon/EonForkConfigurator.java index 58fa01a..4e6fb27 100644 --- a/node/src/main/java/io/horizen/eon/EonForkConfigurator.java +++ b/node/src/main/java/io/horizen/eon/EonForkConfigurator.java @@ -1,190 +1,27 @@ package io.horizen.eon; -import io.horizen.account.fork.ContractInteroperabilityFork; -import io.horizen.account.fork.GasFeeFork; -import io.horizen.account.fork.ZenDAOFork; +import io.horizen.eon.forks.*; import io.horizen.fork.*; import io.horizen.utils.Pair; - -import java.math.BigInteger; +import java.util.ArrayList; import java.util.List; import java.util.Optional; -import io.horizen.account.fork.Version1_2_0Fork; public class EonForkConfigurator extends ForkConfigurator { - //EON fork 1: change of fee params - static final int F1_REGTEST_FORKPOINT = 7; - static final int F1_PREGOBI_TESTNET_FORKPOINT = 718; - static final int F1_GOBI_TESTNET_FORKPOINT = 624; - static final int F1_TESTNET_FORKPOINT = 0; - static final int F1_MAINNET_FORKPOINT = 0; - - //EON fork 2: ZenDAO + Change of consensus params + change of active slot coefficient - static final int F2_REGTEST_FORKPOINT = 7; - static final int F2_PREGOBI_TESTNET_FORKPOINT = 1698; //estimated start: Wed 13 Sept 2023 15:31 Milano time - static final int F2_GOBI_TESTNET_FORKPOINT = 1804; ///estimated start: Mon 09 Oct 2023 16:21 Milano time - static final int F2_TESTNET_FORKPOINT = 800; - static final int F2_MAINNET_FORKPOINT = 1109; ///estimated start: Thu 19 Oct 2023 15:55 Milano time - - //EON fork 3: Native <> Real smart contract interoperability - static final int F3_REGTEST_FORKPOINT = 7; - static final int F3_PREGOBI_TESTNET_FORKPOINT = 1815; //estimated start: Mon 13 Nov 2023 13:01 Milano time - static final int F3_GOBI_TESTNET_FORKPOINT = 1900; //estimated start; Tue 28 Nov 11 2023 15:21 Milano time - static final int F3_TESTNET_FORKPOINT = 1900; //not used - static final int F3_MAINNET_FORKPOINT = 1213; //estimated start; Tue 12 Dec 2023 18:55 Milano time - - //EON fork 4: ZenIP 42203/42206, ZenDao Multisig - static final int F4_REGTEST_FORKPOINT = 7; - static final int F4_PREGOBI_TESTNET_FORKPOINT = 1875; //estimated start: Thu 14 Dec 2023 19:01 Milano time - static final int F4_GOBI_TESTNET_FORKPOINT = 1982; //estimated start: Wed 10 Jan 2024 08:21 Milano time - static final int F4_TESTNET_FORKPOINT = 1982; //not used - static final int F4_MAINNET_FORKPOINT = 1297; //estimated start: Thu 25 Jan 2024 12:55 Milano Time - - - - - private final SidechainForkConsensusEpoch mandatorySidechainFork1; private final List> optionalSidechainForks; public EonForkConfigurator(Optional sidechainId) { - // block gas limit: 10 million - // minimum base fee: 20 Gwei (20*10^9) - GasFeeFork feeFork1Params = new GasFeeFork( - // block gas limit: 10 million - BigInteger.valueOf(10000000), - BigInteger.valueOf(2), - BigInteger.valueOf(8), - // minimum base fee: 20 Gwei (20*10^9) - BigInteger.valueOf(20000000000L) - ); - - ZenDAOFork zenDAOFork = new ZenDAOFork(true); - - ConsensusParamsFork consensusParamsFork = new ConsensusParamsFork(15000, 3); - - ActiveSlotCoefficientFork activeSlotCoefficientFork = new ActiveSlotCoefficientFork(0.167); - - - optionalSidechainForks = List.of( - new Pair<>(new SidechainForkConsensusEpoch( - F1_REGTEST_FORKPOINT, - getFeeForkTestnetActivation(sidechainId), - F1_MAINNET_FORKPOINT), - feeFork1Params), - - new Pair<>(new SidechainForkConsensusEpoch( - F2_REGTEST_FORKPOINT, - getFork2TestnetActivation(sidechainId), - F2_MAINNET_FORKPOINT), - zenDAOFork), - - new Pair<>(new SidechainForkConsensusEpoch( - F2_REGTEST_FORKPOINT, - getFork2TestnetActivation(sidechainId), - F2_MAINNET_FORKPOINT), - consensusParamsFork), - - new Pair<>(new SidechainForkConsensusEpoch( - F2_REGTEST_FORKPOINT, - getFork2TestnetActivation(sidechainId), - F2_MAINNET_FORKPOINT), - activeSlotCoefficientFork), - - new Pair<>( - new SidechainForkConsensusEpoch( - F3_REGTEST_FORKPOINT, - getFork3TestnetActivation(sidechainId), - F3_MAINNET_FORKPOINT), - new ContractInteroperabilityFork(true) - ), - - new Pair<>( - new SidechainForkConsensusEpoch( - F4_REGTEST_FORKPOINT, - getFork4TestnetActivation(sidechainId), - F4_MAINNET_FORKPOINT), - new Version1_2_0Fork(true) - ) - - ); + optionalSidechainForks = new ArrayList<>(); + optionalSidechainForks.addAll(new F1Fork(sidechainId).getPairs()); + optionalSidechainForks.addAll(new F2Fork(sidechainId).getPairs()); + optionalSidechainForks.addAll(new F3Fork(sidechainId).getPairs()); + optionalSidechainForks.addAll(new F4Fork(sidechainId).getPairs()); + optionalSidechainForks.addAll(new F5Fork(sidechainId).getPairs()); mandatorySidechainFork1 = new SidechainForkConsensusEpoch(0, 0, 0); } - private int getFeeForkTestnetActivation(Optional sidechainId){ - if (sidechainId.isPresent()){ - switch (sidechainId.get()){ - case ApplicationConstants.PREGOBI_SIDECHAINID: - //Pre-Gobi (parallel testnet) fork configuration - return F1_PREGOBI_TESTNET_FORKPOINT; - case ApplicationConstants.GOBI_SIDECHAINID: - //Gobi (official testnet) fork configuration - return F1_GOBI_TESTNET_FORKPOINT; - default: - //any other testnet - return F1_TESTNET_FORKPOINT; - } - }else{ - return F1_TESTNET_FORKPOINT; - } - } - - private int getFork2TestnetActivation(Optional sidechainId){ - if (sidechainId.isPresent()){ - switch (sidechainId.get()){ - case ApplicationConstants.PREGOBI_SIDECHAINID: - //Pre-Gobi (parallel testnet) fork configuration - return F2_PREGOBI_TESTNET_FORKPOINT; - case ApplicationConstants.GOBI_SIDECHAINID: - //Gobi (official testnet) fork configuration - return F2_GOBI_TESTNET_FORKPOINT; - default: - //any other testnet - return F2_TESTNET_FORKPOINT; - } - } else { - return F2_TESTNET_FORKPOINT; - } - } - - private int getFork3TestnetActivation(Optional sidechainId){ - if (sidechainId.isPresent()){ - switch (sidechainId.get()){ - case ApplicationConstants.PREGOBI_SIDECHAINID: - //Pre-Gobi (parallel testnet) fork configuration - return F3_PREGOBI_TESTNET_FORKPOINT; - case ApplicationConstants.GOBI_SIDECHAINID: - //Gobi (official testnet) fork configuration - return F3_GOBI_TESTNET_FORKPOINT; - default: - //any other testnet - return F3_TESTNET_FORKPOINT; - } - } else { - return F3_TESTNET_FORKPOINT; - } - } - - private int getFork4TestnetActivation(Optional sidechainId){ - if (sidechainId.isPresent()){ - switch (sidechainId.get()){ - case ApplicationConstants.PREGOBI_SIDECHAINID: - //Pre-Gobi (parallel testnet) fork configuration - return F4_PREGOBI_TESTNET_FORKPOINT; - case ApplicationConstants.GOBI_SIDECHAINID: - //Gobi (official testnet) fork configuration - return F4_GOBI_TESTNET_FORKPOINT; - default: - //any other testnet - return F4_TESTNET_FORKPOINT; - } - } else { - return F4_TESTNET_FORKPOINT; - } - } - - @Override public SidechainForkConsensusEpoch fork1activation() { return mandatorySidechainFork1; @@ -194,4 +31,4 @@ public SidechainForkConsensusEpoch fork1activation() { public List> getOptionalSidechainForks() { return optionalSidechainForks; } -} +} \ No newline at end of file diff --git a/node/src/main/java/io/horizen/eon/forks/EONFork.java b/node/src/main/java/io/horizen/eon/forks/EONFork.java new file mode 100644 index 0000000..4ae6725 --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/EONFork.java @@ -0,0 +1,47 @@ +package io.horizen.eon.forks; + +import io.horizen.eon.ApplicationConstants; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; + +import java.util.List; +import java.util.Optional; + +public abstract class EONFork { + + protected Optional sidechainId; + + protected abstract int getActivationRegtest(); + protected abstract int getActivationTestnetPregobi(); + protected abstract int getActivationTestnetGobi(); + protected abstract int getActivationTestnet(); + protected abstract int getActivationMainnet(); + + public EONFork(Optional sidechainId){ + this.sidechainId = sidechainId; + } + + public abstract List> getPairs(); + + protected int getActivationTestnet(Optional sidechainId){ + if (sidechainId.isPresent()){ + switch (sidechainId.get()){ + case ApplicationConstants.PREGOBI_SIDECHAINID: + //Pre-Gobi (parallel testnet) fork configuration + return getActivationTestnetPregobi(); + case ApplicationConstants.GOBI_SIDECHAINID: + //Gobi (official testnet) fork configuration + return getActivationTestnetGobi(); + default: + //any other testnet + return getActivationTestnet(); + } + } else { + return getActivationTestnet(); + } + } + + + +} diff --git a/node/src/main/java/io/horizen/eon/forks/F1Fork.java b/node/src/main/java/io/horizen/eon/forks/F1Fork.java new file mode 100644 index 0000000..0a0633c --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/F1Fork.java @@ -0,0 +1,62 @@ +package io.horizen.eon.forks; + +import io.horizen.account.fork.GasFeeFork; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; +import java.math.BigInteger; +import java.util.List; +import java.util.Optional; + +/** +EON fork 1: change of fee params + */ +public class F1Fork extends EONFork { + + // block gas limit: 10 million + // minimum base fee: 20 Gwei (20*10^9) + private GasFeeFork feeFork1Params = new GasFeeFork( + // block gas limit: 10 million + BigInteger.valueOf(10000000), + BigInteger.valueOf(2), + BigInteger.valueOf(8), + // minimum base fee: 20 Gwei (20*10^9) + BigInteger.valueOf(20000000000L) + ); + + @Override + protected int getActivationRegtest() { + return 7; + } + @Override + protected int getActivationTestnetPregobi() { + return 718; + } + @Override + protected int getActivationTestnetGobi() { + return 624; + } + @Override + protected int getActivationTestnet() { + return 0; + } + @Override + protected int getActivationMainnet() { + return 0; + } + + public F1Fork(Optional sidechainId) { + super(sidechainId); + } + + @Override + public List> getPairs() { + return List.of( + new Pair<>(new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + feeFork1Params) + ); + } +} diff --git a/node/src/main/java/io/horizen/eon/forks/F2Fork.java b/node/src/main/java/io/horizen/eon/forks/F2Fork.java new file mode 100644 index 0000000..d952fd0 --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/F2Fork.java @@ -0,0 +1,68 @@ +package io.horizen.eon.forks; + +import io.horizen.account.fork.ZenDAOFork; +import io.horizen.fork.ActiveSlotCoefficientFork; +import io.horizen.fork.ConsensusParamsFork; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; +import java.util.List; +import java.util.Optional; + +/** + * EON fork 2: ZenDAO + Change of consensus params + change of active slot coefficient + */ +public class F2Fork extends EONFork { + + private ZenDAOFork zenDAOFork = new ZenDAOFork(true); + private ConsensusParamsFork consensusParamsFork = new ConsensusParamsFork(15000, 3); + private ActiveSlotCoefficientFork activeSlotCoefficientFork = new ActiveSlotCoefficientFork(0.167); + + public F2Fork(Optional sidechainId) { + super(sidechainId); + } + + @Override + protected int getActivationRegtest() { + return 7; + } + @Override + protected int getActivationTestnetPregobi() { + return 1698; //estimated start: Wed 13 Sept 2023 15:31 Milano time + } + @Override + protected int getActivationTestnetGobi() { + return 1804; ///estimated start: Mon 09 Oct 2023 16:21 Milano time + } + @Override + protected int getActivationTestnet() { + return 800; + } + @Override + protected int getActivationMainnet() { + return 1109; ///estimated start: Thu 19 Oct 2023 15:55 Milano time + } + + @Override + public List> getPairs() { + return List.of( + new Pair<>(new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + zenDAOFork), + + new Pair<>(new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + consensusParamsFork), + + new Pair<>(new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + activeSlotCoefficientFork) + ); + } +} \ No newline at end of file diff --git a/node/src/main/java/io/horizen/eon/forks/F3Fork.java b/node/src/main/java/io/horizen/eon/forks/F3Fork.java new file mode 100644 index 0000000..5a93699 --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/F3Fork.java @@ -0,0 +1,57 @@ +package io.horizen.eon.forks; + +import io.horizen.account.fork.ContractInteroperabilityFork; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; + +import java.util.List; +import java.util.Optional; + +/** + * EON fork 3: Native <> Real smart contract interoperability + */ +public class F3Fork extends EONFork { + + + public F3Fork(Optional sidechainId) { + super(sidechainId); + } + static final int F3_REGTEST_FORKPOINT = 7; + static final int F3_PREGOBI_TESTNET_FORKPOINT = 1815; //estimated start: Mon 13 Nov 2023 13:01 Milano time + static final int F3_GOBI_TESTNET_FORKPOINT = 1900; //estimated start; Tue 28 Nov 11 2023 15:21 Milano time + static final int F3_TESTNET_FORKPOINT = 1900; //not used + static final int F3_MAINNET_FORKPOINT = 1213; //estimated start; Tue 12 Dec 2023 18:55 Milano time + @Override + protected int getActivationRegtest() { + return 7; + } + @Override + protected int getActivationTestnetPregobi() { + return 1815; //estimated start: Mon 13 Nov 2023 13:01 Milano time + } + @Override + protected int getActivationTestnetGobi() { + return 1900; //estimated start; Tue 28 Nov 11 2023 15:21 Milano time + } + @Override + protected int getActivationTestnet() { return 1900; //not used + } + @Override + protected int getActivationMainnet() { + return 1213; //estimated start; Tue 12 Dec 2023 18:55 Milano time + } + + @Override + public List> getPairs() { + return List.of( + new Pair<>( + new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + new ContractInteroperabilityFork(true) + ) + ); + } +} \ No newline at end of file diff --git a/node/src/main/java/io/horizen/eon/forks/F4Fork.java b/node/src/main/java/io/horizen/eon/forks/F4Fork.java new file mode 100644 index 0000000..e87c5b2 --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/F4Fork.java @@ -0,0 +1,53 @@ +package io.horizen.eon.forks; + +import io.horizen.account.fork.ContractInteroperabilityFork; +import io.horizen.account.fork.Version1_2_0Fork; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; + +import java.util.List; +import java.util.Optional; + +/** + * EON fork 4 (introduced in Version 1.2.0) + * ZenIP 42203/42206, ZenDao Multisig + */ +public class F4Fork extends EONFork { + public F4Fork(Optional sidechainId) { + super(sidechainId); + } + + @Override + protected int getActivationRegtest() { + return 7; + } + @Override + protected int getActivationTestnetPregobi() { + return 1875; //estimated start: Thu 14 Dec 2023 19:01 Milano time + } + @Override + protected int getActivationTestnetGobi() { + return 1982; //estimated start: Wed 10 Jan 2024 08:21 Milano time + } + @Override + protected int getActivationTestnet() { return 1982; //not used + } + @Override + protected int getActivationMainnet() { + return 1297; //estimated start: Thu 25 Jan 2024 12:55 Milano Time + } + + @Override + public List> getPairs() { + return List.of( + new Pair<>( + new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + new Version1_2_0Fork(true) + ) + ); + } +} \ No newline at end of file diff --git a/node/src/main/java/io/horizen/eon/forks/F5Fork.java b/node/src/main/java/io/horizen/eon/forks/F5Fork.java new file mode 100644 index 0000000..2d29a8f --- /dev/null +++ b/node/src/main/java/io/horizen/eon/forks/F5Fork.java @@ -0,0 +1,51 @@ +package io.horizen.eon.forks; + +import io.horizen.account.fork.Version1_3_0Fork; +import io.horizen.fork.OptionalSidechainFork; +import io.horizen.fork.SidechainForkConsensusEpoch; +import io.horizen.utils.Pair; +import java.util.List; +import java.util.Optional; + +/** + * EON fork 5 (introduced in Version 1.3.0) + * EVM update to Shanghai, Updates to native stake smart contract + */ +public class F5Fork extends EONFork { + public F5Fork(Optional sidechainId) { + super(sidechainId); + } + + @Override + protected int getActivationRegtest() { + return 7; + } + @Override + protected int getActivationTestnetPregobi() { + return 1000000; //TODO + } + @Override + protected int getActivationTestnetGobi() { + return 1000000; //TODO + } + @Override + protected int getActivationTestnet() { return 1000000; //TODO + } + @Override + protected int getActivationMainnet() { + return 1000000; ///TODO + } + + @Override + public List> getPairs() { + return List.of( + new Pair<>( + new SidechainForkConsensusEpoch( + getActivationRegtest(), + getActivationTestnet(sidechainId), + getActivationMainnet()), + new Version1_3_0Fork(true) + ) + ); + } +} \ No newline at end of file From 757dc0c2e70bc19522e197d8ae1c18cca9fb017c Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 17 Jan 2024 09:56:29 +0100 Subject: [PATCH 04/38] refactor of fork config --- node/src/main/java/io/horizen/eon/forks/F4Fork.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/node/src/main/java/io/horizen/eon/forks/F4Fork.java b/node/src/main/java/io/horizen/eon/forks/F4Fork.java index e87c5b2..1b555ea 100644 --- a/node/src/main/java/io/horizen/eon/forks/F4Fork.java +++ b/node/src/main/java/io/horizen/eon/forks/F4Fork.java @@ -1,11 +1,9 @@ package io.horizen.eon.forks; -import io.horizen.account.fork.ContractInteroperabilityFork; import io.horizen.account.fork.Version1_2_0Fork; import io.horizen.fork.OptionalSidechainFork; import io.horizen.fork.SidechainForkConsensusEpoch; import io.horizen.utils.Pair; - import java.util.List; import java.util.Optional; From 7632065d5023080be8c10417203a9de73212f179 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 19 Jan 2024 09:59:07 +0100 Subject: [PATCH 05/38] removed unused constants --- node/src/main/java/io/horizen/eon/forks/F3Fork.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/node/src/main/java/io/horizen/eon/forks/F3Fork.java b/node/src/main/java/io/horizen/eon/forks/F3Fork.java index 5a93699..5f22cd7 100644 --- a/node/src/main/java/io/horizen/eon/forks/F3Fork.java +++ b/node/src/main/java/io/horizen/eon/forks/F3Fork.java @@ -17,11 +17,7 @@ public class F3Fork extends EONFork { public F3Fork(Optional sidechainId) { super(sidechainId); } - static final int F3_REGTEST_FORKPOINT = 7; - static final int F3_PREGOBI_TESTNET_FORKPOINT = 1815; //estimated start: Mon 13 Nov 2023 13:01 Milano time - static final int F3_GOBI_TESTNET_FORKPOINT = 1900; //estimated start; Tue 28 Nov 11 2023 15:21 Milano time - static final int F3_TESTNET_FORKPOINT = 1900; //not used - static final int F3_MAINNET_FORKPOINT = 1213; //estimated start; Tue 12 Dec 2023 18:55 Milano time + @Override protected int getActivationRegtest() { return 7; From d46c998f2cff71f74854323cb459bdd0e936ac25 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 19 Jan 2024 10:04:52 +0100 Subject: [PATCH 06/38] fixed documentation on createPrivateKeyXXXX --- doc/api/wallet/createPrivateKey25519.md | 17 ++++++++++------- doc/api/wallet/createPrivateKeySecp256k1.md | 14 ++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/doc/api/wallet/createPrivateKey25519.md b/doc/api/wallet/createPrivateKey25519.md index ab7638d..15f89d4 100644 --- a/doc/api/wallet/createPrivateKey25519.md +++ b/doc/api/wallet/createPrivateKey25519.md @@ -1,9 +1,9 @@ [< EON API Documentation](/doc/api/index.md) -### wallet/createPrivateKeySecp256k1 +### wallet/createPrivateKey25519 -Create a private key in the Secp256k1 format.\ -Secp256k1 keys are the standard used in Ethereum EVMs and also by EON.\ -Returns the correspondent public address. +Create a private key in the 25519 format. +25519 keys are used in EON for designating forgers. +Returns the correspondent public key. **Parameters** @@ -11,12 +11,15 @@ No parameters **Example request** - curl -sX POST 'http://127.0.0.1:9085/wallet/createPrivateKeySecp256k1' -H 'Content-Type: application/json' -H 'accept: application/json' + curl -sX POST 'http://127.0.0.1:9085/wallet/createPrivateKey25519' -H 'Content-Type: application/json' -H 'accept: application/json' **Example response** { "result" : { - "address" : "00c8f107a09cd4f463afc2f1e6e5bf6022ad4600" + "proposition" : { + "publicKey" : "4b50edf43fddcf29afceacfcc9c5c16edb16de6550b9172c7190bfe9fdad0f45" + } } - } \ No newline at end of file + } + diff --git a/doc/api/wallet/createPrivateKeySecp256k1.md b/doc/api/wallet/createPrivateKeySecp256k1.md index 0e6904e..ab7638d 100644 --- a/doc/api/wallet/createPrivateKeySecp256k1.md +++ b/doc/api/wallet/createPrivateKeySecp256k1.md @@ -1,9 +1,9 @@ [< EON API Documentation](/doc/api/index.md) -### wallet/createPrivateKey25519 +### wallet/createPrivateKeySecp256k1 -Create a private key in the 25519 format. -25519 keys are used in EON for designating forgers. -Returns the correspondent public key. +Create a private key in the Secp256k1 format.\ +Secp256k1 keys are the standard used in Ethereum EVMs and also by EON.\ +Returns the correspondent public address. **Parameters** @@ -11,14 +11,12 @@ No parameters **Example request** - curl -sX POST 'http://127.0.0.1:9085/wallet/createPrivateKey25519' -H 'Content-Type: application/json' -H 'accept: application/json' + curl -sX POST 'http://127.0.0.1:9085/wallet/createPrivateKeySecp256k1' -H 'Content-Type: application/json' -H 'accept: application/json' **Example response** { "result" : { - "proposition" : { - "publicKey" : "4b50edf43fddcf29afceacfcc9c5c16edb16de6550b9172c7190bfe9fdad0f45" - } + "address" : "00c8f107a09cd4f463afc2f1e6e5bf6022ad4600" } } \ No newline at end of file From 683ec1c8fc1937f4752e5c6ae6ca3547554c8a40 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 23 Jan 2024 16:25:17 +0100 Subject: [PATCH 07/38] support and instructions for customized log file --- doc/howto/customlog.md | 31 +++++++++++++++++++++++++++++++ doc/index.md | 4 ++++ dockerfiles/evmapp/entrypoint.sh | 14 +++++++++++++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 doc/howto/customlog.md diff --git a/doc/howto/customlog.md b/doc/howto/customlog.md new file mode 100644 index 0000000..389b7bb --- /dev/null +++ b/doc/howto/customlog.md @@ -0,0 +1,31 @@ +[< EON Documentation index](/doc/index.md) +# EON logging configuration + +## Simple logging customization + +Edit the following variables in the node configuration file to customize path and level of logging: + +- **sparkz.logDir** + + Path of the logging directory + +- **sparkz.logInfo.logFileName** + + Name of the log file + +- **sparkz.logInfo.logFileLevel** and **sparkz.logInfo.logConsoleLevel** + + Level of logging used for file and console appenders. + Can be one of the following: off, fatal, error, warn, info, debug, trace, all + + +## Advanced logging customization + +For advanced customization you can setup EON to use a totally custom log4j file instead of the default one: + +- if you are running the java process directly, add the following property to the startup command: +-Dlog4j.configurationFile= + +- if you are running via Docker, configure an environment variable **SCNODE_LOG4J_CUSTOM_CONFIG** with the path to the log4j file and be sure to have the file present inside the container. + +Start from [this base template](https://github.com/HorizenOfficial/Sidechains-SDK/blob/master/sdk/src/main/resources/log4j2.xml) to create your cunfiguration file. \ No newline at end of file diff --git a/doc/index.md b/doc/index.md index ab2f41e..8f87ed9 100644 --- a/doc/index.md +++ b/doc/index.md @@ -2,6 +2,10 @@ Find [here documentation](/doc/api/index.md) about how to interact with a running EON node. +# HowTOs and tutorials + +- [EON logging configuration](/doc/howto/customlog.md) + # EON Release Notes ## Version [1.3.0](/doc/release/1.3.0.md) diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index 03f4e13..cd5a7c1 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -58,6 +58,18 @@ if [ -z "${SCNODE_NET_DECLAREDADDRESS}" ]; then fi export SCNODE_NET_DECLAREDADDRESS +#Custom log4j file (optional) +LOG4J_CUSTOM_CONFIG="" +if [ -n "${SCNODE_LOG4J_CUSTOM_CONFIG:-}" ]; then + echo "qui" + if ! [ -f "${SCNODE_LOG4J_CUSTOM_CONFIG}" ]; then + echo "Error: Custom log4j file not found in path ${SCNODE_LOG4J_CUSTOM_CONFIG} - check env property SCNODE_LOG4J_CUSTOM_CONFIG and if using docker compose be sure to map the file in the volumes properties" + sleep 5 + exit 1 + fi + LOG4J_CUSTOM_CONFIG="-Dlog4j.configurationFile=${SCNODE_LOG4J_CUSTOM_CONFIG}" +fi + to_check=( "SCNODE_CERT_SIGNERS_MAXPKS" "SCNODE_CERT_SIGNERS_PUBKEYS" @@ -324,7 +336,7 @@ path_to_jemalloc="$(ldconfig -p | grep "$(arch)" | grep 'libjemalloc\.so\.2$' | export LD_PRELOAD="${path_to_jemalloc}:${LD_PRELOAD}" if [ "${1}" = "/usr/bin/true" ]; then - set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' "$SC_MAIN_CLASS" "$SC_CONF_PATH" + set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' ${LOG4J_CUSTOM_CONFIG} "$SC_MAIN_CLASS" "$SC_CONF_PATH" fi echo "Username: ${USERNAME}, UID: ${CURRENT_UID}, GID: ${CURRENT_GID}" From b036e8af2406f906f344a536b24ddd85e7a9c0d1 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 23 Jan 2024 16:29:28 +0100 Subject: [PATCH 08/38] fixed instructions --- doc/howto/customlog.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/howto/customlog.md b/doc/howto/customlog.md index 389b7bb..cf6f76f 100644 --- a/doc/howto/customlog.md +++ b/doc/howto/customlog.md @@ -24,8 +24,9 @@ Edit the following variables in the node configuration file to customize path an For advanced customization you can setup EON to use a totally custom log4j file instead of the default one: - if you are running the java process directly, add the following property to the startup command: --Dlog4j.configurationFile= -- if you are running via Docker, configure an environment variable **SCNODE_LOG4J_CUSTOM_CONFIG** with the path to the log4j file and be sure to have the file present inside the container. + -Dlog4j.configurationFile=filePath + +- if you are running via Docker, configure an environment variable **SCNODE_LOG4J_CUSTOM_CONFIG** with the path to the log4j file, and be sure to have the file present inside the container. Start from [this base template](https://github.com/HorizenOfficial/Sidechains-SDK/blob/master/sdk/src/main/resources/log4j2.xml) to create your cunfiguration file. \ No newline at end of file From 5a4670225d0fe9f26d61901bc281422344589706 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 23 Jan 2024 16:31:58 +0100 Subject: [PATCH 09/38] fixed typo --- dockerfiles/evmapp/entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index cd5a7c1..f95a205 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -61,9 +61,8 @@ export SCNODE_NET_DECLAREDADDRESS #Custom log4j file (optional) LOG4J_CUSTOM_CONFIG="" if [ -n "${SCNODE_LOG4J_CUSTOM_CONFIG:-}" ]; then - echo "qui" if ! [ -f "${SCNODE_LOG4J_CUSTOM_CONFIG}" ]; then - echo "Error: Custom log4j file not found in path ${SCNODE_LOG4J_CUSTOM_CONFIG} - check env property SCNODE_LOG4J_CUSTOM_CONFIG and if using docker compose be sure to map the file in the volumes properties" + echo "Error: Custom log4j file not found in path ${SCNODE_LOG4J_CUSTOM_CONFIG} - check env property SCNODE_LOG4J_CUSTOM_CONFIG and be sure to have the file in the container" sleep 5 exit 1 fi From 60bab7905f1716e6be4233b711eace6e01f7f1ee Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 24 Jan 2024 14:34:32 +0100 Subject: [PATCH 10/38] review changes --- doc/howto/customlog.md | 8 +++++--- dockerfiles/evmapp/entrypoint.sh | 17 ++++++++++------- dockerfiles/evmapp/sc_settings.conf.tmpl | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/howto/customlog.md b/doc/howto/customlog.md index cf6f76f..f812961 100644 --- a/doc/howto/customlog.md +++ b/doc/howto/customlog.md @@ -11,12 +11,14 @@ Edit the following variables in the node configuration file to customize path an - **sparkz.logInfo.logFileName** - Name of the log file + Name of the log file. + If you are running via Docker, you can also change it by setting the environment variable: **SCNODE_LOG_FILE_NAME** - **sparkz.logInfo.logFileLevel** and **sparkz.logInfo.logConsoleLevel** - Level of logging used for file and console appenders. - Can be one of the following: off, fatal, error, warn, info, debug, trace, all + Level of logging used for file and console appenders. + Can be one of the following: off, fatal, error, warn, info, debug, trace, all + If you are running via Docker, you can also change them by setting the environment variables: **SCNODE_LOG_FILE_LEVEL** and **SCNODE_LOG_CONSOLE_LEVEL** ## Advanced logging customization diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index f95a205..ccb5222 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -14,7 +14,7 @@ MAX_OUTGOING_CONNECTIONS="" WS_ADDRESS="" ONLY_CONNECT_TO_KNOWN_PEERS="" FORGER_MAXCONNECTIONS="" - +LOG4J_CUSTOM_CONFIG="" SCNODE_REMOTE_KEY_MANAGER_ENABLED="${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-false}" export SCNODE_REMOTE_KEY_MANAGER_ENABLED @@ -59,10 +59,9 @@ fi export SCNODE_NET_DECLAREDADDRESS #Custom log4j file (optional) -LOG4J_CUSTOM_CONFIG="" if [ -n "${SCNODE_LOG4J_CUSTOM_CONFIG:-}" ]; then if ! [ -f "${SCNODE_LOG4J_CUSTOM_CONFIG}" ]; then - echo "Error: Custom log4j file not found in path ${SCNODE_LOG4J_CUSTOM_CONFIG} - check env property SCNODE_LOG4J_CUSTOM_CONFIG and be sure to have the file in the container" + echo "Error: Custom log4j file was not found under the provided path = ${SCNODE_LOG4J_CUSTOM_CONFIG}. Please check the value of the environment variable 'SCNODE_LOG4J_CUSTOM_CONFIG' and make sure your custom log4j file is correctly mapped to the container." sleep 5 exit 1 fi @@ -200,7 +199,7 @@ if [ -n "${SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS:-}" ]; then fi export ONLY_CONNECT_TO_KNOWN_PEERS -# Flexibility for log levels +# Flexibility for log levels and log file name if [ -z "${SCNODE_LOG_FILE_LEVEL:-}" ]; then SCNODE_LOG_FILE_LEVEL='info' fi @@ -208,7 +207,11 @@ fi if [ -z "${SCNODE_LOG_CONSOLE_LEVEL:-}" ]; then SCNODE_LOG_CONSOLE_LEVEL='info' fi -export SCNODE_LOG_FILE_LEVEL SCNODE_LOG_CONSOLE_LEVEL + +if [ -z "${SCNODE_LOG_FILE_NAME:-}" ]; then + SCNODE_LOG_FILE_NAME='debug.log' +fi +export SCNODE_LOG_FILE_LEVEL SCNODE_LOG_CONSOLE_LEVEL SCNODE_LOG_FILE_NAME # set REST API password hash if [ -n "${SCNODE_REST_PASSWORD:-}" ]; then @@ -320,7 +323,7 @@ SUBST='$SCNODE_CERT_MASTERS_PUBKEYS:$SCNODE_CERT_SIGNERS_MAXPKS:$SCNODE_CERT_SIG '$SCNODE_GENESIS_WITHDRAWALEPOCHLENGTH:$SCNODE_GENESIS_COMMTREEHASH:$SCNODE_GENESIS_ISNONCEASING:$SCNODE_ALLOWED_FORGERS:$SCNODE_FORGER_ENABLED:$SCNODE_FORGER_RESTRICT:'\ '$SCNODE_NET_DECLAREDADDRESS:$SCNODE_NET_KNOWNPEERS:$SCNODE_NET_MAGICBYTES:$SCNODE_NET_NODENAME:$SCNODE_NET_P2P_PORT:$SCNODE_NET_API_LIMITER_ENABLED:$SCNODE_NET_SLOW_MODE:$SCNODE_NET_REBROADCAST_TXS:$SCNODE_NET_HANDLING_TXS:'\ '$SCNODE_WALLET_GENESIS_SECRETS:$SCNODE_WALLET_MAXTX_FEE:$SCNODE_WALLET_SEED:$WS_ADDRESS:$MAX_INCOMING_CONNECTIONS:$MAX_OUTGOING_CONNECTIONS:$SCNODE_WS_SERVER_PORT:'\ -'$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:$REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:$REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:'\ +'$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:$SCNODE_LOG_FILE_NAME:$REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:$REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:'\ '$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT:$ONLY_CONNECT_TO_KNOWN_PEERS:$FORGER_MAXCONNECTIONS'\ export SUBST @@ -335,7 +338,7 @@ path_to_jemalloc="$(ldconfig -p | grep "$(arch)" | grep 'libjemalloc\.so\.2$' | export LD_PRELOAD="${path_to_jemalloc}:${LD_PRELOAD}" if [ "${1}" = "/usr/bin/true" ]; then - set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' ${LOG4J_CUSTOM_CONFIG} "$SC_MAIN_CLASS" "$SC_CONF_PATH" + set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' "${LOG4J_CUSTOM_CONFIG}" "$SC_MAIN_CLASS" "$SC_CONF_PATH" fi echo "Username: ${USERNAME}, UID: ${CURRENT_UID}, GID: ${CURRENT_GID}" diff --git a/dockerfiles/evmapp/sc_settings.conf.tmpl b/dockerfiles/evmapp/sc_settings.conf.tmpl index f70a3e2..adb6ce5 100644 --- a/dockerfiles/evmapp/sc_settings.conf.tmpl +++ b/dockerfiles/evmapp/sc_settings.conf.tmpl @@ -3,7 +3,7 @@ sparkz { logDir = /sidechain/logs logInfo { - logFileName = "debug.log" + logFileName = "$SCNODE_LOG_FILE_NAME" # levels: off, fatal, error, warn, info, debug, trace, all logFileLevel = "$SCNODE_LOG_FILE_LEVEL" logConsoleLevel = "$SCNODE_LOG_CONSOLE_LEVEL" From 44f0e38f39f1046c5279e8a9138c6f50c3eb5bba Mon Sep 17 00:00:00 2001 From: Yuri Sibirski <31861444+ysibirski@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:05:49 -0500 Subject: [PATCH 11/38] New ext ip detect (#87) * New method of detecting External IP with falling over --- dockerfiles/evmapp/Dockerfile | 1 + dockerfiles/evmapp/entrypoint.sh | 67 +++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/dockerfiles/evmapp/Dockerfile b/dockerfiles/evmapp/Dockerfile index e96ab21..a2e84cc 100644 --- a/dockerfiles/evmapp/Dockerfile +++ b/dockerfiles/evmapp/Dockerfile @@ -81,6 +81,7 @@ RUN set -eEuo pipefail && mv /sidechain/entrypoint.sh /usr/local/bin/entrypoint. jq \ netcat-openbsd \ apache2-utils \ + ipv6calc \ && savedAptMark="$(apt-mark showmanual)" \ && if ! command -v gosu &> /dev/null; then \ if ! command -v gpg2 &> /dev/null; then \ diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index 03f4e13..52b7189 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -eEuo pipefail USER_ID="${LOCAL_USER_ID:-9001}" @@ -15,11 +14,38 @@ WS_ADDRESS="" ONLY_CONNECT_TO_KNOWN_PEERS="" FORGER_MAXCONNECTIONS="" - SCNODE_REMOTE_KEY_MANAGER_ENABLED="${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-false}" export SCNODE_REMOTE_KEY_MANAGER_ENABLED -if [ "$USER_ID" != "0" ]; then + +# Function(s) +detect_ext_ip() { + local usage="Detect external IPv(4|6) address - usage: ${FUNCNAME[0]} {(4|6)}}" + [ "${1:-}" = "usage" ] && echo "${usage}" && return + [ "$#" -ne 1 ] && { echo -e "${FUNCNAME[0]} error: function requires exactly one argument.\n\n${usage}"; exit 1;} + + local ip_type="${1}" + if ! [[ "${ip_type}" =~ ^(4|6)$ ]]; then + echo -e "${FUNCNAME[0]} error: function expects either '4' or '6' as an argument.\n\n${usage}" + exit 1 + fi + + ip_address="$(dig -"${ip_type}" +short +time=2 @resolver1.opendns.com ANY myip.opendns.com 2> /dev/null | grep -v ";" || true)" + if [ -z "${ip_address:-}" ]; then + ip_address="$(curl -s -"${ip_type}" icanhazip.com 2>/dev/null || true)" + fi + + echo "${ip_address}" +} + +fn_die() { + echo -e "$1" >&2 + sleep 5 + exit "${2:-1}" +} + + +if [ "$USER_ID" != "0" ]; then getent group "$GRP_ID" &> /dev/null || groupadd -g "$GRP_ID" user id -u user &> /dev/null || useradd --shell /bin/bash -u "$USER_ID" -g "$GRP_ID" -o -c "" -m user CURRENT_UID="$(id -u user)" @@ -42,19 +68,32 @@ else export HOME=/root fi -# detect external IPv4 address -SCNODE_NET_DECLAREDADDRESS="$(dig -4 +short +time=2 @resolver1.opendns.com A myip.opendns.com | grep -v ";" || true)" +# Checking if external IP address is provided by the user via ENV var +if [ -n "${SCNODE_NET_DECLAREDADDRESS:-}" ]; then + # Checking user provided public IPv(4|6) address validity + if ! ipv6calc -qim "${SCNODE_NET_DECLAREDADDRESS}" | grep 'TYPE' | grep -q 'global' &>/dev/null; then + fn_die "Error: provided via environment variable IP address = ${SCNODE_NET_DECLAREDADDRESS} does not match a valid IPv4 or IPv6 format or is NOT a PUBLIC address.\nFix it before proceeding any further. Exiting ..." + else + SCNODE_NET_DECLAREDADDRESS="$(ipv6calc -qim "${SCNODE_NET_DECLAREDADDRESS}" | grep -E 'IPV(4|6)=' | cut -d '=' -f2)" + fi +else + # Detecting IPv4 vs IPv6 address + SCNODE_NET_DECLAREDADDRESS="$(detect_ext_ip 4)" + if [ -z "${SCNODE_NET_DECLAREDADDRESS:-}" ]; then + SCNODE_NET_DECLAREDADDRESS="$(detect_ext_ip 6)" + fi -# Using diff resolver -if [ -z "${SCNODE_NET_DECLAREDADDRESS}" ]; then - SCNODE_NET_DECLAREDADDRESS="$(dig -4 +short +time=2 txt ch whoami.cloudflare @1.0.0.1 | tr -d '"' || true)" -fi + # Falling over to internal IP + if [ -z "${SCNODE_NET_DECLAREDADDRESS:-}" ]; then + echo "Error: Failed to detect external IPv(4|6) address, using internal address." + SCNODE_NET_DECLAREDADDRESS="$(hostname -I | cut -d ' ' -f1 || true)" -# Falling over to internal IP -if [ -z "${SCNODE_NET_DECLAREDADDRESS}" ]; then - echo "Error: Failed to detect external IPv4 address, using internal address." - SCNODE_NET_DECLAREDADDRESS="$(hostname -I | cut -d ' ' -f1)" - SCNODE_NET_DECLAREDADDRESS="${SCNODE_NET_DECLAREDADDRESS%% }" + if [ -n "${SCNODE_NET_DECLAREDADDRESS}" ]; then + SCNODE_NET_DECLAREDADDRESS="${SCNODE_NET_DECLAREDADDRESS%% }" + else + SCNODE_NET_DECLAREDADDRESS="127.0.0.1" + fi + fi fi export SCNODE_NET_DECLAREDADDRESS From af80e3a8dbbd54dddca0677c180c7eb37cbfbfd6 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 30 Jan 2024 11:39:25 +0100 Subject: [PATCH 12/38] smart contract documentation - part one --- doc/index.md | 4 + .../contracts/WithdrawalRequests.abi.json | 75 +++++++++++++++++++ doc/nativesc/contracts/WithdrawalRequests.md | 34 +++++++++ doc/nativesc/index.md | 10 +++ 4 files changed, 123 insertions(+) create mode 100644 doc/nativesc/contracts/WithdrawalRequests.abi.json create mode 100644 doc/nativesc/contracts/WithdrawalRequests.md create mode 100644 doc/nativesc/index.md diff --git a/doc/index.md b/doc/index.md index fc80b3e..135707f 100644 --- a/doc/index.md +++ b/doc/index.md @@ -2,6 +2,10 @@ Find [here documentation](/doc/api/index.md) about how to interact with a running EON node. +# EON Native smart contracts documentation + +Find [here documentation](/doc/nativesc/index.md) about EON native smart contracts + # EON Release Notes ## Version [1.2.0](/doc/release/1.2.0.md) diff --git a/doc/nativesc/contracts/WithdrawalRequests.abi.json b/doc/nativesc/contracts/WithdrawalRequests.abi.json new file mode 100644 index 0000000..ef1af05 --- /dev/null +++ b/doc/nativesc/contracts/WithdrawalRequests.abi.json @@ -0,0 +1,75 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + } + ], + "name": "backwardTransfer", + "outputs": [ + { + "components": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct WithdrawalRequests.WithdrawalRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "withdrawalEpoch", + "type": "uint32" + } + ], + "name": "getBackwardTransfers", + "outputs": [ + { + "components": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct WithdrawalRequests.WithdrawalRequest[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} + + + + + + + + + diff --git a/doc/nativesc/contracts/WithdrawalRequests.md b/doc/nativesc/contracts/WithdrawalRequests.md new file mode 100644 index 0000000..243baae --- /dev/null +++ b/doc/nativesc/contracts/WithdrawalRequests.md @@ -0,0 +1,34 @@ +[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +### WithdrawalRequests + +Allows to request a new withdrawal of founds to the mainchain (also called backward trasnfer), and see the list of the previous executed ones. + +| | | +| -------- | ------- | +| Contract address: | 0x0000000000000000000011111111111111111111 | +| ABI descriptor: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.abi.json) | + + +**Methods availables** + +- getBackwardTransfers + + function getBackwardTransfers(uint32 withdrawalEpoch) external view returns (WithdrawalRequest[] memory); + + Return a list of all the backward trasnfers executed in a specific withdrawal epoch. + +- backwardTransfer + + function backwardTransfer(MCAddress mcAddress) external payable returns (WithdrawalRequest memory); + + Add a new withdrawal request: if the transaction will be executed, the backward transfer will not be immediately sent to the mainchain but will be enqued to be processed at the end of the withdrawal epoch, when all the requests will be packed into a certificate and sent to the manchain for approval. + **Important**: the mcAddress parameter is not directly the mainchain address but its Pay to Script Hash (20 bytes) + + + + + + + + + diff --git a/doc/nativesc/index.md b/doc/nativesc/index.md new file mode 100644 index 0000000..a3fa998 --- /dev/null +++ b/doc/nativesc/index.md @@ -0,0 +1,10 @@ +# EON Native Smart contracts Documentation + +EON offers several native smart contracts avaiable by default. +Below a detailed list: + + +[WithdrawalRequests](/doc/nativesc/contracts/WithdrawalRequests.md) + + + From 3ba3cec9dbe7ff06f3dd6c5fbc99c5fde5f22d1b Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 30 Jan 2024 12:25:08 +0100 Subject: [PATCH 13/38] added sol descriptor --- doc/nativesc/contracts/WithdrawalRequests.md | 4 +++- doc/nativesc/contracts/WithdrawalRequests.sol | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 doc/nativesc/contracts/WithdrawalRequests.sol diff --git a/doc/nativesc/contracts/WithdrawalRequests.md b/doc/nativesc/contracts/WithdrawalRequests.md index 243baae..d104f66 100644 --- a/doc/nativesc/contracts/WithdrawalRequests.md +++ b/doc/nativesc/contracts/WithdrawalRequests.md @@ -1,13 +1,15 @@ [< EON Native Smart contracts Documentation](/doc/nativesc/index.md) ### WithdrawalRequests -Allows to request a new withdrawal of founds to the mainchain (also called backward trasnfer), and see the list of the previous executed ones. +Allows to request a new withdrawal of founds to the mainchain (also called backward transfer), and see the list of the previous executed ones. | | | | -------- | ------- | | Contract address: | 0x0000000000000000000011111111111111111111 | | ABI descriptor: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.abi.json) | +| Solidity interface: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.sol) | + **Methods availables** diff --git a/doc/nativesc/contracts/WithdrawalRequests.sol b/doc/nativesc/contracts/WithdrawalRequests.sol new file mode 100644 index 0000000..78bfaaa --- /dev/null +++ b/doc/nativesc/contracts/WithdrawalRequests.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +type MCAddress is bytes20; + +// contract address: 0x0000000000000000000011111111111111111111 +interface WithdrawalRequests { + + struct WithdrawalRequest { + MCAddress mcAddress; + uint256 value; + } + + function getBackwardTransfers(uint32 withdrawalEpoch) external view returns (WithdrawalRequest[] memory); + + function backwardTransfer(MCAddress mcAddress) external payable returns (WithdrawalRequest memory); +} \ No newline at end of file From 994771a6e4d85ad8bbab9df7924e0c135276d3bf Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 30 Jan 2024 16:04:39 +0100 Subject: [PATCH 14/38] native sc documentation - part 2 --- doc/nativesc/contracts/CertKeyRotation.json | 103 +++++++++++ doc/nativesc/contracts/CertKeyRotation.md | 25 +++ doc/nativesc/contracts/CertKeyRotation.sol | 9 + doc/nativesc/contracts/ForgerStakes.json | 146 +++++++++++++++ doc/nativesc/contracts/ForgerStakes.md | 60 ++++++ doc/nativesc/contracts/ForgerStakes.sol | 25 +++ doc/nativesc/contracts/McAddrOwnership.json | 175 ++++++++++++++++++ doc/nativesc/contracts/McAddrOwnership.md | 69 +++++++ doc/nativesc/contracts/McAddrOwnership.sol | 25 +++ ...uests.abi.json => WithdrawalRequests.json} | 0 doc/nativesc/contracts/WithdrawalRequests.md | 2 +- doc/nativesc/index.md | 9 +- 12 files changed, 645 insertions(+), 3 deletions(-) create mode 100644 doc/nativesc/contracts/CertKeyRotation.json create mode 100644 doc/nativesc/contracts/CertKeyRotation.md create mode 100644 doc/nativesc/contracts/CertKeyRotation.sol create mode 100644 doc/nativesc/contracts/ForgerStakes.json create mode 100644 doc/nativesc/contracts/ForgerStakes.md create mode 100644 doc/nativesc/contracts/ForgerStakes.sol create mode 100644 doc/nativesc/contracts/McAddrOwnership.json create mode 100644 doc/nativesc/contracts/McAddrOwnership.md create mode 100644 doc/nativesc/contracts/McAddrOwnership.sol rename doc/nativesc/contracts/{WithdrawalRequests.abi.json => WithdrawalRequests.json} (100%) diff --git a/doc/nativesc/contracts/CertKeyRotation.json b/doc/nativesc/contracts/CertKeyRotation.json new file mode 100644 index 0000000..5c7b777 --- /dev/null +++ b/doc/nativesc/contracts/CertKeyRotation.json @@ -0,0 +1,103 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "uint32", + "name": "key_type", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "index", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "newKey_1", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "newKey_2", + "type": "bytes1" + }, + { + "internalType": "bytes32", + "name": "signKeySig_1", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signKeySig_2", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "masterKeySig_1", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "masterKeySig_2", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "newKeySig_1", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "newKeySig_2", + "type": "bytes32" + } + ], + "name": "submitKeyRotation", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "", + "type": "bytes1" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/doc/nativesc/contracts/CertKeyRotation.md b/doc/nativesc/contracts/CertKeyRotation.md new file mode 100644 index 0000000..f50e408 --- /dev/null +++ b/doc/nativesc/contracts/CertKeyRotation.md @@ -0,0 +1,25 @@ +[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +### CertKeyRotation + +This native smartcontract is used to rotate the master keys of the EON certifiers. + +| | | +| -------- | ------- | +| Contract address: | 0x0000000000000000000044444444444444444444 | +| ABI descriptor: | [Click here](/doc/nativesc/contracts/CertKeyRotation.json) | +| Solidity interface: | [Click here](/doc/nativesc/contracts/CertKeyRotation.sol) | + + + +**Methods availables** + +- submitKeyRotation + + function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); + + Execute a key rotation. + + + + + diff --git a/doc/nativesc/contracts/CertKeyRotation.sol b/doc/nativesc/contracts/CertKeyRotation.sol new file mode 100644 index 0000000..d4b0fb8 --- /dev/null +++ b/doc/nativesc/contracts/CertKeyRotation.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + + +// contract address: 0x0000000000000000000044444444444444444444 +interface CertKeyRotation { + + function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); +} diff --git a/doc/nativesc/contracts/ForgerStakes.json b/doc/nativesc/contracts/ForgerStakes.json new file mode 100644 index 0000000..2d50049 --- /dev/null +++ b/doc/nativesc/contracts/ForgerStakes.json @@ -0,0 +1,146 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "bytes32", + "name": "publicKey", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "vrf1", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "vrf2", + "type": "bytes1" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "delegate", + "outputs": [ + { + "internalType": "StakeID", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getAllForgersStakes", + "outputs": [ + { + "components": [ + { + "internalType": "StakeID", + "name": "stakeId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "stakedAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "publicKey", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "vrf1", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "vrf2", + "type": "bytes1" + } + ], + "internalType": "struct ForgerStakes.StakeInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "forgerIndex", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "signature1", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signature2", + "type": "bytes32" + } + ], + "name": "openStakeForgerList", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "StakeID", + "name": "stakeId", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "signatureV", + "type": "bytes1" + }, + { + "internalType": "bytes32", + "name": "signatureR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signatureS", + "type": "bytes32" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "StakeID", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md new file mode 100644 index 0000000..3b7622e --- /dev/null +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -0,0 +1,60 @@ +[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +### ForgerStakes + +This native smartcontract manages the forger stakes. + +| | | +| -------- | ------- | +| Contract address: | 0x0000000000000000000022222222222222222222 | +| ABI descriptor: | [Click here](/doc/nativesc/contracts/ForgerStakes.json) | +| Solidity interface: | [Click here](/doc/nativesc/contracts/ForgerStakes.sol) | + + + +**Methods availables** + +- getAllForgersStakes + + function getAllForgersStakes() external view returns (StakeInfo[] memory); + + Return a list of all forgers stakes present. + +- delegate + + function delegate(bytes32 publicKey, bytes32 vrf1, bytes1 vrf2, address owner) external payable returns (StakeID); + + Create a new stake and assign it to the forger identified by the specified pubblic key + vrf key. + Vrf key is split in two separate parameters, being long more than 32bytes. + The owner parameter is the address authorized to remove the stake by calling the withdraw founctions. + +- withdraw + + function withdraw(StakeID stakeId, bytes1 signatureV, bytes32 signatureR, bytes32 signatureS) external returns (StakeID); + + Remove the stake identified by stakeId and withdraw the founds, by providing the correct signature. + The message to sign is composed by the concatenation of stakeId + sender address + invocation nonce, and is verified against the owner of the stake. + Note: the whole amount staked will be removed, it is not allowd to remove only partially a stake. + +- openStakeForgerList + + function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); + + Execute a transaction expressing the vote for opening the restricted forgers list. + This transaction is allowed only when the forgers are initially restricted, and can be executed only by one of the allowed forgers. + The forger index is determined by the position of the forger in the allowed forger list. + The message to sign is composed by the concatenation of foreger index + sender address + invocation nonce, and is verified against the blockSignerProposition. + + + + + + + + + + + + + + + diff --git a/doc/nativesc/contracts/ForgerStakes.sol b/doc/nativesc/contracts/ForgerStakes.sol new file mode 100644 index 0000000..8c8aa5e --- /dev/null +++ b/doc/nativesc/contracts/ForgerStakes.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +type StakeID is bytes32; + +// contract address: 0x0000000000000000000022222222222222222222 +interface ForgerStakes { + + struct StakeInfo { + StakeID stakeId; + uint256 stakedAmount; + address owner; + bytes32 publicKey; + bytes32 vrf1; + bytes1 vrf2; + } + + function getAllForgersStakes() external view returns (StakeInfo[] memory); + + function delegate(bytes32 publicKey, bytes32 vrf1, bytes1 vrf2, address owner) external payable returns (StakeID); + + function withdraw(StakeID stakeId, bytes1 signatureV, bytes32 signatureR, bytes32 signatureS) external returns (StakeID); + + function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); +} diff --git a/doc/nativesc/contracts/McAddrOwnership.json b/doc/nativesc/contracts/McAddrOwnership.json new file mode 100644 index 0000000..a7316e1 --- /dev/null +++ b/doc/nativesc/contracts/McAddrOwnership.json @@ -0,0 +1,175 @@ +{ + "abi": [ + { + "inputs": [], + "name": "getAllKeyOwnerships", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "scAddress", + "type": "address" + }, + { + "internalType": "bytes3", + "name": "mcAddrBytes1", + "type": "bytes3" + }, + { + "internalType": "bytes32", + "name": "mcAddrBytes2", + "type": "bytes32" + } + ], + "internalType": "struct McAddrOwnership.McAddrOwnershipData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyOwnerScAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "scAddress", + "type": "address" + } + ], + "name": "getKeyOwnerships", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "scAddress", + "type": "address" + }, + { + "internalType": "bytes3", + "name": "mcAddrBytes1", + "type": "bytes3" + }, + { + "internalType": "bytes32", + "name": "mcAddrBytes2", + "type": "bytes32" + } + ], + "internalType": "struct McAddrOwnership.McAddrOwnershipData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes3", + "name": "mcAddrBytes1", + "type": "bytes3" + }, + { + "internalType": "bytes32", + "name": "mcAddrBytes2", + "type": "bytes32" + } + ], + "name": "removeKeysOwnership", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes3", + "name": "mcAddrBytes1", + "type": "bytes3" + }, + { + "internalType": "bytes32", + "name": "mcAddrBytes2", + "type": "bytes32" + }, + { + "internalType": "bytes24", + "name": "signature1", + "type": "bytes24" + }, + { + "internalType": "bytes32", + "name": "signature2", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signature3", + "type": "bytes32" + } + ], + "name": "sendKeysOwnership", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "mcMultisigAddress", + "type": "string" + }, + { + "internalType": "string", + "name": "redeemScript", + "type": "string" + }, + { + "internalType": "string[]", + "name": "mcSignatures", + "type": "string[]" + } + ], + "name": "sendMultisigKeysOwnership", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/doc/nativesc/contracts/McAddrOwnership.md b/doc/nativesc/contracts/McAddrOwnership.md new file mode 100644 index 0000000..80dc6f3 --- /dev/null +++ b/doc/nativesc/contracts/McAddrOwnership.md @@ -0,0 +1,69 @@ +[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +### McAddrOwnership + +This native smartcontract is used as a support to the ZenDao voting system. +It allows to track associations between mainchain addresses and EON addresses, in order to sum the ZEN balances in both the chains for calculating voting powers. + +| | | +| -------- | ------- | +| Contract address: | 0x0000000000000000000088888888888888888888 | +| ABI descriptor: | [Click here](/doc/nativesc/contracts/McAddrOwnership.json) | +| Solidity interface: | [Click here](/doc/nativesc/contracts/McAddrOwnership.sol) | + + + +**Methods availables** + +- getAllKeyOwnerships + + function getAllKeyOwnerships() external view returns (McAddrOwnershipData[] memory); + + Return a list of all the mainchain keys associated with the EON address that invoked the method. + +- getKeyOwnerships + + function getKeyOwnerships(address scAddress) external view returns (McAddrOwnershipData[] memory); + + Return a list of the mainchain keys associated with the EON address specified in the input parameter scAddress + +- getKeyOwnerScAddresses + + function getKeyOwnerScAddresses() external view returns (address[] memory); + + Return the list of all the EON addresses with recorded associations to mainchain keys. + +- sendKeysOwnership + + function sendKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2, bytes24 signature1, bytes32 signature2, bytes32 signature3) external returns (bytes32); + + Associate a mainchain address to the EON address that invoked the method. + Mainchain address is split in 2 parameters, being long more than 32bytes. + Signature is split in 3 parameters for the same reason. The message to sign is the string representation of the EON address (format EIP-55: Mixed-case checksum address encoding). + In case of success, the returned value is the id of the new ownership record created. + +- sendMultisigKeysOwnership + + function sendMultisigKeysOwnership(string memory mcMultisigAddress, string memory redeemScript, string[] memory mcSignatures) external returns (bytes32); + + Associate the specified mainchain multisig address to the EON address that invoked the method. + Redeem script and signatures must be provided as well. + In case of success, the returned value is the id of the new ownership record created. + +- removeKeysOwnership + + function removeKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2) external returns (bytes32); + + Remove an association between the EON address that invoked the method and the specified mainchain address. + Mainchain address is split in 2 parameters, being long more than 32bytes. + In case of success, the returned value is the id of the ownership record removed. + + + + + + + + + + + diff --git a/doc/nativesc/contracts/McAddrOwnership.sol b/doc/nativesc/contracts/McAddrOwnership.sol new file mode 100644 index 0000000..69a0c1e --- /dev/null +++ b/doc/nativesc/contracts/McAddrOwnership.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + + +// contract address: 0x0000000000000000000088888888888888888888 +interface McAddrOwnership { + + struct McAddrOwnershipData { + address scAddress; + bytes3 mcAddrBytes1; + bytes32 mcAddrBytes2; + } + + function getAllKeyOwnerships() external view returns (McAddrOwnershipData[] memory); + + function getKeyOwnerships(address scAddress) external view returns (McAddrOwnershipData[] memory); + + function getKeyOwnerScAddresses() external view returns (address[] memory); + + function sendKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2, bytes24 signature1, bytes32 signature2, bytes32 signature3) external returns (bytes32); + + function sendMultisigKeysOwnership(string memory mcMultisigAddress, string memory redeemScript, string[] memory mcSignatures) external returns (bytes32); + + function removeKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2) external returns (bytes32); +} diff --git a/doc/nativesc/contracts/WithdrawalRequests.abi.json b/doc/nativesc/contracts/WithdrawalRequests.json similarity index 100% rename from doc/nativesc/contracts/WithdrawalRequests.abi.json rename to doc/nativesc/contracts/WithdrawalRequests.json diff --git a/doc/nativesc/contracts/WithdrawalRequests.md b/doc/nativesc/contracts/WithdrawalRequests.md index d104f66..43a9d94 100644 --- a/doc/nativesc/contracts/WithdrawalRequests.md +++ b/doc/nativesc/contracts/WithdrawalRequests.md @@ -6,7 +6,7 @@ Allows to request a new withdrawal of founds to the mainchain (also called backw | | | | -------- | ------- | | Contract address: | 0x0000000000000000000011111111111111111111 | -| ABI descriptor: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.abi.json) | +| ABI descriptor: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.json) | | Solidity interface: | [Click here](/doc/nativesc/contracts/WithdrawalRequests.sol) | diff --git a/doc/nativesc/index.md b/doc/nativesc/index.md index a3fa998..d31ac5e 100644 --- a/doc/nativesc/index.md +++ b/doc/nativesc/index.md @@ -1,10 +1,15 @@ # EON Native Smart contracts Documentation -EON offers several native smart contracts avaiable by default. +EON offers several native smart contracts avaiable by default at a predefines address. +They can be invoked as any standard smart contract with rpc method calls or (starting from EON 1.2) referenced by other smart contract. + Below a detailed list: +[WithdrawalRequests](/doc/nativesc/contracts/WithdrawalRequests.md) +[ForgerStakes](/doc/nativesc/contracts/ForgerStakes.md) +[McAddrOwnerships](/doc/nativesc/contracts/McAddrOwnership.md) +[CertKeyRotation](/doc/nativesc/contracts/CertKeyRotation.md) -[WithdrawalRequests](/doc/nativesc/contracts/WithdrawalRequests.md) From 7622c9f04588e12d6f05d374caaf918a056529c5 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 30 Jan 2024 16:24:14 +0100 Subject: [PATCH 15/38] key rotation documentation --- doc/nativesc/contracts/CertKeyRotation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/nativesc/contracts/CertKeyRotation.md b/doc/nativesc/contracts/CertKeyRotation.md index f50e408..3b775f3 100644 --- a/doc/nativesc/contracts/CertKeyRotation.md +++ b/doc/nativesc/contracts/CertKeyRotation.md @@ -17,7 +17,7 @@ This native smartcontract is used to rotate the master keys of the EON certifier function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); - Execute a key rotation. + Exectue a signers or masters certificate submitter key rotation. From 5ccb353b1277fc2e0452fdf559e26eec5b0a4b31 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 30 Jan 2024 16:29:29 +0100 Subject: [PATCH 16/38] fixed api versions --- api/version.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/version.json b/api/version.json index 275bb95..08e8cc1 100644 --- a/api/version.json +++ b/api/version.json @@ -2,15 +2,15 @@ { "network":"mainnet", "networkName": "eon", - "version":"1.2.1", - "dockerImages":["zencash/evmapp:1.2.1","zencash/evmapp:latest"], - "ghReleaseLink":"github.com/HorizenOfficial/eon/releases/tag/1.2.1" + "version":"1.3.0", + "dockerImages":["zencash/evmapp:1.3.0","zencash/evmapp:latest"], + "ghReleaseLink":"github.com/HorizenOfficial/eon/releases/tag/1.3.0" }, { "network":"testnet", "networkName": "gobi", - "version":"1.2.1", - "dockerImages":["zencash/evmapp:1.2.1","zencash/evmapp:latest"], - "ghReleaseLink":"github.com/HorizenOfficial/eon/releases/tag/1.2.1" + "version":"1.3.0", + "dockerImages":["zencash/evmapp:1.3.0","zencash/evmapp:latest"], + "ghReleaseLink":"github.com/HorizenOfficial/eon/releases/tag/1.3.0" } ] \ No newline at end of file From ccb213b2abf34949fe38b453e68a4b1d3648cd49 Mon Sep 17 00:00:00 2001 From: Alberto Sala Date: Thu, 1 Feb 2024 09:41:55 +0100 Subject: [PATCH 17/38] Added constant definition for max number of revertable blocks --- node/src/main/java/io/horizen/eon/ApplicationConstants.java | 1 + node/src/main/java/io/horizen/eon/EonAppModule.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/node/src/main/java/io/horizen/eon/ApplicationConstants.java b/node/src/main/java/io/horizen/eon/ApplicationConstants.java index 51622ba..a3e6a9e 100644 --- a/node/src/main/java/io/horizen/eon/ApplicationConstants.java +++ b/node/src/main/java/io/horizen/eon/ApplicationConstants.java @@ -10,6 +10,7 @@ private ApplicationConstants() {} static final long MAINNET_ID = 7332L; static final int MAINCHAIN_BLOCK_REFERENCE_DELAY = 6; // in number of mainchain blocks + static final int MAX_HISTORY_REWRITING_LENGTH = 100; // max number of SC blocks that can be reverted; in number of SC blocks public static final String PREGOBI_SIDECHAINID = "1f758350754c12ac8f75a547f745b75eb744b382e15d0d3b0e24a4b5c5acde00"; public static final String GOBI_SIDECHAINID = "264a664c87d438b6983e0e071293e0e50b37eb12976eaa2dcd08d6a1ee16ca71"; diff --git a/node/src/main/java/io/horizen/eon/EonAppModule.java b/node/src/main/java/io/horizen/eon/EonAppModule.java index aee0872..3a03f27 100644 --- a/node/src/main/java/io/horizen/eon/EonAppModule.java +++ b/node/src/main/java/io/horizen/eon/EonAppModule.java @@ -99,6 +99,10 @@ public void configureApp() { bind(String.class) .annotatedWith(Names.named("AppVersion")) .toInstance(getEONVersion()); + + bind(Integer.class) + .annotatedWith(Names.named("MaxHistoryRewriteLength")) + .toInstance(MAX_HISTORY_REWRITING_LENGTH); } /** From aa4584052ad4147815cac3834d8befb517c88d1f Mon Sep 17 00:00:00 2001 From: saratnt Date: Wed, 7 Feb 2024 15:18:29 +0100 Subject: [PATCH 18/38] Updated native smart contracts documentation --- doc/nativesc/contracts/CertKeyRotation.json | 37 ++++ doc/nativesc/contracts/CertKeyRotation.sol | 5 + doc/nativesc/contracts/ForgerStakes.json | 177 ++++++++++++++++++ doc/nativesc/contracts/ForgerStakes.md | 23 ++- doc/nativesc/contracts/ForgerStakes.sol | 15 ++ doc/nativesc/contracts/McAddrOwnership.json | 50 +++++ doc/nativesc/contracts/McAddrOwnership.sol | 8 + .../contracts/WithdrawalRequests.json | 164 +++++++++------- doc/nativesc/contracts/WithdrawalRequests.sol | 8 +- 9 files changed, 414 insertions(+), 73 deletions(-) diff --git a/doc/nativesc/contracts/CertKeyRotation.json b/doc/nativesc/contracts/CertKeyRotation.json index 5c7b777..da64236 100644 --- a/doc/nativesc/contracts/CertKeyRotation.json +++ b/doc/nativesc/contracts/CertKeyRotation.json @@ -1,5 +1,42 @@ { "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "keyType", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "keyIndex", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "newKeyValue_32", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes1", + "name": "newKeyValue_1", + "type": "bytes1" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epochNumber", + "type": "uint32" + } + ], + "name": "SubmitKeyRotation", + "type": "event" + }, { "inputs": [ { diff --git a/doc/nativesc/contracts/CertKeyRotation.sol b/doc/nativesc/contracts/CertKeyRotation.sol index d4b0fb8..07db251 100644 --- a/doc/nativesc/contracts/CertKeyRotation.sol +++ b/doc/nativesc/contracts/CertKeyRotation.sol @@ -5,5 +5,10 @@ pragma solidity ^0.8.0; // contract address: 0x0000000000000000000044444444444444444444 interface CertKeyRotation { + // Event declaration + // Up to 3 parameters can be indexed. + // Indexed parameters helps you filter the logs by the indexed parameter + event SubmitKeyRotation(uint32 indexed keyType, uint32 indexed keyIndex, bytes32 newKeyValue_32, bytes1 newKeyValue_1, uint32 epochNumber); + function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); } diff --git a/doc/nativesc/contracts/ForgerStakes.json b/doc/nativesc/contracts/ForgerStakes.json index 2d50049..abd154a 100644 --- a/doc/nativesc/contracts/ForgerStakes.json +++ b/doc/nativesc/contracts/ForgerStakes.json @@ -1,5 +1,99 @@ { "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "stakeId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "DelegateForgerStake", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "forgerIndex", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockSignProposition", + "type": "bytes32" + } + ], + "name": "OpenForgerList", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "oldVersion", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "newVersion", + "type": "uint32" + } + ], + "name": "StakeUpgrade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "stakeId", + "type": "bytes32" + } + ], + "name": "WithdrawForgerStake", + "type": "event" + }, { "inputs": [ { @@ -79,6 +173,57 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "getAllForgersStakesOfUser", + "outputs": [ + { + "components": [ + { + "internalType": "StakeID", + "name": "stakeId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "stakedAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "publicKey", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "vrf1", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "vrf2", + "type": "bytes1" + } + ], + "internalType": "struct ForgerStakes.StakeInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -108,6 +253,38 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "stakeOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "upgrade", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index 3b7622e..baedf87 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -39,11 +39,32 @@ This native smartcontract manages the forger stakes. function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); - Execute a transaction expressing the vote for opening the restricted forgers list. + Execute a transaction expressing the vote for opening the restricted forgers list. This transaction is allowed only when the forgers are initially restricted, and can be executed only by one of the allowed forgers. The forger index is determined by the position of the forger in the allowed forger list. The message to sign is composed by the concatenation of foreger index + sender address + invocation nonce, and is verified against the blockSignerProposition. +- upgrade + + function upgrade() external view returns (uint32); + + This method upgrades the model of the forger stakes storage. It can be called just once. If successful, it returns + the number identifying the new storage version (1 => Version 2). It emits a StakeUpgrade event, with the storage + versions before and after the upgrade. + +- getAllForgersStakesOfUser + + function getAllForgersStakesOfUser(address owner) external view returns (StakeInfo[] memory); + + Returns all forger stakes owned by the specified address. This method requires the Forger Stake storage model version + 2, so it fails when invoked before the “upgrade()” method. + +- stakeOf + + function stakeOf(address owner) external view returns (uint256); + + Returns the total amount of forger stakes owned by the specified address. This method requires the Forger Stake + storage model version 2, so it fails when invoked before the “upgrade()” method. diff --git a/doc/nativesc/contracts/ForgerStakes.sol b/doc/nativesc/contracts/ForgerStakes.sol index 8c8aa5e..b34fd70 100644 --- a/doc/nativesc/contracts/ForgerStakes.sol +++ b/doc/nativesc/contracts/ForgerStakes.sol @@ -15,6 +15,14 @@ interface ForgerStakes { bytes1 vrf2; } + // Event declaration + // Up to 3 parameters can be indexed. + // Indexed parameters helps you filter the logs by the indexed parameter + event DelegateForgerStake(address indexed sender, address indexed owner, bytes32 stakeId, uint256 value); + event WithdrawForgerStake(address indexed owner, bytes32 stakeId); + event StakeUpgrade(uint32 oldVersion, uint32 newVersion); + event OpenForgerList(uint32 indexed forgerIndex, address sender, bytes32 blockSignProposition); + function getAllForgersStakes() external view returns (StakeInfo[] memory); function delegate(bytes32 publicKey, bytes32 vrf1, bytes1 vrf2, address owner) external payable returns (StakeID); @@ -22,4 +30,11 @@ interface ForgerStakes { function withdraw(StakeID stakeId, bytes1 signatureV, bytes32 signatureR, bytes32 signatureS) external returns (StakeID); function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); + + function stakeOf(address owner) external view returns (uint256); + + function getAllForgersStakesOfUser(address owner) external view returns (StakeInfo[] memory); + + function upgrade() external view returns (uint32); + } diff --git a/doc/nativesc/contracts/McAddrOwnership.json b/doc/nativesc/contracts/McAddrOwnership.json index a7316e1..9ec795c 100644 --- a/doc/nativesc/contracts/McAddrOwnership.json +++ b/doc/nativesc/contracts/McAddrOwnership.json @@ -1,5 +1,55 @@ { "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "scAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes3", + "name": "mcAddress_3", + "type": "bytes3" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "mcAddress_32", + "type": "bytes32" + } + ], + "name": "AddMcAddrOwnership", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "scAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes3", + "name": "mcAddress_3", + "type": "bytes3" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "mcAddress_32", + "type": "bytes32" + } + ], + "name": "RemoveMcAddrOwnership", + "type": "event" + }, { "inputs": [], "name": "getAllKeyOwnerships", diff --git a/doc/nativesc/contracts/McAddrOwnership.sol b/doc/nativesc/contracts/McAddrOwnership.sol index 69a0c1e..0da1b79 100644 --- a/doc/nativesc/contracts/McAddrOwnership.sol +++ b/doc/nativesc/contracts/McAddrOwnership.sol @@ -11,6 +11,14 @@ interface McAddrOwnership { bytes32 mcAddrBytes2; } + + // Event declaration + // Up to 3 parameters can be indexed. + // Indexed parameters helps you filter the logs by the indexed parameter + + event AddMcAddrOwnership(address indexed scAddress, bytes3 mcAddress_3, bytes32 mcAddress_32); + event RemoveMcAddrOwnership(address indexed scAddress, bytes3 mcAddress_3, bytes32 mcAddress_32); + function getAllKeyOwnerships() external view returns (McAddrOwnershipData[] memory); function getKeyOwnerships(address scAddress) external view returns (McAddrOwnershipData[] memory); diff --git a/doc/nativesc/contracts/WithdrawalRequests.json b/doc/nativesc/contracts/WithdrawalRequests.json index ef1af05..8159530 100644 --- a/doc/nativesc/contracts/WithdrawalRequests.json +++ b/doc/nativesc/contracts/WithdrawalRequests.json @@ -1,75 +1,97 @@ { - "abi": [ - { - "inputs": [ - { - "internalType": "MCAddress", - "name": "mcAddress", - "type": "bytes20" - } + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes20", + "name": "mcDest", + "type": "bytes20" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "epochNumber", + "type": "uint32" + } + ], + "name": "AddWithdrawalRequest", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + } + ], + "name": "backwardTransfer", + "outputs": [ + { + "components": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } ], - "name": "backwardTransfer", - "outputs": [ - { - "components": [ - { - "internalType": "MCAddress", - "name": "mcAddress", - "type": "bytes20" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct WithdrawalRequests.WithdrawalRequest", - "name": "", - "type": "tuple" - } + "internalType": "struct WithdrawalRequests.WithdrawalRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "withdrawalEpoch", + "type": "uint32" + } + ], + "name": "getBackwardTransfers", + "outputs": [ + { + "components": [ + { + "internalType": "MCAddress", + "name": "mcAddress", + "type": "bytes20" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "withdrawalEpoch", - "type": "uint32" - } - ], - "name": "getBackwardTransfers", - "outputs": [ - { - "components": [ - { - "internalType": "MCAddress", - "name": "mcAddress", - "type": "bytes20" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct WithdrawalRequests.WithdrawalRequest[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ] + "internalType": "struct WithdrawalRequests.WithdrawalRequest[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ] } - - - - - - - - - diff --git a/doc/nativesc/contracts/WithdrawalRequests.sol b/doc/nativesc/contracts/WithdrawalRequests.sol index 78bfaaa..e8c7c1c 100644 --- a/doc/nativesc/contracts/WithdrawalRequests.sol +++ b/doc/nativesc/contracts/WithdrawalRequests.sol @@ -11,7 +11,13 @@ interface WithdrawalRequests { uint256 value; } + // Event declaration + // Up to 3 parameters can be indexed. + // Indexed parameters helps you filter the logs by the indexed parameter + event AddWithdrawalRequest(address indexed sender, bytes20 indexed mcDest, uint256 value, uint32 epochNumber); + + function getBackwardTransfers(uint32 withdrawalEpoch) external view returns (WithdrawalRequest[] memory); function backwardTransfer(MCAddress mcAddress) external payable returns (WithdrawalRequest memory); -} \ No newline at end of file +} From e52ba066340668be3ba382f40c27b3889c8f2e8c Mon Sep 17 00:00:00 2001 From: saratnt Date: Thu, 8 Feb 2024 17:26:08 +0100 Subject: [PATCH 19/38] Updated Forger stake native contract documentation --- doc/nativesc/contracts/ForgerStakes.json | 17 ++++++++++++++++- doc/nativesc/contracts/ForgerStakes.md | 9 +++++---- doc/nativesc/contracts/ForgerStakes.sol | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/nativesc/contracts/ForgerStakes.json b/doc/nativesc/contracts/ForgerStakes.json index abd154a..b10a2c3 100644 --- a/doc/nativesc/contracts/ForgerStakes.json +++ b/doc/nativesc/contracts/ForgerStakes.json @@ -179,10 +179,25 @@ "internalType": "address", "name": "owner", "type": "address" + }, + { + "internalType": "uint32", + "name": "startIndex", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "pageSize", + "type": "uint32" } ], - "name": "getAllForgersStakesOfUser", + "name": "getPagedForgersStakesByUser", "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, { "components": [ { diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index baedf87..12977ae 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -52,12 +52,13 @@ This native smartcontract manages the forger stakes. the number identifying the new storage version (1 => Version 2). It emits a StakeUpgrade event, with the storage versions before and after the upgrade. -- getAllForgersStakesOfUser +- getPagedForgersStakesByUser - function getAllForgersStakesOfUser(address owner) external view returns (StakeInfo[] memory); + function function getPagedForgersStakesByUser(address owner, uint32 startIndex, uint32 pageSize) external view returns (uint32, StakeInfo[] memory); - Returns all forger stakes owned by the specified address. This method requires the Forger Stake storage model version - 2, so it fails when invoked before the “upgrade()” method. + Returns the first "pageSize" forger stakes, owned by the specified address, starting from "startIndex". In case there + are additional stakes left, it returns the index of the first of the remaining stakes, otherwise it returns -1. + This method requires the Forger Stake storage model version 2, so it will fail if invoked before the “upgrade()” method. - stakeOf diff --git a/doc/nativesc/contracts/ForgerStakes.sol b/doc/nativesc/contracts/ForgerStakes.sol index b34fd70..0bea974 100644 --- a/doc/nativesc/contracts/ForgerStakes.sol +++ b/doc/nativesc/contracts/ForgerStakes.sol @@ -33,7 +33,7 @@ interface ForgerStakes { function stakeOf(address owner) external view returns (uint256); - function getAllForgersStakesOfUser(address owner) external view returns (StakeInfo[] memory); + function getPagedForgersStakesByUser(address owner, uint32 startIndex, uint32 pageSize) external view returns (uint32, StakeInfo[] memory); function upgrade() external view returns (uint32); From 5945b47bb9648024e151faba4813908cff8d1a98 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 9 Feb 2024 18:24:32 +0100 Subject: [PATCH 20/38] fixed typos per code review --- doc/nativesc/contracts/CertKeyRotation.md | 8 ++++---- doc/nativesc/contracts/ForgerStakes.md | 19 ++++++++++--------- doc/nativesc/contracts/McAddrOwnership.md | 10 +++++----- doc/nativesc/contracts/WithdrawalRequests.md | 8 ++++---- doc/nativesc/index.md | 6 +++--- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/doc/nativesc/contracts/CertKeyRotation.md b/doc/nativesc/contracts/CertKeyRotation.md index 3b775f3..08ce2ad 100644 --- a/doc/nativesc/contracts/CertKeyRotation.md +++ b/doc/nativesc/contracts/CertKeyRotation.md @@ -1,7 +1,7 @@ -[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +[< EON Native Smart Contracts Documentation](/doc/nativesc/index.md) ### CertKeyRotation -This native smartcontract is used to rotate the master keys of the EON certifiers. +This native smart contract is used to rotate the master and signers keys of the EON certifiers. | | | | -------- | ------- | @@ -11,13 +11,13 @@ This native smartcontract is used to rotate the master keys of the EON certifier -**Methods availables** +**Methods available** - submitKeyRotation function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); - Exectue a signers or masters certificate submitter key rotation. + Exectues a signers or masters certificate submitter key rotation. diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index 12977ae..a5a49b8 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -1,7 +1,7 @@ -[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +[< EON Native Smart Contracts Documentation](/doc/nativesc/index.md) ### ForgerStakes -This native smartcontract manages the forger stakes. +This native smart contract manages the forger stakes. | | | | -------- | ------- | @@ -11,7 +11,7 @@ This native smartcontract manages the forger stakes. -**Methods availables** +**Methods available** - getAllForgersStakes @@ -23,17 +23,18 @@ This native smartcontract manages the forger stakes. function delegate(bytes32 publicKey, bytes32 vrf1, bytes1 vrf2, address owner) external payable returns (StakeID); - Create a new stake and assign it to the forger identified by the specified pubblic key + vrf key. - Vrf key is split in two separate parameters, being long more than 32bytes. - The owner parameter is the address authorized to remove the stake by calling the withdraw founctions. + Create a new stake and assign it to the forger identified by the specified public key + vrf key. + Vrf key is split in two separate parameters, being longer than 32 bytes. + The owner parameter is the address authorized to remove the stake by calling the withdraw functions. + The amount of the stake is specified in the "value" field of the transaction. - withdraw function withdraw(StakeID stakeId, bytes1 signatureV, bytes32 signatureR, bytes32 signatureS) external returns (StakeID); - Remove the stake identified by stakeId and withdraw the founds, by providing the correct signature. + Remove the stake identified by stakeId and withdraw the funds, by providing the correct signature. The message to sign is composed by the concatenation of stakeId + sender address + invocation nonce, and is verified against the owner of the stake. - Note: the whole amount staked will be removed, it is not allowd to remove only partially a stake. + Note: the whole amount staked will be removed, it is not allowed to remove only partially a stake. - openStakeForgerList @@ -42,7 +43,7 @@ This native smartcontract manages the forger stakes. Execute a transaction expressing the vote for opening the restricted forgers list. This transaction is allowed only when the forgers are initially restricted, and can be executed only by one of the allowed forgers. The forger index is determined by the position of the forger in the allowed forger list. - The message to sign is composed by the concatenation of foreger index + sender address + invocation nonce, and is verified against the blockSignerProposition. + The message to sign is composed by the concatenation of forger index + sender address + invocation nonce, and is verified against the blockSignerProposition. - upgrade diff --git a/doc/nativesc/contracts/McAddrOwnership.md b/doc/nativesc/contracts/McAddrOwnership.md index 80dc6f3..2f3ecb2 100644 --- a/doc/nativesc/contracts/McAddrOwnership.md +++ b/doc/nativesc/contracts/McAddrOwnership.md @@ -1,7 +1,7 @@ -[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +[< EON Native Smart Contracts Documentation](/doc/nativesc/index.md) ### McAddrOwnership -This native smartcontract is used as a support to the ZenDao voting system. +This native smart contract is used as a support to the ZenDao voting system. It allows to track associations between mainchain addresses and EON addresses, in order to sum the ZEN balances in both the chains for calculating voting powers. | | | @@ -12,7 +12,7 @@ It allows to track associations between mainchain addresses and EON addresses, i -**Methods availables** +**Methods available** - getAllKeyOwnerships @@ -37,7 +37,7 @@ It allows to track associations between mainchain addresses and EON addresses, i function sendKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2, bytes24 signature1, bytes32 signature2, bytes32 signature3) external returns (bytes32); Associate a mainchain address to the EON address that invoked the method. - Mainchain address is split in 2 parameters, being long more than 32bytes. + Mainchain address is split in 2 parameters, being longer than 32 bytes. Signature is split in 3 parameters for the same reason. The message to sign is the string representation of the EON address (format EIP-55: Mixed-case checksum address encoding). In case of success, the returned value is the id of the new ownership record created. @@ -54,7 +54,7 @@ It allows to track associations between mainchain addresses and EON addresses, i function removeKeysOwnership(bytes3 mcAddrBytes1, bytes32 mcAddrBytes2) external returns (bytes32); Remove an association between the EON address that invoked the method and the specified mainchain address. - Mainchain address is split in 2 parameters, being long more than 32bytes. + Mainchain address is split in 2 parameters, being longer more than 32 bytes. In case of success, the returned value is the id of the ownership record removed. diff --git a/doc/nativesc/contracts/WithdrawalRequests.md b/doc/nativesc/contracts/WithdrawalRequests.md index 43a9d94..07bf351 100644 --- a/doc/nativesc/contracts/WithdrawalRequests.md +++ b/doc/nativesc/contracts/WithdrawalRequests.md @@ -1,7 +1,7 @@ -[< EON Native Smart contracts Documentation](/doc/nativesc/index.md) +[< EON Native Smart Contracts Documentation](/doc/nativesc/index.md) ### WithdrawalRequests -Allows to request a new withdrawal of founds to the mainchain (also called backward transfer), and see the list of the previous executed ones. +Allows to request a new withdrawal of funds to the mainchain (also called backward transfer), and see the list of the previous executed ones. | | | | -------- | ------- | @@ -11,13 +11,13 @@ Allows to request a new withdrawal of founds to the mainchain (also called backw -**Methods availables** +**Methods available** - getBackwardTransfers function getBackwardTransfers(uint32 withdrawalEpoch) external view returns (WithdrawalRequest[] memory); - Return a list of all the backward trasnfers executed in a specific withdrawal epoch. + Return a list of all the backward transfers executed in a specific withdrawal epoch. - backwardTransfer diff --git a/doc/nativesc/index.md b/doc/nativesc/index.md index d31ac5e..a168ec6 100644 --- a/doc/nativesc/index.md +++ b/doc/nativesc/index.md @@ -1,7 +1,7 @@ -# EON Native Smart contracts Documentation +# EON Native Smart Contracts Documentation -EON offers several native smart contracts avaiable by default at a predefines address. -They can be invoked as any standard smart contract with rpc method calls or (starting from EON 1.2) referenced by other smart contract. +EON offers several native smart contracts available by default at a predefined address. +They can be invoked as any standard smart contract with rpc method calls or (starting from EON 1.2) referenced by another smart contract. Below a detailed list: From 1ebaf0efe93adbb0029cc46f989d77923ecdef8c Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 14 Feb 2024 14:22:50 +0100 Subject: [PATCH 21/38] review fixes --- doc/nativesc/contracts/CertKeyRotation.md | 2 +- doc/nativesc/contracts/ForgerStakes.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/nativesc/contracts/CertKeyRotation.md b/doc/nativesc/contracts/CertKeyRotation.md index 08ce2ad..bbf752e 100644 --- a/doc/nativesc/contracts/CertKeyRotation.md +++ b/doc/nativesc/contracts/CertKeyRotation.md @@ -17,7 +17,7 @@ This native smart contract is used to rotate the master and signers keys of the function submitKeyRotation(uint32 key_type, uint32 index, bytes32 newKey_1, bytes1 newKey_2, bytes32 signKeySig_1, bytes32 signKeySig_2, bytes32 masterKeySig_1, bytes32 masterKeySig_2, bytes32 newKeySig_1, bytes32 newKeySig_2) external returns (uint32, uint32, bytes32, bytes1, bytes32, bytes32, bytes32, bytes32); - Exectues a signers or masters certificate submitter key rotation. + Executes a signers or masters certificate submitter key rotation. diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index a5a49b8..d91fb5b 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -25,7 +25,7 @@ This native smart contract manages the forger stakes. Create a new stake and assign it to the forger identified by the specified public key + vrf key. Vrf key is split in two separate parameters, being longer than 32 bytes. - The owner parameter is the address authorized to remove the stake by calling the withdraw functions. + The owner parameter is the address authorized to remove the stake by calling the withdraw function. The amount of the stake is specified in the "value" field of the transaction. - withdraw @@ -34,7 +34,7 @@ This native smart contract manages the forger stakes. Remove the stake identified by stakeId and withdraw the funds, by providing the correct signature. The message to sign is composed by the concatenation of stakeId + sender address + invocation nonce, and is verified against the owner of the stake. - Note: the whole amount staked will be removed, it is not allowed to remove only partially a stake. + Note: the whole amount staked will be removed, it is not allowed to remove only partially a stake. The amount of the stake spent is sent to the balance of the owner. - openStakeForgerList From 66b82501f1710dfd0018fb8ec0408c1b989e03d0 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 16 Feb 2024 16:51:36 +0100 Subject: [PATCH 22/38] version 1.3: updated readme and changelog --- CHANGELOG.md | 1 + README.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e68b8..5197962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.3.0 * SDK dependency updated to version 0.11.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.11.0/CHANGELOG.md)) +* Fork configuration to enable: EVM Update, Forge stake native smart contract new methods, Pause Forging feature ## 1.2.1 * SDK dependency updated to version 0.10.1 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.10.1/CHANGELOG.md)) diff --git a/README.md b/README.md index 5868986..3af622e 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Horizen EON is a public proof-of-stake sidechain and a fully EVM-compatible smar [Changelog](/CHANGELOG.md) ### EVM compatibility -Current EVM implementation is based on go-ethereum [Paravin](https://github.com/ethereum/go-ethereum/releases/tag/v1.10.26) (`v1.10.26`).
-Solidity compiler is supported up to version `0.8.19`. +Current EVM implementation is based on go-ethereum [Archanes](https://github.com/ethereum/go-ethereum/releases/tag/v1.10.26) (`v1.13.4`).
+Solidity compiler is supported up to version `0.8.23`. ### Supported platforms From 2ac073f309424d308ab029d55e3fa3bbc8971fea Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 16 Feb 2024 17:36:17 +0100 Subject: [PATCH 23/38] Pregobi fork activation height --- node/src/main/java/io/horizen/eon/forks/F5Fork.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/node/src/main/java/io/horizen/eon/forks/F5Fork.java b/node/src/main/java/io/horizen/eon/forks/F5Fork.java index 2d29a8f..784abdc 100644 --- a/node/src/main/java/io/horizen/eon/forks/F5Fork.java +++ b/node/src/main/java/io/horizen/eon/forks/F5Fork.java @@ -21,9 +21,8 @@ protected int getActivationRegtest() { return 7; } @Override - protected int getActivationTestnetPregobi() { - return 1000000; //TODO - } + protected int getActivationTestnetPregobi() {return 2007;} //estimated start at WED 21 Feb 2024 13:01 Milano time + @Override protected int getActivationTestnetGobi() { return 1000000; //TODO From 1e9d9a1eacfcb5759fd451cc72921ea0b309027e Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 16 Feb 2024 17:57:33 +0100 Subject: [PATCH 24/38] docker: added optional parameter for forger reward address --- dockerfiles/evmapp/entrypoint.sh | 8 +++++++- dockerfiles/evmapp/sc_settings.conf.tmpl | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index e9622be..528d0bc 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -13,6 +13,7 @@ MAX_OUTGOING_CONNECTIONS="" WS_ADDRESS="" ONLY_CONNECT_TO_KNOWN_PEERS="" FORGER_MAXCONNECTIONS="" +FORGER_REWARD_ADDRESS="" LOG4J_CUSTOM_CONFIG="" SCNODE_REMOTE_KEY_MANAGER_ENABLED="${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-false}" @@ -221,6 +222,11 @@ if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ] || [ "${SCNODE_CERT_SUBMITTER_ENABL fi fi +if [ -n "${SC_NODE_FORGER_REWARD_ADDRESS:-}" ]; then + FORGER_REWARD_ADDRESS="$(echo -en "\n forgerRewardAddress = \"${SC_NODE_FORGER_REWARD_ADDRESS}\"")" +fi +export FORGER_REWARD_ADDRESS + # Checking SCNODE_FORGER_MAXCONNECTIONS for Forger nodes if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ]; then if [ -n "${SCNODE_FORGER_MAXCONNECTIONS:-}" ]; then @@ -364,7 +370,7 @@ SUBST='$SCNODE_CERT_MASTERS_PUBKEYS:$SCNODE_CERT_SIGNERS_MAXPKS:$SCNODE_CERT_SIG '$SCNODE_NET_DECLAREDADDRESS:$SCNODE_NET_KNOWNPEERS:$SCNODE_NET_MAGICBYTES:$SCNODE_NET_NODENAME:$SCNODE_NET_P2P_PORT:$SCNODE_NET_API_LIMITER_ENABLED:$SCNODE_NET_SLOW_MODE:$SCNODE_NET_REBROADCAST_TXS:$SCNODE_NET_HANDLING_TXS:'\ '$SCNODE_WALLET_GENESIS_SECRETS:$SCNODE_WALLET_MAXTX_FEE:$SCNODE_WALLET_SEED:$WS_ADDRESS:$MAX_INCOMING_CONNECTIONS:$MAX_OUTGOING_CONNECTIONS:$SCNODE_WS_SERVER_PORT:'\ '$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:$SCNODE_LOG_FILE_NAME:$REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:$REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:'\ -'$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT:$ONLY_CONNECT_TO_KNOWN_PEERS:$FORGER_MAXCONNECTIONS'\ +'$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT:$ONLY_CONNECT_TO_KNOWN_PEERS:$FORGER_MAXCONNECTIONS:$FORGER_REWARD_ADDRESS'\ export SUBST envsubst "${SUBST}" < /sidechain/config/sc_settings.conf.tmpl > /sidechain/config/sc_settings.conf diff --git a/dockerfiles/evmapp/sc_settings.conf.tmpl b/dockerfiles/evmapp/sc_settings.conf.tmpl index adb6ce5..8d5f9c3 100644 --- a/dockerfiles/evmapp/sc_settings.conf.tmpl +++ b/dockerfiles/evmapp/sc_settings.conf.tmpl @@ -82,7 +82,7 @@ sparkz { forger { automaticForging = $SCNODE_FORGER_ENABLED restrictForgers = $SCNODE_FORGER_RESTRICT - allowedForgersList = [$SCNODE_ALLOWED_FORGERS] + allowedForgersList = [$SCNODE_ALLOWED_FORGERS]$FORGER_REWARD_ADDRESS } remoteKeysManager { From e988dd9963316346b6f4c09dbe964ee08552e085 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Fri, 16 Feb 2024 18:15:10 +0100 Subject: [PATCH 25/38] added description of forgerRewardAddress property --- doc/release/1.3.0.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index cc81c41..1d03f1a 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -3,5 +3,20 @@ ## Notes about new/updated Features +### Forger reward address +For forger nodes: it is now possible to specify a custom address where the block reward will be directed.
+The address will be put inside every new block forged by the node.
+(Previously the first address on the local wallet was taken automatically, without the possibility to specify a different one).
+Any EON address can be specified (included a smart contract address). The private key does not need to be imported in the local wallet. + +How to specify it: +- inside the config file, add a property like this inside the *forger* section: + + forgerRewardAddress = "xxxxxxxxx" + +- if using docker, configure the env property SC_NODE_FORGER_REWARD_ADDRESS + + + --- Full [Changelog](/CHANGELOG.md) available. \ No newline at end of file From 7c76d52a6cb9b39cdf76c09449c67dd404c8ef43 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Mon, 19 Feb 2024 10:13:12 +0100 Subject: [PATCH 26/38] native stakes sc documentation update --- doc/nativesc/contracts/ForgerStakes.json | 73 +++++++++++++++++-- doc/nativesc/contracts/ForgerStakes.md | 10 ++- doc/nativesc/contracts/ForgerStakes.sol | 6 +- .../java/io/horizen/eon/forks/F5Fork.java | 2 +- 4 files changed, 81 insertions(+), 10 deletions(-) diff --git a/doc/nativesc/contracts/ForgerStakes.json b/doc/nativesc/contracts/ForgerStakes.json index b10a2c3..fa280d1 100644 --- a/doc/nativesc/contracts/ForgerStakes.json +++ b/doc/nativesc/contracts/ForgerStakes.json @@ -173,6 +173,67 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "int32", + "name": "startIndex", + "type": "int32" + }, + { + "internalType": "int32", + "name": "pageSize", + "type": "int32" + } + ], + "name": "getPagedForgersStakes", + "outputs": [ + { + "internalType": "int32", + "name": "", + "type": "int32" + }, + { + "components": [ + { + "internalType": "StakeID", + "name": "stakeId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "stakedAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "publicKey", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "vrf1", + "type": "bytes32" + }, + { + "internalType": "bytes1", + "name": "vrf2", + "type": "bytes1" + } + ], + "internalType": "struct ForgerStakes.StakeInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -181,22 +242,22 @@ "type": "address" }, { - "internalType": "uint32", + "internalType": "int32", "name": "startIndex", - "type": "uint32" + "type": "int32" }, { - "internalType": "uint32", + "internalType": "int32", "name": "pageSize", - "type": "uint32" + "type": "int32" } ], "name": "getPagedForgersStakesByUser", "outputs": [ { - "internalType": "uint32", + "internalType": "int32", "name": "", - "type": "uint32" + "type": "int32" }, { "components": [ diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index d91fb5b..3e3ed10 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -53,9 +53,17 @@ This native smart contract manages the forger stakes. the number identifying the new storage version (1 => Version 2). It emits a StakeUpgrade event, with the storage versions before and after the upgrade. +- getPagedForgersStakes + + function function getPagedForgersStakes(int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); + + Returns the first "pageSize" forger stakes, starting from "startIndex". In case there + are additional stakes left, it returns the index of the first of the remaining stakes, otherwise it returns -1. + This method requires the Forger Stake storage model version 2, so it will fail if invoked before the “upgrade()” method. + - getPagedForgersStakesByUser - function function getPagedForgersStakesByUser(address owner, uint32 startIndex, uint32 pageSize) external view returns (uint32, StakeInfo[] memory); + function function getPagedForgersStakesByUser(address owner, int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); Returns the first "pageSize" forger stakes, owned by the specified address, starting from "startIndex". In case there are additional stakes left, it returns the index of the first of the remaining stakes, otherwise it returns -1. diff --git a/doc/nativesc/contracts/ForgerStakes.sol b/doc/nativesc/contracts/ForgerStakes.sol index 0bea974..84cce21 100644 --- a/doc/nativesc/contracts/ForgerStakes.sol +++ b/doc/nativesc/contracts/ForgerStakes.sol @@ -32,9 +32,11 @@ interface ForgerStakes { function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); function stakeOf(address owner) external view returns (uint256); - - function getPagedForgersStakesByUser(address owner, uint32 startIndex, uint32 pageSize) external view returns (uint32, StakeInfo[] memory); + + function getPagedForgersStakesByUser(address owner, int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); function upgrade() external view returns (uint32); + function getPagedForgersStakes(int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); + } diff --git a/node/src/main/java/io/horizen/eon/forks/F5Fork.java b/node/src/main/java/io/horizen/eon/forks/F5Fork.java index 784abdc..0a4dca1 100644 --- a/node/src/main/java/io/horizen/eon/forks/F5Fork.java +++ b/node/src/main/java/io/horizen/eon/forks/F5Fork.java @@ -9,7 +9,7 @@ /** * EON fork 5 (introduced in Version 1.3.0) - * EVM update to Shanghai, Updates to native stake smart contract + * EVM update to Shanghai, Updates to native stake smart contract, Pause forging */ public class F5Fork extends EONFork { public F5Fork(Optional sidechainId) { From f3e3b0bc7b88d5832ef7f0d1bae091b774c72685 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Mon, 19 Feb 2024 10:23:41 +0100 Subject: [PATCH 27/38] additional release notes --- doc/release/1.3.0.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index 1d03f1a..663e2cb 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -14,8 +14,14 @@ How to specify it: forgerRewardAddress = "xxxxxxxxx" -- if using docker, configure the env property SC_NODE_FORGER_REWARD_ADDRESS +- if using docker, you can just configure the env property SC_NODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. +### Pause forging +Please be aware that starting from this version EON block production may temporary pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks any reference to mainchain blocks is present. + +### Stakes native smart contract updates +The stake native smart contract exposes new methods to access the stake list in a paginated way and filtered by address. +Forther info may be found in the [ForgerStakes](../nativesc/contracts/ForgerStakes.md) documentation --- From 17b6d8afded17fbe3cad7b460bdb3d1995a248b7 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Mon, 19 Feb 2024 11:12:13 +0100 Subject: [PATCH 28/38] fixed entrypoint for SCNODE_FORGER_REWARD_ADDRESS + release notes --- doc/release/1.3.0.md | 7 ++++++- dockerfiles/evmapp/entrypoint.sh | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index 663e2cb..b52b4c5 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -14,7 +14,7 @@ How to specify it: forgerRewardAddress = "xxxxxxxxx" -- if using docker, you can just configure the env property SC_NODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. +- if using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. ### Pause forging Please be aware that starting from this version EON block production may temporary pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks any reference to mainchain blocks is present. @@ -23,6 +23,11 @@ Please be aware that starting from this version EON block production may tempora The stake native smart contract exposes new methods to access the stake list in a paginated way and filtered by address. Forther info may be found in the [ForgerStakes](../nativesc/contracts/ForgerStakes.md) documentation +### Custom log4j file support in docker +If using docker, it is now possible to configure the env property SCNODE_LOG4J_CUSTOM_CONFIG to use a completely custom log4j configuration file. See ['Advanced logging customization' + section in this help](../howto/customlog.md) for further info. + + --- Full [Changelog](/CHANGELOG.md) available. \ No newline at end of file diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index 528d0bc..82a24c8 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -213,17 +213,20 @@ if [ "${SCNODE_CERT_SIGNING_ENABLED:-}" = "true" ]; then fi fi - if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ] || [ "${SCNODE_CERT_SUBMITTER_ENABLED:-}" = "true" ]; then if [ -z "${SCNODE_WS_ZEN_FQDN:-}" ]; then echo "Error: Environment variable SCNODE_WS_ZEN_FQDN is required when SCNODE_FORGER_ENABLED=true or SCNODE_CERT_SUBMITTER_ENABLED=true." sleep 5 exit 1 - fi + fi fi -if [ -n "${SC_NODE_FORGER_REWARD_ADDRESS:-}" ]; then - FORGER_REWARD_ADDRESS="$(echo -en "\n forgerRewardAddress = \"${SC_NODE_FORGER_REWARD_ADDRESS}\"")" +if [ -n "${SCNODE_FORGER_REWARD_ADDRESS:-}" ]; then + if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ]; then + FORGER_REWARD_ADDRESS="$(echo -en "\n forgerRewardAddress = \"${SCNODE_FORGER_REWARD_ADDRESS}\"")" + else + echo "Warn: Environment variable SCNODE_FORGER_REWARD_ADDRESS is set but will be ignored since forging is not enabled" + fi fi export FORGER_REWARD_ADDRESS From eedb710aa4de5c3e8b04eab9bb930be87f23997e Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Mon, 19 Feb 2024 11:39:24 +0100 Subject: [PATCH 29/38] review fix --- CHANGELOG.md | 2 +- README.md | 2 +- doc/release/1.3.0.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5197962..e01dd7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.3.0 * SDK dependency updated to version 0.11.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.11.0/CHANGELOG.md)) -* Fork configuration to enable: EVM Update, Forge stake native smart contract new methods, Pause Forging feature +* Fork configuration to enable: EVM Update, Forger stake native smart contract new methods, Pause Forging feature ## 1.2.1 * SDK dependency updated to version 0.10.1 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.10.1/CHANGELOG.md)) diff --git a/README.md b/README.md index 3af622e..11eac85 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Horizen EON is a public proof-of-stake sidechain and a fully EVM-compatible smar [Changelog](/CHANGELOG.md) ### EVM compatibility -Current EVM implementation is based on go-ethereum [Archanes](https://github.com/ethereum/go-ethereum/releases/tag/v1.10.26) (`v1.13.4`).
+Current EVM implementation is based on go-ethereum [Archanes](https://github.com/ethereum/go-ethereum/releases/tag/v1.13.4) (`v1.13.4`).
Solidity compiler is supported up to version `0.8.23`. ### Supported platforms diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index b52b4c5..91c7939 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -17,11 +17,11 @@ How to specify it: - if using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. ### Pause forging -Please be aware that starting from this version EON block production may temporary pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks any reference to mainchain blocks is present. +Please be aware that starting from this version EON block production may temporary pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. ### Stakes native smart contract updates The stake native smart contract exposes new methods to access the stake list in a paginated way and filtered by address. -Forther info may be found in the [ForgerStakes](../nativesc/contracts/ForgerStakes.md) documentation +Further info may be found in the [ForgerStakes](../nativesc/contracts/ForgerStakes.md) documentation ### Custom log4j file support in docker If using docker, it is now possible to configure the env property SCNODE_LOG4J_CUSTOM_CONFIG to use a completely custom log4j configuration file. See ['Advanced logging customization' From bda7aa6de4b0ccf4ecdef21f952e74bd96d34cfa Mon Sep 17 00:00:00 2001 From: paolocappelletti <56390199+paolocappelletti@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:47:50 +0100 Subject: [PATCH 30/38] review fix --- doc/release/1.3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index 91c7939..d718ff1 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -17,7 +17,7 @@ How to specify it: - if using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. ### Pause forging -Please be aware that starting from this version EON block production may temporary pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. +Please be aware that starting from this version EON block production may temporarily pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. ### Stakes native smart contract updates The stake native smart contract exposes new methods to access the stake list in a paginated way and filtered by address. @@ -30,4 +30,4 @@ If using docker, it is now possible to configure the env property SCNODE_LOG4J_C --- -Full [Changelog](/CHANGELOG.md) available. \ No newline at end of file +Full [Changelog](/CHANGELOG.md) available. From 7f4aaeff6db7e72d73f72d0fdd74536a481babd9 Mon Sep 17 00:00:00 2001 From: paolocappelletti <56390199+paolocappelletti@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:49:12 +0100 Subject: [PATCH 31/38] review fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e01dd7e..c8c56bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ ## 1.0.0 * SDK dependency updated to version 0.8.0 -* Fork configuration to enable decentralized governance (ZenDao) and change consensus parameters (consensus epoch slot time and lenght, acrive slot coefficient) +* Fork configuration to enable decentralized governance (ZenDao) and change consensus parameters (consensus epoch slot time and length, active slot coefficient) * Introduced a delay of 6 blocks in the inclusion of the mainchain blocks ## 0.2.1 From 669b16cab4aa0be2389aa38b0ea3f7fe2c2ec19f Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 20 Feb 2024 11:51:41 +0100 Subject: [PATCH 32/38] fix entorypoint for 1.3 --- dockerfiles/evmapp/entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index 82a24c8..2d0ce2f 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -387,7 +387,11 @@ path_to_jemalloc="$(ldconfig -p | grep "$(arch)" | grep 'libjemalloc\.so\.2$' | export LD_PRELOAD="${path_to_jemalloc}:${LD_PRELOAD}" if [ "${1}" = "/usr/bin/true" ]; then - set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' "${LOG4J_CUSTOM_CONFIG}" "$SC_MAIN_CLASS" "$SC_CONF_PATH" + if [ -z "${LOG4J_CUSTOM_CONFIG:-}" ]; then + set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' "$SC_MAIN_CLASS" "$SC_CONF_PATH" + else + set -- java -cp '/sidechain/'"${SC_JAR_NAME}"'-'"${SC_VERSION}"'.jar:/sidechain/lib/*' "${LOG4J_CUSTOM_CONFIG}" "$SC_MAIN_CLASS" "$SC_CONF_PATH" + fi fi echo "Username: ${USERNAME}, UID: ${CURRENT_UID}, GID: ${CURRENT_GID}" From 0a5dfaa3bdcbf1570b3eb3ea04be1118789a7c0f Mon Sep 17 00:00:00 2001 From: Yuri Sibirski <31861444+ysibirski@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:10:25 -0500 Subject: [PATCH 33/38] Adding CPU flag check for evmapp entrypoint.sh (#95) * Adding CPU flag check for evmapp entrypoint.sh --- dockerfiles/evmapp/entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dockerfiles/evmapp/entrypoint.sh b/dockerfiles/evmapp/entrypoint.sh index 2d0ce2f..9d1be79 100755 --- a/dockerfiles/evmapp/entrypoint.sh +++ b/dockerfiles/evmapp/entrypoint.sh @@ -1,6 +1,14 @@ #!/bin/bash set -eEuo pipefail +# check if this is an unsupported CPU, warn the user and bail +if ! grep -iq adx /proc/cpuinfo || ! grep -iq bmi2 /proc/cpuinfo; then + echo "Error: the host does not support the required 'adx' and 'bmi2' CPU flags. The application cannot run on older CPUs. Exiting..." + sleep 5 + exit 1 +fi + + USER_ID="${LOCAL_USER_ID:-9001}" GRP_ID="${LOCAL_GRP_ID:-9001}" LD_PRELOAD="${LD_PRELOAD:-}" From 67ed4c1eaf65b753596e50554c0b703f2728d3a5 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Mon, 4 Mar 2024 18:04:29 +0100 Subject: [PATCH 34/38] added 1.3 fork heights for mainnet and testnet --- node/src/main/java/io/horizen/eon/forks/F5Fork.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node/src/main/java/io/horizen/eon/forks/F5Fork.java b/node/src/main/java/io/horizen/eon/forks/F5Fork.java index 0a4dca1..c36c83b 100644 --- a/node/src/main/java/io/horizen/eon/forks/F5Fork.java +++ b/node/src/main/java/io/horizen/eon/forks/F5Fork.java @@ -22,17 +22,17 @@ protected int getActivationRegtest() { } @Override protected int getActivationTestnetPregobi() {return 2007;} //estimated start at WED 21 Feb 2024 13:01 Milano time - + @Override protected int getActivationTestnetGobi() { - return 1000000; //TODO + return 2101; //estimated start at TUE 12 March 2024 07:51 Milano time } @Override - protected int getActivationTestnet() { return 1000000; //TODO + protected int getActivationTestnet() { return 2101; //not used } @Override protected int getActivationMainnet() { - return 1000000; ///TODO + return 1405; //estimated start at THU 21 March 2024 18:55 Milano time } @Override From 9c4a40a8cc011a41c539408209b42a4937d8781f Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Tue, 5 Mar 2024 10:21:47 +0100 Subject: [PATCH 35/38] bump versions --- bootstraptool/pom.xml | 6 +++--- node/pom.xml | 4 ++-- pom.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bootstraptool/pom.xml b/bootstraptool/pom.xml index 23c7f6c..abef513 100644 --- a/bootstraptool/pom.xml +++ b/bootstraptool/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen bootstraptool - 1.3.0-SNAPSHOT + 1.3.0 2023 UTF-8 @@ -16,12 +16,12 @@ io.horizen sidechains-sdk-account_sctools - 0.11.0-SNAPSHOT + 0.11.0 io.horizen eon - 1.3.0-SNAPSHOT + 1.3.0 compile diff --git a/node/pom.xml b/node/pom.xml index c17191a..0934482 100644 --- a/node/pom.xml +++ b/node/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen eon - 1.3.0-SNAPSHOT + 1.3.0 2023 UTF-8 @@ -11,7 +11,7 @@ 11 3.8.1 3.1.1 - 0.11.0-SNAPSHOT + 0.11.0 diff --git a/pom.xml b/pom.xml index 2a4a748..5b8488d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.horizen eonproject - 1.3.0-SNAPSHOT + 1.3.0 pom 2023 From fdea33f84f1e9ff5e749f8d4efc9a36edd89773a Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 6 Mar 2024 12:02:02 +0100 Subject: [PATCH 36/38] updated release notes (moved some of them to SDK) --- doc/release/1.3.0.md | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index d718ff1..af53411 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -2,32 +2,18 @@ --- ## Notes about new/updated Features +The 1.3.0 version has been updated to the 0.11.0 SDK version, which introduces several additions: refer to [SDK release notes](https://github.com/HorizenOfficial/Sidechains-SDK/tree/dev/doc/release/0.11.0.md) for a detailed explanation. ### Forger reward address -For forger nodes: it is now possible to specify a custom address where the block reward will be directed.
-The address will be put inside every new block forged by the node.
-(Previously the first address on the local wallet was taken automatically, without the possibility to specify a different one).
-Any EON address can be specified (included a smart contract address). The private key does not need to be imported in the local wallet. - -How to specify it: -- inside the config file, add a property like this inside the *forger* section: - - forgerRewardAddress = "xxxxxxxxx" - -- if using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. - -### Pause forging -Please be aware that starting from this version EON block production may temporarily pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. - -### Stakes native smart contract updates -The stake native smart contract exposes new methods to access the stake list in a paginated way and filtered by address. -Further info may be found in the [ForgerStakes](../nativesc/contracts/ForgerStakes.md) documentation +See SDK release notes for an exmlanation of the feature. +If using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. ### Custom log4j file support in docker If using docker, it is now possible to configure the env property SCNODE_LOG4J_CUSTOM_CONFIG to use a completely custom log4j configuration file. See ['Advanced logging customization' section in this help](../howto/customlog.md) for further info. - - + + ### Pause forging +Please be aware that starting from this version EON block production may temporarily pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. --- Full [Changelog](/CHANGELOG.md) available. From 8582edfbc4b21ea15da08a5393d3a8783b8c2ff2 Mon Sep 17 00:00:00 2001 From: paolocappelletti Date: Wed, 6 Mar 2024 12:03:33 +0100 Subject: [PATCH 37/38] fixed typo --- doc/release/1.3.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/release/1.3.0.md b/doc/release/1.3.0.md index af53411..b7c28b5 100644 --- a/doc/release/1.3.0.md +++ b/doc/release/1.3.0.md @@ -5,13 +5,13 @@ The 1.3.0 version has been updated to the 0.11.0 SDK version, which introduces several additions: refer to [SDK release notes](https://github.com/HorizenOfficial/Sidechains-SDK/tree/dev/doc/release/0.11.0.md) for a detailed explanation. ### Forger reward address -See SDK release notes for an exmlanation of the feature. +See SDK release notes for an explanation of the feature. If using docker, you can just configure the env property SCNODE_FORGER_REWARD_ADDRESS: the config file will be automatically generated accordingly. ### Custom log4j file support in docker If using docker, it is now possible to configure the env property SCNODE_LOG4J_CUSTOM_CONFIG to use a completely custom log4j configuration file. See ['Advanced logging customization' section in this help](../howto/customlog.md) for further info. - + ### Pause forging Please be aware that starting from this version EON block production may temporarily pause if the mainchain block production slows down: EON forgers will automatically stop to produce new blocks if in the latest 99 EON Blocks no reference to mainchain blocks is present. From 09af2408dd31b74232801560da95698384620bee Mon Sep 17 00:00:00 2001 From: saratnt Date: Wed, 6 Mar 2024 15:47:51 +0100 Subject: [PATCH 38/38] Fix Solidity signature for upgrade() method --- doc/nativesc/contracts/ForgerStakes.json | 2 +- doc/nativesc/contracts/ForgerStakes.md | 2 +- doc/nativesc/contracts/ForgerStakes.sol | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/nativesc/contracts/ForgerStakes.json b/doc/nativesc/contracts/ForgerStakes.json index fa280d1..d297f32 100644 --- a/doc/nativesc/contracts/ForgerStakes.json +++ b/doc/nativesc/contracts/ForgerStakes.json @@ -358,7 +358,7 @@ "type": "uint32" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { diff --git a/doc/nativesc/contracts/ForgerStakes.md b/doc/nativesc/contracts/ForgerStakes.md index 3e3ed10..f85d9bc 100644 --- a/doc/nativesc/contracts/ForgerStakes.md +++ b/doc/nativesc/contracts/ForgerStakes.md @@ -47,7 +47,7 @@ This native smart contract manages the forger stakes. - upgrade - function upgrade() external view returns (uint32); + function upgrade() external returns (uint32); This method upgrades the model of the forger stakes storage. It can be called just once. If successful, it returns the number identifying the new storage version (1 => Version 2). It emits a StakeUpgrade event, with the storage diff --git a/doc/nativesc/contracts/ForgerStakes.sol b/doc/nativesc/contracts/ForgerStakes.sol index 84cce21..b035515 100644 --- a/doc/nativesc/contracts/ForgerStakes.sol +++ b/doc/nativesc/contracts/ForgerStakes.sol @@ -35,8 +35,7 @@ interface ForgerStakes { function getPagedForgersStakesByUser(address owner, int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); - function upgrade() external view returns (uint32); + function upgrade() external returns (uint32); function getPagedForgersStakes(int32 startIndex, int32 pageSize) external view returns (int32, StakeInfo[] memory); - }