diff --git a/README.md b/README.md index d804449bb..09e2cfe35 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## Welcome to NULS! ## +NULS — Making It Easier To Innovate ## Introduction @@ -60,11 +61,9 @@ Note: The command will automatically end when all modules are started. Stay tuned -## Explorer and Web Wallet +## Explorer -Explorer URL: [http://beta.nulscan.io/](http://beta.nulscan.io/) - -Web Wallet: [http://beta.wallet.nuls.io/](http://beta.wallet.nuls.io/) +Explorer URL: [https://nulscan.io/](https://nulscan.io/) ## ChainBox Tutorial @@ -72,18 +71,6 @@ Please check the following documents: [https://docs.nuls.io/NULS2.0/chainBoxGuide.html](https://docs.nuls.io/NULS2.0/chainBoxGuide.html) -## Debug - -Stay tuned - -## Configuration - -Stay tuned - -## Interfaces - -Stay tuned - ## Modules Description Please check the following documents: @@ -101,15 +88,11 @@ Contributions to NULS are welcomed! We sincerely invite developers who are exper Nuls is released under the [MIT](http://opensource.org/licenses/MIT) license. Modules added in the future may be released under a different license specified in their module library path. -## Community +## Contact Us -- [nuls.io](https://nuls.io/) -- [@Twitter](https://twitter.com/nulsservice) +- [Discord](https://discord.com/invite/aRCwbj47WN/) +- [Website](https://nuls.io/) +- [Telegram](https://t.me/Nulsio/) +- [Reddit](https://www.reddit.com/r/nulsservice/) +- [Twitter](https://twitter.com/Nuls/) - [Facebook](https://www.facebook.com/nulscommunity/) -- [YouTube channel](https://www.youtube.com/channel/UC8FkLeF4QW6Undm4B3InN1Q?view_as=subscriber) -- Telegram [NULS Community](https://t.me/Nulsio) -- Telegram [NULS 中文社区](https://t.me/Nulscn) - -#### - -test diff --git a/module/nuls-cores/src/main/java/io/nuls/block/constant/Constant.java b/module/nuls-cores/src/main/java/io/nuls/block/constant/Constant.java index 695d56dea..6f710ebc3 100644 --- a/module/nuls-cores/src/main/java/io/nuls/block/constant/Constant.java +++ b/module/nuls-cores/src/main/java/io/nuls/block/constant/Constant.java @@ -17,7 +17,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - package io.nuls.block.constant; import io.nuls.base.data.Block; diff --git a/module/nuls-cores/src/main/java/io/nuls/contract/config/ContractContext.java b/module/nuls-cores/src/main/java/io/nuls/contract/config/ContractContext.java index 2ebe38ec5..a3e19fd46 100644 --- a/module/nuls-cores/src/main/java/io/nuls/contract/config/ContractContext.java +++ b/module/nuls-cores/src/main/java/io/nuls/contract/config/ContractContext.java @@ -86,6 +86,7 @@ public class ContractContext { public static short PROTOCOL_14 = 14; public static short PROTOCOL_15 = 15; public static short PROTOCOL_16 = 16; + public static short PROTOCOL_17 = 17; private static final LoadingCache CONTRACT_INFO_CACHE; private static ContractHelper contractHelper; diff --git a/module/nuls-cores/src/main/java/io/nuls/contract/vm/natives/io/nuls/contract/sdk/NativeUtils.java b/module/nuls-cores/src/main/java/io/nuls/contract/vm/natives/io/nuls/contract/sdk/NativeUtils.java index fb1bfce30..37aeb292a 100644 --- a/module/nuls-cores/src/main/java/io/nuls/contract/vm/natives/io/nuls/contract/sdk/NativeUtils.java +++ b/module/nuls-cores/src/main/java/io/nuls/contract/vm/natives/io/nuls/contract/sdk/NativeUtils.java @@ -595,6 +595,12 @@ private static Result invokeExternalCmd(MethodCode methodCode, MethodArgs method String[] args = (String[]) frame.heap.getObject(argsRef); return getAddressByPublicKey(args, methodCode, frame); } + } else if ("keccak".equals(cmdName)) { + // add by pierre at 2023/10/07 p17 + if(ProtocolGroupManager.getCurrentVersion(currentChainId) >= ContractContext.PROTOCOL_17 ) { + String[] args = (String[]) frame.heap.getObject(argsRef); + return keccak(args, methodCode, frame); + } } String[] args = (String[]) frame.heap.getObject(argsRef); @@ -690,6 +696,18 @@ private static Result getCodeHash(String[] args, MethodCode methodCode, Frame fr } } + private static Result keccak(String[] args, MethodCode methodCode, Frame frame) { + try { + String hex = args[0]; + String resultStr = KeccakHash.keccak(hex); + Object resultValue = frame.heap.newString(resultStr); + Result result = NativeMethod.result(methodCode, resultValue, frame); + return result; + } catch (Exception e) { + throw new ErrorException("Invoke external cmd failed. When keccak.", frame.vm.getGasUsed(), e.getMessage()); + } + } + private static Result getAddressByPublicKey(String[] args, MethodCode methodCode, Frame frame) { try { int currentChainId = frame.vm.getProgramExecutor().getCurrentChainId(); diff --git a/module/nuls-cores/src/main/resources/protocol/versions.json b/module/nuls-cores/src/main/resources/protocol/versions.json index 595c8e227..a8141fb11 100644 --- a/module/nuls-cores/src/main/resources/protocol/versions.json +++ b/module/nuls-cores/src/main/resources/protocol/versions.json @@ -78,5 +78,10 @@ "version": "16", "effectiveRatio": "80", "continuousIntervalCount": "10" + }, + { + "version": "17", + "effectiveRatio": "80", + "continuousIntervalCount": "10" } ] \ No newline at end of file diff --git a/module/nuls-cores/src/test/java/io/nuls/block/BlockGeneratorTest.java b/module/nuls-cores/src/test/java/io/nuls/block/BlockGeneratorTest.java deleted file mode 100644 index da52dc09f..000000000 --- a/module/nuls-cores/src/test/java/io/nuls/block/BlockGeneratorTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * MIT License - * Copyright (c) 2017-2019 nuls.io - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package io.nuls.block; - -import io.nuls.base.data.Block; -import io.nuls.base.data.NulsHash; -import io.nuls.block.model.GenesisBlock; -import io.nuls.block.test.BlockGenerator; -import org.junit.Assert; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -public class BlockGeneratorTest { - - /** - * 测试区块生成器生成区块的连续性 - * @throws Exception - */ - @Test - public void generate() throws Exception { - int start = 1; - int count = 10; - List blocks = new ArrayList<>(); - - GenesisBlock genesisBlock = GenesisBlock.getInstance(0, 0); - blocks.add(genesisBlock); - - Block preBlock = genesisBlock; - do{ - Block block = BlockGenerator.generate(preBlock); - blocks.add(block); - preBlock = block; - start++; - } while (start < count); - - for (int i = 0; i < blocks.size()-1; i++) { - NulsHash prehash = blocks.get(i).getHeader().getHash(); - NulsHash hash = blocks.get(i+1).getHeader().getPreHash(); - Assert.assertEquals(prehash, hash); - } - } - - /** - * 测试区块生成器生成区块的分叉 - * @throws Exception - */ - @Test - public void fork() throws Exception { - Block root = BlockGenerator.generate(null); - Block block1 = BlockGenerator.generate(root, 1, "1"); - Block block2 = BlockGenerator.generate(root, 2, "1"); - Assert.assertEquals(root.getHeader().getHash(), block1.getHeader().getPreHash()); - Assert.assertEquals(block1.getHeader().getPreHash(), block2.getHeader().getPreHash()); - Assert.assertNotEquals(block1.getHeader().getHash(), block2.getHeader().getHash()); - } -} \ No newline at end of file diff --git a/version b/version index 90c94814e..d76bd2ba3 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.16.2 \ No newline at end of file +2.17.0