diff --git a/.gitignore b/.gitignore
index 3d251ce..bf4d05a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,9 +27,9 @@ block-signer-config.json
/ton-node-se/pub-key
/ton-node-se/log_cfg.yml
/ton-node-se/tonos-se-tests
-workchains
docker/.DS_Store
readme.html
/dev/node_modules/
/dev/package-lock.json
/node/target/
+/target/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5d3f1d..da8fa73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,19 @@
# Release Notes
All notable changes to this project will be documented in this file.
+## 0.37.0 Jan 11, 2023
+
+### New
+
+- Produces masterchain block for each workchain block.
+- Added ability to update blockchain config with node restart (without killing the database). After [changing the config](https://github.com/tonlabs/evernode-se#how-to-change-the-blockchain-configuration) stop and start the node to apply it. It will produce new key block from the new config.
+- `CapSignatureWithId` capability is supported: `global_id` parameter is used as a `signature_id` if `CapSignatureWithId` cap is turned
+ on in the blockchain config.
+
+### Fixed
+- `global_id` parameter in `ton-node.conf.json` is written into blocks.
+
+
## 0.36.3 Jan 11, 2023
### Fixed
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..c84c873
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,7 @@
+[workspace]
+members = [
+ "node",
+]
+
+exclude = [
+]
diff --git a/contracts/README.md b/contracts/README.md
index 2111274..6f88f7d 100644
--- a/contracts/README.md
+++ b/contracts/README.md
@@ -1,5 +1,10 @@
# Smart Contracts, used in Evernode SE
-* [Giver v2](giver_v2)
-* [SafeMultisig Wallet](safe_multisig)
+
+|Giver type | Address | Comment
+| --------------- | -------------------------------------------------------------------|------
+| [GiverV3](giver_v3) | 0:96137b99dcd65afce5a54a48dac83c0fd276432abbe3ba7f1bfb0fb795e69025 | Recommented Giver version
+| [SafeMultisig](safe_multisig) | 0:d5f5cfc4b52d2eb1bd9d3a8e51707872c7ce0c174facddd0e06ae5ffd17d2fcd | Safe Multisig as Giver.
+| [GiverV2](giver_v2) | 0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415 | Deprecated. Recommended to use GiverV3
+| GiverV1 | 0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94 | Deprecated. Recommended to use GiverV3
diff --git a/contracts/giver_v2/README.md b/contracts/giver_v2/README.md
index 727f6a3..00dddab 100644
--- a/contracts/giver_v2/README.md
+++ b/contracts/giver_v2/README.md
@@ -1,11 +1,12 @@
# Giver v2
-This directory contains Giver v2 (ABI v2) contract. This giver is recommended over Giver v1 because ABI v1 is deprecated.
+This directory contains Giver v2 (ABI v2) contract.
In Evernode SE this giver is predeployed at `0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415` address
and its initial balance is about 5 billion tokens.
-If you want to compile and deploy your own v2 giver you can find its fresh version in `giver_for_Sol_0.59.0_abi.2.2` folder that is compatible with the latest compiler version. We do not deploy this giver to SE because it has the same ABI, but will cause a breaking change because a lot of tools and scripts use the old `0:ece57bc...` address.
+It is not recommented to use in production or recompile Giver V2 because its works on old Solidity version.
+If you want to make changes to the Giver contract or use it in production - use [Giver V3](../giver_v3) version which can be successfully compiled with the latest Solidity compiler.
## Keys:
* Public: `2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16`
@@ -24,7 +25,7 @@ parameters:
tonos-cli call 0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415 \
sendTransaction '{"dest":"
","value":,"bounce":false}' \
--abi GiverV2.abi.json \
- --sign GiverV2.keys.json
+ --sign seGiver.keys.json
```
diff --git a/contracts/giver_v2/GiverV2.keys.json b/contracts/giver_v2/seGiver.keys.json
similarity index 100%
rename from contracts/giver_v2/GiverV2.keys.json
rename to contracts/giver_v2/seGiver.keys.json
diff --git a/contracts/giver_v3/GiverV3.abi.json b/contracts/giver_v3/GiverV3.abi.json
index a75bcf7..7749f9f 100644
--- a/contracts/giver_v3/GiverV3.abi.json
+++ b/contracts/giver_v3/GiverV3.abi.json
@@ -1,49 +1,49 @@
{
- "ABI version": 2,
- "version": "2.2",
- "header": ["time", "expire"],
- "functions": [
- {
- "name": "sendTransaction",
- "inputs": [
- {"name":"dest","type":"address"},
- {"name":"value","type":"uint128"},
- {"name":"bounce","type":"bool"}
- ],
- "outputs": [
- ]
- },
- {
- "name": "getMessages",
- "inputs": [
- ],
- "outputs": [
- {"components":[{"name":"hash","type":"uint256"},{"name":"expireAt","type":"uint64"}],"name":"messages","type":"tuple[]"}
- ]
- },
- {
- "name": "upgrade",
- "inputs": [
- {"name":"newcode","type":"cell"}
- ],
- "outputs": [
- ]
- },
- {
- "name": "constructor",
- "inputs": [
- ],
- "outputs": [
- ]
- }
- ],
- "data": [
- ],
- "events": [
- ],
- "fields": [
- {"name":"_pubkey","type":"uint256"},
- {"name":"_constructorFlag","type":"bool"},
- {"name":"m_messages","type":"map(uint256,uint64)"}
- ]
+ "ABI version": 2,
+ "version": "2.3",
+ "header": ["time", "expire"],
+ "functions": [
+ {
+ "name": "sendTransaction",
+ "inputs": [
+ {"name":"dest","type":"address"},
+ {"name":"value","type":"uint128"},
+ {"name":"bounce","type":"bool"}
+ ],
+ "outputs": [
+ ]
+ },
+ {
+ "name": "getMessages",
+ "inputs": [
+ ],
+ "outputs": [
+ {"components":[{"name":"hash","type":"uint256"},{"name":"expireAt","type":"uint32"}],"name":"messages","type":"tuple[]"}
+ ]
+ },
+ {
+ "name": "upgrade",
+ "inputs": [
+ {"name":"newcode","type":"cell"}
+ ],
+ "outputs": [
+ ]
+ },
+ {
+ "name": "constructor",
+ "inputs": [
+ ],
+ "outputs": [
+ ]
+ }
+ ],
+ "data": [
+ ],
+ "events": [
+ ],
+ "fields": [
+ {"name":"_pubkey","type":"uint256"},
+ {"name":"_constructorFlag","type":"bool"},
+ {"name":"m_messages","type":"map(uint256,uint32)"}
+ ]
}
diff --git a/contracts/giver_v3/GiverV3.sol b/contracts/giver_v3/GiverV3.sol
index 5f08ed4..c1f69e1 100644
--- a/contracts/giver_v3/GiverV3.sol
+++ b/contracts/giver_v3/GiverV3.sol
@@ -1,4 +1,4 @@
-pragma ton-solidity >= 0.59.0;
+pragma ever-solidity >= 0.61.2;
pragma AbiHeader time;
pragma AbiHeader expire;
@@ -22,7 +22,7 @@ abstract contract Upgradable {
contract GiverV3 is Upgradable {
uint8 constant MAX_CLEANUP_MSGS = 30;
- mapping(uint256 => uint64) m_messages;
+ mapping(uint256 => uint32) m_messages;
modifier acceptOnlyOwner {
require(msg.pubkey() == tvm.pubkey(), 101);
@@ -49,19 +49,19 @@ contract GiverV3 is Upgradable {
/// @notice Function with predefined name called after signature check. Used to
/// implement custom replay protection with parallel access.
- function afterSignatureCheck(TvmSlice body, TvmCell message) private inline
+ function afterSignatureCheck(TvmSlice body, TvmCell) private inline
returns (TvmSlice)
{
// owner check
require(msg.pubkey() == tvm.pubkey(), 101);
+ uint256 bodyHash = tvm.hash(body);
// load and drop message timestamp (uint64)
- (, uint64 expireAt) = body.decode(uint64, uint32);
+ (, uint32 expireAt) = body.decode(uint64, uint32);
require(expireAt > now, 57);
- uint256 msgHash = tvm.hash(message);
- require(!m_messages.exists(msgHash), 102);
+ require(!m_messages.exists(bodyHash), 102);
tvm.accept();
- m_messages[msgHash] = expireAt;
+ m_messages[bodyHash] = expireAt;
return body;
}
@@ -69,13 +69,13 @@ contract GiverV3 is Upgradable {
/// @notice Allows to delete expired messages from dict.
function gc() private inline {
uint counter = 0;
- for ((uint256 msgHash, uint64 expireAt) : m_messages) {
+ for ((uint256 bodyHash, uint32 expireAt) : m_messages) {
if (counter >= MAX_CLEANUP_MSGS) {
break;
}
counter++;
if (expireAt <= now) {
- delete m_messages[msgHash];
+ delete m_messages[bodyHash];
}
}
}
@@ -85,10 +85,10 @@ contract GiverV3 is Upgradable {
*/
struct Message {
uint256 hash;
- uint64 expireAt;
+ uint32 expireAt;
}
function getMessages() public view returns (Message[] messages) {
- for ((uint256 msgHash, uint64 expireAt) : m_messages) {
+ for ((uint256 msgHash, uint32 expireAt) : m_messages) {
messages.push(Message(msgHash, expireAt));
}
}
diff --git a/contracts/giver_v3/GiverV3.tvc b/contracts/giver_v3/GiverV3.tvc
index 8e31859..96a3c21 100644
Binary files a/contracts/giver_v3/GiverV3.tvc and b/contracts/giver_v3/GiverV3.tvc differ
diff --git a/contracts/giver_v3/README.md b/contracts/giver_v3/README.md
index 056cd5d..fdab8c1 100644
--- a/contracts/giver_v3/README.md
+++ b/contracts/giver_v3/README.md
@@ -1,14 +1,11 @@
# Giver v3
-This directory contains Giver v3 (ABI v2.2) contract. This giver is recommended over Giver v1 or v2.
+This directory contains Giver v3 contract. This giver is recommended to use with solc version above 0.61.2 to deploy it on devnet or mainnet.
-In Evernode SE this giver is predeployed (since version `TODO`) at `0:78fbd6980c10cf41401b32e9b51810415e7578b52403af80dae68ddf99714498` address
+In Evernode SE this giver is predeployed at `0:96137b99dcd65afce5a54a48dac83c0fd276432abbe3ba7f1bfb0fb795e69025` address
and its initial balance is about 5 billion tokens.
## Keys:
-
-> ⚠ Using only local and dev environment
-
* Public: `2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16`
* Secret: `172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3`
@@ -21,46 +18,72 @@ parameters:
* `bounce`: `bool` - bounce flag of the message.
### Using tonos-cli:
-```shell
-npx tonos-cli call 0:78fbd6980c10cf41401b32e9b51810415e7578b52403af80dae68ddf99714498 \
+```commandline
+tonos-cli call 0:cbd3ef42dcc261b9369fdb15fb836b460d4806c5b255e31541c46d6676a2f13d \
sendTransaction '{"dest":"","value":,"bounce":false}' \
- --abi GiverV2.abi.json \
- --sign GiverV2.keys.json
+ --abi GiverV3.abi.json \
+ --sign seGiver.keys.json
```
-## Self deploy
+## How to deploy GiverV3 on any network
-### Compile
+### Setup your signer
+You can skip this step if you already have one.
```shell
-npx everdev sol set --compiler 0.59.4 --linker 0.15.24
-npx everdev sol compile GiverV3.sol
+npx everdev signer add devnet_giver_keys
+npx everdev signer default devnet_giver_keys
```
-> ℹ️ For compiler v0.59.4 and linker v0.15.2 code hash is `726aec999006a2e036af36c46024237acb946c13b4d4b3e1ad3b4ad486d564b1`
+### [Optional] Verify Giver contract bytecode
+This contract is compiled with `0.66.0 ` Solidity and `0.19.3`Linker version.
+
+To check that the code hash of the compiled version from repository is equal to your freshly compiled version, run this command and check that the *Code Hash* is
+`57a1e5e4304f4db2beb23117e4d85df9cb5caec127531350e73219a8b8dc8afd`.
-### Setup yore signer
```shell
-npx everdev signer add
-npx everdev signer default
+npx everdev sol set --compiler 0.66.0 --linker 0.19.3
+npx everdev sol compile GiverV3.sol
+npx everdev contract info --signer devnet_giver_keys GiverV3
+
+Configuration
+
+ Network: se (http://localhost)
+ Signer: devnet_giver_keys (public 7fbbd813ac8358ed2d8598de156eb62bdddf5191d6ce4a0f307d4eac8d4c8e16)
+
+Address: 0:dd39b607834a23f7091d4d6d8982c6269c1d71f1b512757cf4d298325a550b6a (calculated from TVC and signer public)
+Code Hash: 57a1e5e4304f4db2beb23117e4d85df9cb5caec127531350e73219a8b8dc8afd (from TVC file)
```
-### Get `` and topup it
+### Get your Giver address and top it up
+The address is calculated from the compiled contract codehash and your public key.
+Run this command to see the *Address*:
```shell
-npx everdev contract info GiverV3
+npx everdev contract info --signer devnet_giver_keys GiverV3
```
+Now, you need to top up your giver. Transfer tokens from Surf wallet or Everwallet.
-### Deploy
+
+### Deploy your Giver
+After you topped up Giver address, you can deploy it.
+Run this command:
```shell
npx everdev contract deploy GiverV3
```
-### Setup yore Giver
+### Setup your Giver
+Run this command to set up the giver for your network.
+
```shell
-everdev network giver --signer --type GiverV3
+npx everdev network giver --signer --type GiverV3
+```
+
+### Using your Giver
+This command under the hood will use predefined signer and configured giver on the default network.
+```
+npx everdev contract topup -a `` -v ``
```
## Files
* ABI: [GiverV3.abi.json](GiverV3.abi.json)
-* Keypair: [GiverV3.keys.json](GiverV3.keys.json)
* Source code: [GiverV3.sol](GiverV3.sol)
* TVC file: [GiverV3.tvc](GiverV3.tvc)
diff --git a/contracts/giver_v3/GiverV3.keys.json b/contracts/giver_v3/seGiver.keys.json
similarity index 100%
rename from contracts/giver_v3/GiverV3.keys.json
rename to contracts/giver_v3/seGiver.keys.json
diff --git a/contracts/giver_v4/.gitignore b/contracts/giver_v4/.gitignore
deleted file mode 100644
index a6c7c28..0000000
--- a/contracts/giver_v4/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.js
diff --git a/contracts/giver_v4/GiverV4.abi.json b/contracts/giver_v4/GiverV4.abi.json
deleted file mode 100644
index 3c1e19d..0000000
--- a/contracts/giver_v4/GiverV4.abi.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "ABI version": 2,
- "version": "2.2",
- "header": ["pubkey", "time", "expire"],
- "functions": [
- {
- "name": "sendTransaction",
- "inputs": [
- {"name":"dest","type":"address"},
- {"name":"value","type":"uint128"},
- {"name":"bounce","type":"bool"}
- ],
- "outputs": [
- ]
- },
- {
- "name": "getMessages",
- "inputs": [
- ],
- "outputs": [
- {"components":[{"name":"hash","type":"uint256"},{"name":"expireAt","type":"uint32"}],"name":"messages","type":"tuple[]"}
- ]
- },
- {
- "name": "upgrade",
- "inputs": [
- {"name":"newcode","type":"cell"}
- ],
- "outputs": [
- ]
- },
- {
- "name": "constructor",
- "inputs": [
- ],
- "outputs": [
- ]
- }
- ],
- "data": [
- ],
- "events": [
- ],
- "fields": [
- {"name":"_pubkey","type":"uint256"},
- {"name":"_constructorFlag","type":"bool"},
- {"name":"m_messages","type":"map(uint256,uint32)"}
- ]
-}
diff --git a/contracts/giver_v4/GiverV4.sol b/contracts/giver_v4/GiverV4.sol
deleted file mode 100644
index b882355..0000000
--- a/contracts/giver_v4/GiverV4.sol
+++ /dev/null
@@ -1,98 +0,0 @@
-pragma ever-solidity >= 0.61.2;
-pragma AbiHeader time;
-pragma AbiHeader expire;
-pragma AbiHeader pubkey;
-
-abstract contract Upgradable {
- /*
- * Set code
- */
-
- function upgrade(TvmCell newcode) public virtual {
- require(msg.pubkey() == tvm.pubkey(), 101);
- tvm.accept();
- tvm.commit();
- tvm.setcode(newcode);
- tvm.setCurrentCode(newcode);
- onCodeUpgrade();
- }
-
- function onCodeUpgrade() internal virtual;
-}
-
-contract GiverV3 is Upgradable {
-
- uint8 constant MAX_CLEANUP_MSGS = 30;
- mapping(uint256 => uint32) m_messages;
-
- modifier acceptOnlyOwner {
- require(msg.pubkey() == tvm.pubkey(), 101);
- tvm.accept();
- _;
- }
-
- /*
- * Publics
- */
-
- /// @notice Allows to accept simple transfers.
- receive() external {}
-
- /// @notice Transfers grams to other contracts.
- function sendTransaction(address dest, uint128 value, bool bounce) public {
- dest.transfer(value, bounce, 3);
- gc();
- }
-
- /*
- * Privates
- */
-
- /// @notice Function with predefined name called after signature check. Used to
- /// implement custom replay protection with parallel access.
- function afterSignatureCheck(TvmSlice body, TvmCell message) private inline
- returns (TvmSlice)
- {
- // owner check
- require(msg.pubkey() == tvm.pubkey(), 101);
- // load and drop message timestamp (uint64)
- (, uint32 expireAt) = body.decode(uint64, uint32);
- require(expireAt > now, 57);
- uint256 msgHash = tvm.hash(message);
- require(!m_messages.exists(msgHash), 102);
-
- tvm.accept();
- m_messages[msgHash] = expireAt;
-
- return body;
- }
-
- /// @notice Allows to delete expired messages from dict.
- function gc() private inline {
- uint counter = 0;
- for ((uint256 msgHash, uint32 expireAt) : m_messages) {
- if (counter >= MAX_CLEANUP_MSGS) {
- break;
- }
- counter++;
- if (expireAt <= now) {
- delete m_messages[msgHash];
- }
- }
- }
-
- /*
- * Get methods
- */
- struct Message {
- uint256 hash;
- uint32 expireAt;
- }
- function getMessages() public view returns (Message[] messages) {
- for ((uint256 msgHash, uint32 expireAt) : m_messages) {
- messages.push(Message(msgHash, expireAt));
- }
- }
-
- function onCodeUpgrade() internal override {}
-}
diff --git a/contracts/giver_v4/GiverV4.tvc b/contracts/giver_v4/GiverV4.tvc
deleted file mode 100644
index 5c880dc..0000000
Binary files a/contracts/giver_v4/GiverV4.tvc and /dev/null differ
diff --git a/contracts/giver_v4/README.md b/contracts/giver_v4/README.md
deleted file mode 100644
index b6acb51..0000000
--- a/contracts/giver_v4/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Giver v4
-
-This directory contains Giver v4 (ABI v2.2) contract. This giver is recommended to use with solc version above 0.61.2 to deploy it on devnet or mainnet.
-
-## Self deploy contract on any network
-
-### Compile Giver contract
-This contract is prepared for compilation by `solc_0_61_2` and `tvm_linker_0_17_3` or above.
-```shell
-npx everdev sol set --compiler 0.61.2 --linker 0.17.3
-npx everdev sol compile GiverV4.sol
-```
-
-### Setup your signer
-You can skip this step if you already have one. But make sure the right signer linked to ``.
-```shell
-npx everdev signer add
-npx everdev signer default
-```
-
-### Get your Giver ``
-The address was calculated using the compiled contract codehash and your public key.
-```shell
-npx everdev contract info GiverV4
-```
-
-### Deploy your Giver
-Before deploy you need to transfer tokens to ``.
-```shell
-npx everdev contract deploy GiverV4
-```
-
-### Setup your Giver
-Before this step, make sure that you have configured the network with the correct endpoint, which contains your evercloud projectId.
-```shell
-npx everdev network giver --signer --type GiverV4
-```
-
-### Using your Giver
-This command under the hood will use predefined signer and configured giver on the default network.
-```
-npx everdev contract topup -a `` -v ``
-```
-
-## Files
-* ABI: [GiverV4.abi.json](GiverV4.abi.json)
-* Source code: [GiverV4.sol](GiverV4.sol)
-* TVC file: [GiverV4.tvc](GiverV4.tvc)
diff --git a/dev/q-server.json b/dev/q-server.json
index fcfb5dd..813c90a 100644
--- a/dev/q-server.json
+++ b/dev/q-server.json
@@ -9,38 +9,38 @@
},
"blockchain": {
"accounts": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"blocks": {
"hot": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"cold": []
},
"transactions": {
"hot": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"cold": []
},
- "zerostate": "http://root@localhost:8529"
+ "zerostate": "http://root@127.0.0.1:8529"
},
"slowQueriesBlockchain": {
"accounts": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"blocks": {
"hot": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"cold": []
},
"transactions": {
"hot": [
- "http://root@localhost:8529"
+ "http://root@127.0.0.1:8529"
],
"cold": []
},
- "zerostate": "http://root@localhost:8529"
+ "zerostate": "http://root@127.0.0.1:8529"
}
}
diff --git a/dev/reset-db.js b/dev/reset-db.js
index 41d8caa..24a86b7 100644
--- a/dev/reset-db.js
+++ b/dev/reset-db.js
@@ -1,7 +1,9 @@
const { Database } = require("arangojs");
+const fs = require("fs");
+const path = require("path");
const config = {
- url: "http://localhost:8529",
+ url: "http://127.0.0.1:8529",
auth: {
username: "root",
password: "",
@@ -21,9 +23,9 @@ const COLLECTIONS = {
"workchain_id, key_block", "seq_no",
"workchain_id, gen_utime",
"workchain_id, tr_count", "gen_utime",
- "mastermin_shard_gen_utime",
- "prev_refroot_hash,_key",
- "prev_alt_refroot_hash,_key",
+ "master.min_shard_gen_utime",
+ "prev_ref.root_hash,_key",
+ "prev_alt_ref.root_hash,_key",
"tr_count, gen_utime",
"chain_order",
"gen_utime, chain_order",
@@ -158,6 +160,12 @@ async function checkCollections(collections) {
try {
await checkBlockchainDb();
await checkCollections(COLLECTIONS);
+ fs.rmSync(path.resolve(__dirname, "..", "docker", "ton-node", "workchains"),
+ {
+ recursive: true,
+ force: true,
+ },
+ );
} catch (err) {
console.error(err);
process.exit(1);
diff --git a/docker/ton-node/ton-node.conf.json b/docker/ton-node/ton-node.conf.json
index 44332e0..e267f87 100644
--- a/docker/ton-node/ton-node.conf.json
+++ b/docker/ton-node/ton-node.conf.json
@@ -1,38 +1,41 @@
{
- "node_index": 0,
- "port": 40301,
- "poa_validators": 2,
- "poa_interval": 1,
- "private_key": "./private-key",
- "keys": ["./pub-key"],
- "boot": [],
- "shard_id": {
- "workchain": 0,
- "shardchain_pfx": 0,
- "shardchain_pfx_len": 0
- },
- "adnl": {
- "address": "127.0.0.1:3030",
- "keys": [
- {
- "type_id": -1977122418,
- "pub_key": "BBKmgGAxz4ZofRgMO2qhYt+K1bGlGeowukPONVAkOcU=",
- "pvt_key": "3CFeiTSlGkJf3D8w3ZXS4QS+6/0p+MFZGuv0XYMvMRo="
- }
- ]
- },
+ "node_index": 0,
+ "port": 40301,
+ "poa_validators": 2,
+ "poa_interval": 1,
+ "private_key": "./private-key",
+ "keys": [
+ "./pub-key"
+ ],
+ "boot": [],
+ "global_id": 100,
+ "shard_id": {
+ "workchain": 0,
+ "shardchain_pfx": 0,
+ "shardchain_pfx_len": 0
+ },
+ "adnl": {
+ "address": "127.0.0.1:3030",
+ "keys": [
+ {
+ "type_id": -1977122418,
+ "pub_key": "BBKmgGAxz4ZofRgMO2qhYt+K1bGlGeowukPONVAkOcU=",
+ "pvt_key": "3CFeiTSlGkJf3D8w3ZXS4QS+6/0p+MFZGuv0XYMvMRo="
+ }
+ ]
+ },
"api": {
"messages": "topics/requests",
"live_control": "se",
- "address": "127.0.0.1",
- "port": 3000
+ "address": "127.0.0.1",
+ "port": 3000
},
- "document_db": {
- "server": "127.0.0.1:8529",
- "database": "blockchain",
- "blocks_collection": "blocks",
- "messages_collection": "messages",
- "transactions_collection": "transactions",
- "accounts_collection": "accounts"
- }
+ "document_db": {
+ "server": "127.0.0.1:8529",
+ "database": "blockchain",
+ "blocks_collection": "blocks",
+ "messages_collection": "messages",
+ "transactions_collection": "transactions",
+ "accounts_collection": "accounts"
+ }
}
diff --git a/docker/ton-node/workchains/WC0/shard_8000000000000000/zerostate b/docker/ton-node/workchains/WC0/shard_8000000000000000/zerostate
new file mode 100644
index 0000000..ee3a427
Binary files /dev/null and b/docker/ton-node/workchains/WC0/shard_8000000000000000/zerostate differ
diff --git a/node/Cargo.toml b/node/Cargo.toml
index fa34e6a..c17e9f2 100644
--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -2,37 +2,36 @@
edition = '2021'
build = 'build.rs'
name = 'ton_node_startup'
-version = '0.36.3'
+version = '0.37.0'
[dependencies]
# External
anyhow = '1.0'
base64 = '0.13'
-clap = '3.1'
+clap = '3.2'
ed25519-dalek = '1.0'
failure = '0.1'
hex = '0.4'
-http = '0.1'
+http = '0.2'
iron = '0.6'
jsonrpc-http-server = '10.0.1'
lazy_static = '1.4.0'
log = '0.4'
-log4rs = '1.1'
+log4rs = '1.2'
num = '0.4'
num-traits = '0.2'
parking_lot = '0.12'
rand = '0.8'
-reqwest = '0.9.7'
+reqwest = '0.9'
router = '0.6.0'
serde = '1.0'
serde_derive = '1.0'
-serde_json = { features = [ 'preserve_order' ], version = '1.0' }
+serde_json = { features = ['preserve_order'], version = '1.0' }
thiserror = '1.0'
# Domestic
-ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.9.14' }
-ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.79' }
-ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.145' }
-ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.12.4' }
-ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.89', features = ['gosh'] }
-
+ton_block = { git = 'https://github.com/tonlabs/ever-block', tag = '1.9.28' }
+ton_block_json = { git = 'https://github.com/tonlabs/ever-block-json', tag = '0.7.95' }
+ton_executor = { git = 'https://github.com/tonlabs/ever-executor', tag = '1.15.175', features = ['signature_with_id'] }
+ton_types = { git = 'https://github.com/tonlabs/ever-types', tag = '1.12.7' }
+ton_vm = { git = 'https://github.com/tonlabs/ever-vm', tag = '1.8.116', features = ['gosh'] }
diff --git a/node/data/deprecated_giver_abi2_deploy_msg.boc b/node/data/deprecated_giver_abi2_deploy_msg.boc
deleted file mode 100644
index 5437b0e..0000000
Binary files a/node/data/deprecated_giver_abi2_deploy_msg.boc and /dev/null differ
diff --git a/node/data/giver_abi1_deploy_msg.boc b/node/data/giver_abi1_deploy_msg.boc
deleted file mode 100644
index 2d61080..0000000
Binary files a/node/data/giver_abi1_deploy_msg.boc and /dev/null differ
diff --git a/node/data/giver_abi2_deploy_msg.boc b/node/data/giver_abi2_deploy_msg.boc
deleted file mode 100644
index 3eb611d..0000000
Binary files a/node/data/giver_abi2_deploy_msg.boc and /dev/null differ
diff --git a/node/data/safemultisig_deploy_msg.boc b/node/data/safemultisig_deploy_msg.boc
deleted file mode 100644
index f1ea8b9..0000000
Binary files a/node/data/safemultisig_deploy_msg.boc and /dev/null differ
diff --git a/node/src/api/message_api.rs b/node/src/api/message_api.rs
index 996bdfa..9573258 100644
--- a/node/src/api/message_api.rs
+++ b/node/src/api/message_api.rs
@@ -14,7 +14,7 @@
* under the License.
*/
-use crate::engine::messages::{InMessagesQueue, QueuedMessage};
+use crate::engine::messages::InMessagesQueue;
use crate::engine::MessagesReceiver;
use crate::error::NodeResult;
use iron::{
@@ -95,7 +95,7 @@ impl MessageReceiverApi {
}
};
- let mut message = QueuedMessage::with_message(message).unwrap();
+ let mut message = message;
while let Err(msg) = queue.queue(message) {
if queue.has_delivery_problems() {
log::warn!(target: "node", "Request was refused because downstream services are not accessible");
diff --git a/node/src/block/applier.rs b/node/src/block/applier.rs
deleted file mode 100644
index e245054..0000000
--- a/node/src/block/applier.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-* Copyright 2018-2022 TON DEV SOLUTIONS LTD.
-*
-* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
-* this file except in compliance with the License. You may obtain a copy of the
-* License at:
-*
-* https://www.ton.dev/licenses
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific TON DEV software governing permissions and limitations
-* under the License.
-*/
-
-use crate::data::DocumentsDb;
-use crate::NodeResult;
-use std::sync::Arc;
-use parking_lot::Mutex;
-use ton_block::{BlkPrevInfo, Block, ShardStateUnsplit};
-use ton_types::UInt256;
-
-/// Trait for save finality states blockchain
-pub trait BlockFinality {
- fn put_block_with_info(
- &mut self,
- block: &Block,
- shard_state: Arc,
- ) -> NodeResult<()>;
-
- fn get_last_seq_no(&self) -> u32;
-
- fn get_last_block_info(&self) -> NodeResult;
-
- fn get_last_shard_state(&self) -> Arc;
-
- fn find_block_by_hash(&self, hash: &UInt256) -> u64;
-
- fn rollback_to(&mut self, hash: &UInt256) -> NodeResult<()>;
-
- fn get_raw_block_by_seqno(&self, seq_no: u32, vert_seq_no: u32) -> NodeResult>;
-
- fn get_last_finality_shard_hash(&self) -> NodeResult<(u64, UInt256)>;
-
- fn reset(&mut self) -> NodeResult<()>;
-}
-
-/// Applies changes provided by new block to shard state (in memory instance)
-/// and saves all changes into all kinds of storages
-#[allow(dead_code)]
-pub struct NewBlockApplier
-where
- F: BlockFinality,
-{
- db: Arc,
- finality: Arc>,
-}
-
-impl NewBlockApplier
-where
- F: BlockFinality,
-{
- /// Create new NewBlockApplier with given storages and shard state
- pub fn with_params(finality: Arc>, db: Arc) -> Self {
- NewBlockApplier { finality, db }
- }
-
- /// Applies changes provided by given block, returns new shard state
- pub fn apply(
- &mut self,
- block: &Block,
- applied_shard: ShardStateUnsplit,
- ) -> NodeResult> {
- let mut finality = self.finality.lock();
- let new_shard_state = Arc::new(applied_shard);
-
- log::info!(target: "node", "Apply block seq_no = {}", block.read_info()?.seq_no());
-
- finality.put_block_with_info(block, new_shard_state.clone())?;
-
- Ok(new_shard_state)
- }
-}
diff --git a/node/src/block/builder.rs b/node/src/block/builder.rs
index 689a820..6045854 100644
--- a/node/src/block/builder.rs
+++ b/node/src/block/builder.rs
@@ -19,19 +19,19 @@ use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use ton_block::{
Account, AddSub, Augmentation, BlkPrevInfo, Block, BlockExtra, BlockInfo, ComputeSkipReason,
- CurrencyCollection, Deserializable, EnqueuedMsg, HashUpdate, HashmapAugType, InMsg, InMsgDescr,
- MerkleUpdate, Message, MsgEnvelope, OutMsg, OutMsgDescr, OutMsgQueue, OutMsgQueueInfo,
- OutMsgQueueKey, Serializable, ShardAccount, ShardAccountBlocks, ShardAccounts, ShardIdent,
- ShardStateUnsplit, TrComputePhase, TrComputePhaseVm, Transaction, TransactionDescr,
- TransactionDescrOrdinary, UnixTime32, ValueFlow, CopyleftRewards,
+ CopyleftRewards, CurrencyCollection, Deserializable, EnqueuedMsg, HashUpdate, HashmapAugType,
+ InMsg, InMsgDescr, MerkleUpdate, Message, MsgEnvelope, OutMsg, OutMsgDescr, OutMsgQueue,
+ OutMsgQueueInfo, OutMsgQueueKey, Serializable, ShardAccount, ShardAccountBlocks, ShardAccounts,
+ ShardIdent, ShardStateUnsplit, TrComputePhase, TrComputePhaseVm, Transaction, TransactionDescr,
+ TransactionDescrOrdinary, UnixTime32, ValueFlow,
};
use ton_executor::{
BlockchainConfig, ExecuteParams, ExecutorError, OrdinaryTransactionExecutor,
TransactionExecutor,
};
-use ton_types::{error, AccountId, Cell, HashmapRemover, HashmapType, Result, UInt256, SliceData};
+use ton_types::{error, AccountId, Cell, HashmapRemover, HashmapType, Result, SliceData, UInt256};
-use crate::engine::{InMessagesQueue, QueuedMessage};
+use crate::engine::InMessagesQueue;
use crate::error::NodeResult;
#[cfg(test)]
@@ -145,6 +145,7 @@ impl BlockBuilder {
last_tr_lt: Arc::clone(<),
seed_block: self.rand_seed.clone(),
debug,
+ signature_id: self.shard_state.global_id(),
..Default::default()
},
);
@@ -201,20 +202,23 @@ impl BlockBuilder {
pub fn execute(
&mut self,
- msg: QueuedMessage,
- blockchain_config: BlockchainConfig,
+ message: Message,
+ blockchain_config: &BlockchainConfig,
acc_id: &AccountId,
debug: bool,
) -> NodeResult<()> {
let shard_acc = self.accounts.account(acc_id)?.unwrap_or_default();
let mut acc_root = shard_acc.account_cell();
- let executor = OrdinaryTransactionExecutor::new(blockchain_config);
+ let executor = OrdinaryTransactionExecutor::new((*blockchain_config).clone());
- log::debug!("Executing message {:x}", msg.message_hash());
+ log::debug!(
+ "Executing message {:x}",
+ message.serialize().unwrap_or_default().repr_hash()
+ );
let (mut transaction, max_lt) = self.try_prepare_transaction(
&executor,
&mut acc_root,
- msg.message(),
+ &message,
shard_acc.last_trans_lt(),
debug,
)?;
@@ -253,9 +257,9 @@ impl BlockBuilder {
pub fn build_block(
mut self,
queue: &InMessagesQueue,
- blockchain_config: BlockchainConfig,
+ blockchain_config: &BlockchainConfig,
debug: bool,
- ) -> NodeResult