v2.1
Conflux-Rust v2.1.0 is a small hardfork upgrade. In this upgrade 5 new CIPs will be activate, and also some improvement about storage and RPC.
New CIPs
- CIP-94: proposes to use on-chain DAO voting to decide and update reward parameters without hardfork.
- CIP-97: proposes to remove account's staking lists.
- CIP-98: Fix a bug in BLOCKHASH opcode in eSpace.
- CIP-99: Allow more not-voting terms before we force-retire a node, and make the unlock period of a retiring node shorter to allow the node to rejoin the PoS voting faster.
- CIP-105 PoS staking based minimal DAO vote count.
New InternalContract
CIP-94 also has introduce a new InternalContract ParamControl
at hex address 0x0888000000000000000000000000000000000007
. This contract can be used to retrive parameter info and participate in DAO vote.
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface ParamsControl {
struct Vote {
uint16 topic_index;
uint256[3] votes;
}
/*** Query Functions ***/
/**
* @dev cast vote for parameters
* @param vote_round The round to vote for
* @param vote_data The list of votes to cast
*/
function castVote(uint64 vote_round, Vote[] calldata vote_data) external;
/**
* @dev read the vote data of an account
* @param addr The address of the account to read
*/
function readVote(address addr) external view returns (Vote[] memory);
/**
* @dev Current vote round
*/
function currentRound() external view returns (uint64);
/**
* @dev read the total votes of given round
* @param vote_round The vote number
*/
function totalVotes(uint64 vote_round) external view returns (Vote[] memory);
/**
* @dev read the PoS stake for the round.
*/
function posStakeForVotes(uint64) external view returns (uint256);
event CastVote(uint64 indexed vote_round, address indexed addr, uint16 indexed topic_index, uint256[3] votes);
event RevokeVote(uint64 indexed vote_round, address indexed addr, uint16 indexed topic_index, uint256[3] votes);
}
Improvements
Storage
Allow snapshots to be removed during recovery. This reduces the disk space requirement for full node sync or recovery.
In v2.1.0 Conflux-Rust also brought support for fullstate query
, which means we can query state at any blockchain height. For example we can query an address cfx:aaketjh9tkj5g2k4zx3kfvb9vkku8nr956n0en4fhe
's balance at height 100000
with method cfx_getBalance
by specifying the second parameter.
curl --location --request POST 'https://main.confluxrpc.com' \
--header 'Content-Type: application/json' \
--data-raw ' {
"jsonrpc": "2.0",
"id": "15922956697249514502",
"method": "cfx_getBalance",
"params": [
"cfx:aaketjh9tkj5g2k4zx3kfvb9vkku8nr956n0en4fhe",
"0x186a0"
]
}'
To support conflux fullstate query, a archive node with configuration enable_single_mpt_storage
enabled is required. And the node need sync data from genesis to construct all the history states. Besides nodes can also set single_mpt_space = "evm"
to only store eSpace states.
RPC
- Support
eth_subscribe
andeth_unsubscribe
in eSpace RPCs. - Add a RPC method
cfx_getParamsFromVote
to return the currently used value of the voted parameters. - Return null for getting skipped transactions and receipts. Whether they will be returned was nondeterministic before, but now they are ensured to be null.