Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA for v2.0.0 #189

Open
10 of 15 tasks
blukat29 opened this issue Dec 27, 2024 · 10 comments
Open
10 of 15 tasks

QA for v2.0.0 #189

blukat29 opened this issue Dec 27, 2024 · 10 comments

Comments

@blukat29
Copy link
Contributor

blukat29 commented Dec 27, 2024

  • Regular tests
  • Prague hardfork
  • p2p changes
    • Mainnet and Kairos ENs can find PNs from the BNs @2dvorak
      • In a 1-CN, 10-PN, 2-BN, 1-EN test network.
        • (BN) Respond findnode with up to 2 PNs #144
        • (EN) Correctly process neighbor responses #158
      • Against Kairos BN
        • (EN) Discovered nodes survive node restart #157
  • RPC API changes @2dvorak
    • TotalDifficulty and BlockScore fields removal #134
  • Packaging
    • RPM package installs systemd files @blukat29
  • Refactoring
    • API equivalence between v1.0.3 and v2.0.0 @yoomee1313 @hyeonLewis
      • Staking APIs (kaiax/staking)
      • Reward APIs (kaiax/reward)
      • Governance APIs (kaiax/gov)
      • Consensus APIs (kaiax/valset)
      • Supply APIs (kaiax/supply)
    • Migration @hyunsooda
      • Use new schema if syncing from genesis
      • Upgrade from v1.0.3. Finish migration in one node run.
      • Upgrade from v1.0.3. Node restarts and migration continues.
@hyeonLewis
Copy link
Contributor

hyeonLewis commented Dec 30, 2024

[Pending: Waiting for reflecting latest spec]

EIP-7702 and KIP-228

Please find the testing code here

  • Setup:

    • homi setup --cn-num 1 --baobab --gen-type local
  • [WIP] Checklist:

    • SetCodeTx. (sendRawTransaction, getTransactionReceipt)
      • Successfully SetCode to EOA.
      • Successfully unset code to EOA.
      • Can't set code to account updated EOA.
    • APIs: kaia_getAccount, kaia_isContractAccount.
    • Opcodes: EXTCODESIZE, EXTCODECOPY, EXTCODEHASH, CALL, DELEGATECALL (CALLCODE), STATICCALL.
    • Reset code of delegation contract to zero address.
    • Interaction with other tx types.
      • to must be EOA without code: Failed after SetCode / Succeeded after reset.
        • TxTypeValueTransfer
        • TxTypeFeeDelegatedValueTransfer
        • TxTypeFeeDelegatedValueTransferWithRatio
        • TxTypeValueTransferMemo
        • TxTypeFeeDelegatedValueTransferMemo
        • TxTypeFeeDelegatedValueTransferMemoWithRatio
      • from must be EOA without code: Failed after SetCode / Succeeded after reset.
        • TxTypeAccountUpdate
        • TxTypeFeeDelegatedAccountUpdate
        • TxTypeFeeDelegatedAccountUpdateWithRatio
      • to must be EOA with code: Succeeded after SetCode / Failed after reset.
        • TxTypeSmartContractExecution
        • TxTypeFeeDelegatedSmartContractExecution
        • TxTypeFeeDelegatedSmartContractExecutionWithRatio
Running the script
// Start running private network
./run start

// In qa-klaytn repo
hh run src/eip-7702/main.ts

==================== SET CODE =========================
Checking code 0xAa3D17D2a89D79c8d7E3e11406C49d21d468d7F2 after set
Checking execution of eoaWithCode
Checking increment of eoaWithCode
Checking callIncrement of eoaWithCode
Checking callIncrementFromEoaWithCode of eoaWithCode
Checking delegatecallIncrement of eoaWithCode
Checking delegatecallIncrementFromEoaWithCode of eoaWithCode
Checking callcodeIncrement of eoaWithCode
Checking callcodeIncrementFromEoaWithCode of eoaWithCode

==================== TESTING OTHER TX TYPES =========================
Checking to must be EOA without code after setCode
Checking from must be EOA without code after setCode
Checking to must be EOA with code or SCA after setCode

==================== RESET CODE =========================
Resetting code of delegation contract to zero address
Checking code 0xAa3D17D2a89D79c8d7E3e11406C49d21d468d7F2 after reset

==================== TESTING OTHER TX TYPES (after reset) =========================
Checking to must be EOA without code after reset
Checking from must be EOA without code after reset
Checking to must be EOA with code or SCA after reset

==================== TESTING SET CODE AFTER ACCOUNT UPDATE =========================
Checking setCode after account update

@ian0371
Copy link
Collaborator

ian0371 commented Jan 2, 2025

KIP-226 consensus liquidity

Config

  • Prague is block 500 (homi setup --cn-num 4 --baobab-test --mnemonic test,junk --patch-address-book --prague-compatible-blocknumber 500 --gen-type docker)
  • each validator staking amounts
    • val1: CnStaking 5mil KAIA + 2 kei, ClStaking 2mil KAIA
    • val2: CnStaking 5mil KAIA + 1 kei, ClStaking 10mil KAIA
    • val3: CnStaking 5mil KAIA - 1 kei, ClStaking 4mil KAIA
    • val4: CnStaking 5mil KAIA + 1 kei
  • Setup procedures
    • Setup AddressBook and CnStakings
    • Deploy CLRegistry, WKlay
    • Register CLRegistry, WKlay to Registry
    • Register three ClStakings to CLRegistry
    • Mint wKAIA to CLPools
Setup commands

Run from system-contracts@c99ded7:

  1. Write .env file (CN1-4, CLREG, WKAIA address can change)
HARDHAT_NETWORK=homi
ETH_RPC_URL=http://localhost:8551
PRIVKEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
OWNER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 # for CLRegistry

NODEID1=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
NODEID2=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
NODEID3=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
CLPOOL1=0x0000000000000000000000000000000000000001
CLPOOL2=0x0000000000000000000000000000000000000002
CLPOOL3=0x0000000000000000000000000000000000000003


CN1=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
CN2=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
CN3=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
CN4=0x68B1D87F95878fE05B998F19b66F4baba5De1aed
CLREG=0xE8121a4C77cBa292B7E8ff6CE7583c3C72765564
WKAIA=0x95401dc811bb5740090279Ba06cfA8fcF6113778
  1. Add/modify contracts
    2-1. wKlay
pragma solidity 0.8.25;

import "openzeppelin-contracts-5.0/token/ERC20/ERC20.sol";
import {Ownable} from "openzeppelin-contracts-5.0/access/Ownable.sol";

contract WKlay is ERC20, Ownable {
  constructor(address initialOwner) ERC20("wrapped KLAY", "wKLAY") Ownable(initialOwner) {}

  function mint(address to, uint256 amount) public onlyOwner {
      _mint(to, amount);
  }
}

2-2. CnStakingV2

diff --git a/contracts/consensus/CnV2/CnStakingV2.sol b/contracts/consensus/CnV2/CnStakingV2.sol
index 9da1f49..856f5a3 100644
--- a/contracts/consensus/CnV2/CnStakingV2.sol
+++ b/contracts/consensus/CnV2/CnStakingV2.sol
@@ -75,7 +75,7 @@ import "../IAddressBook.sol";
contract CnStakingV2 is ICnStakingV2 {
   // Constants
   // - Constants are defined as virtual functions to allow easier unit tests.
-    uint256 public constant ONE_WEEK = 1 weeks;
+    uint256 public constant ONE_WEEK = 0 seconds;

   function MAX_ADMIN() public view virtual override returns (uint256) {
       return 50;
@@ -863,7 +863,7 @@ contract CnStakingV2 is ICnStakingV2 {
       require(request.value <= staking, "Value is not withdrawable.");
       require(request.withdrawableFrom <= block.timestamp, "Not withdrawable yet.");

-        uint256 withdrawableUntil = request.withdrawableFrom + STAKE_LOCKUP();
+        uint256 withdrawableUntil = request.withdrawableFrom + 1 weeks;
       if (withdrawableUntil <= block.timestamp) {
           request.state = WithdrawalStakingState.Canceled;
           unstaking -= request.value;

2-3. deploy/wklay_deploy.ts

import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";

const name = "WKlay";

const func: DeployFunction = async ({ deployments }: HardhatRuntimeEnvironment) => {
const { deployer } = await hre.getNamedAccounts();

const res = await deployments.deploy(name, {
  from: deployer,
  args: [deployer],
  log: true,
});

console.log(`${name} deployed at ${res.address}`);
};

func.tags = [name];
export default func;
  1. Run script
homi setup --cn-num 4 --baobab-test --mnemonic test,junk --patch-address-book --prague-compatible-blocknumber 500 --docker-image-id yum3/kaia:v2.0.0-rc.1 --gen-type docker

# Abook Init
npx ts-node script/commander.ts abook init --num 4

# Setup balance
cast send $CN1 --value 1 --private-key $PRIVKEY
cast balance $CN1

cast send $CN3 "submitApproveStakingWithdrawal(address to, uint256 value)" 0x000000000000000000000000000000000000dead 2 --private-key $PRIVKEY
sleep 1
cast send $CN3 "withdrawApprovedStaking(uint256)" 0 --private-key $PRIVKEY
cast balance $CN3

# Deploy
hh deploy --tags CLRegistry,WKlay --reset

# Register to Registry
BLOCK_NUMBER=$(($(cast rpc eth_getBlockByNumber latest false | jq .number) + 20))
npx ts-node script/commander.ts reg register WrappedKaia $WKAIA $BLOCK_NUMBER
npx ts-node script/commander.ts reg register CLRegistry $CLREG $BLOCK_NUMBER

# Register to CLRegistry
npx ts-node script/commander.ts clreg add $NODEID1 1 $CLPOOL1 $CLPOOL1
npx ts-node script/commander.ts clreg add $NODEID2 2 $CLPOOL2 $CLPOOL2
npx ts-node script/commander.ts clreg add $NODEID3 3 $CLPOOL3 $CLPOOL3

# Mint wKAIA
cast send $WKAIA "mint(address to, uint256 amount)" $CLPOOL1 2000000ether --private-key $PRIVKEY
cast send $WKAIA "mint(address to, uint256 amount)" $CLPOOL2 10000000ether --private-key $PRIVKEY
cast send $WKAIA "mint(address to, uint256 amount)" $CLPOOL3 4000000ether --private-key $PRIVKEY

cast call $WKAIA "balanceOf(address to)(uint256)" $CLPOOL1
cast call $WKAIA "balanceOf(address to)(uint256)" $CLPOOL2
cast call $WKAIA "balanceOf(address to)(uint256)" $CLPOOL3

Result

  • GetStakingInfo(500) has ClStakingInfo
  • Rewards are distributed from block 500
  • CnStaking < 5 mil is ineligible
API results
$ cast rpc kaia_getStakingInfo 499 | jq
{
  "blockNum": 498,
  "councilNodeAddrs": [
    "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
    "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
    "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
    "0x90f79bf6eb2c4f870365e785982e1f101e93b906"
  ],
  "councilStakingAddrs": [
    "0x5fbdb2315678afecb367f032d93f642f64180aa3",
    "0xa513e6e4b8f2a923d98304ec87f64353c4d5c853",
    "0xa51c1fc2f0d1a1b8494ed1fe312d7c3a78ed91c0",
    "0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae"
  ],
  "councilRewardAddrs": [
    "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
    "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
    "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
    "0x90f79bf6eb2c4f870365e785982e1f101e93b906"
  ],
  "kefAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "kifAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "councilStakingAmounts": [
    5000000,
    5000000,
    4999999,
    5000000
  ],
  "clStakingInfos": null,
  "KIRAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "PoCAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "kcfAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "kffAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "useGini": false,
  "gini": 0
}
$ cast rpc kaia_getStakingInfo 500 | jq
{
  "blockNum": 499,
  "councilNodeAddrs": [
    "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
    "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
    "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
    "0x90f79bf6eb2c4f870365e785982e1f101e93b906"
  ],
  "councilStakingAddrs": [
    "0x5fbdb2315678afecb367f032d93f642f64180aa3",
    "0xa513e6e4b8f2a923d98304ec87f64353c4d5c853",
    "0xa51c1fc2f0d1a1b8494ed1fe312d7c3a78ed91c0",
    "0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae"
  ],
  "councilRewardAddrs": [
    "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
    "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
    "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
    "0x90f79bf6eb2c4f870365e785982e1f101e93b906"
  ],
  "kefAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "kifAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "councilStakingAmounts": [
    5000000,
    5000000,
    4999999,
    5000000
  ],
  "clStakingInfos": [
    {
      "clNodeId": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
      "clPoolAddr": "0x0000000000000000000000000000000000000001",
      "clRewardAddr": "0x0000000000000000000000000000000000000001",
      "clStakingAmount": 2000000
    },
    {
      "clNodeId": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
      "clPoolAddr": "0x0000000000000000000000000000000000000002",
      "clRewardAddr": "0x0000000000000000000000000000000000000002",
      "clStakingAmount": 10000000
    },
    {
      "clNodeId": "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
      "clPoolAddr": "0x0000000000000000000000000000000000000003",
      "clRewardAddr": "0x0000000000000000000000000000000000000003",
      "clStakingAmount": 4000000
    }
  ],
  "KIRAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "PoCAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "kcfAddr": "0x322813fd9a801c5507c9de605d63cea4f2ce6c44",
  "kffAddr": "0xa85233c63b9ee964add6f2cffe00fd84eb32338f",
  "useGini": false,
  "gini": 0.25
}

$ cast rpc kaia_getBalance $CLPOOL1 499
"0x0"
$ cast rpc kaia_getBalance $CLPOOL1 500
"0x1b9c12b765b6db6"
$ cast rpc kaia_getBalance $CLPOOL1 501
"0x60a24181e3ffffe"
$ cast rpc kaia_getBalance $CLPOOL1 502
"0x7c3e543949b6db4"
$ cast rpc kaia_getBalance $CLPOOL1 503
"0xc1448303c7ffffc"

$ cast rpc kaia_getBalance $CLPOOL2 499
"0x0"
$ cast rpc kaia_getBalance $CLPOOL2 500
"0x1a2bf1bdd86aaaaa"
$ cast rpc kaia_getBalance $CLPOOL2 501
"0x2e4dbf6392955554"
$ cast rpc kaia_getBalance $CLPOOL2 502
"0x4879b1216afffffe"
$ cast rpc kaia_getBalance $CLPOOL2 503
"0x5c9b7ec7252aaaa8"

$ cast rpc kaia_getBalance $CLPOOL3 499
"0x0"
$ cast rpc kaia_getBalance $CLPOOL3 500
"0x0"
$ cast rpc kaia_getBalance $CLPOOL3 501
"0x0"
$ cast rpc kaia_getBalance $CLPOOL3 502
"0x0"
$ cast rpc kaia_getBalance $CLPOOL3 503
"0x0"

@hyunsooda
Copy link
Contributor

hyunsooda commented Jan 6, 2025

  • Migration @hyunsooda
    • Use new schema if syncing from genesis
      • Node started with rc
    • Upgrade from v1.0.3. Finish migration in one node run.
      • Node started with v1.0.3 (to be restarted with replacement(rc))
    • Upgrade from v1.0.3. Node restarts and migration continues.
      • Same condition with the right above and repeating restart before migration is completed
    • Node start with rc on chaindata snapshot. (valset module migration)

@hyeonLewis
Copy link
Contributor

hyeonLewis commented Jan 7, 2025

KIP-226 consensus liquidity for on-chain governance

  • Setup:
    • Prepare mainnet fork network
  • Checklist:
    • Successfully migrate to StakingTrackerV2
      • Voting
      • CnStakingV2, V3
    • Successfully tracks CN, CL staking
      • CnStakingV2, V3
      • CLRegistry
  • Process
    • Successfully migrate to StakingTrackerV2:
      1. Deploy a new STv2
      2. Make a proposal on Voting to update ST (ST -> STv2)
      3. After passing (2), update all CnStakingV2, V3 to STv2
      4. After passing(3), call refreshVoter(staking) to new STv2
      5. Make a new proposal on Voting and check a new STv2 tracks all CnStakings.
    • Successfully tracks CN, CL staking
      1. After above, deploy CLRegistry, MockCLPool contracts.
      2. Register MockCLPools to CLRegistry.
      3. Register CLRegistry, WrappedKaia to SystemRegistry.
      4. Fund CLPool with WrappedKaia.
      5. Make a new proposal on Voting and check a new STv2 tracks all CNs and CLs.

@2dvorak
Copy link
Contributor

2dvorak commented Jan 7, 2025

p2p changes

  • In a 1-CN, 10-PN, 2-BN, 1-EN test network.
    • (BN) Respond findnode with up to 2 PNs
      • failed, will be fixed in rc.2
    • (EN) Correctly process neighbor responses
  • Against Kairos BN
    • (EN) Discovered nodes survive node restart
Details

QA with a 1-CN, 10-PN, 2-BN, 1-EN test network

setup

Setup a test network with docker compose ref
Added one more BN to the reference docker-compose.yml

  BN-1:
    hostname: BN-1
    image: qa-2.0.0
    entrypoint:
      - /bin/sh
      - -c
      - |
        mkdir -p /etc/kbnd/keystore
        mkdir -p /etc/kbnd/logs
        mkdir -p /etc/kbnd/data
        echo '28569c688eb8f0fb61d5f781e4a2071191252439829b0db57c451f1d625bdafe' > /etc/kbnd/keystore/nodekey
        echo "# docker-compose" >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'NETWORK=""' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'RPC_ENABLE=1' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'RPC_API="db,eth,klay,net,governance,web3,miner,personal,txpool,debug,admin,istanbul,mainbridge,subbridge"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'NETWORK_ID="2018"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN0="kni://cb4b1eb548eecf94b11b1d6dd62675fd37a14f764db8933d7dc0848a461492c44f5228b3772d42de352400d3824410c8ef08fcd241a9d552ec6d3ca090e94b5e@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN1="kni://b42bd404ec11bfffcbea41a32768b7c2b4d49b7c7a086daf836056f917af63b498134f8b1381cdfcc71e5728da26a1a99c7ae51e066b4c977f6616d698b2cc9c@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN2="kni://f20b86d6a4f1483f5aa1ae4c10109e2862d3c6673b3b4c78edf9f50ff211d5576a69dab424f8efafd43a801c8b340a9c9421efa155bd61285c5da0fa51c8613a@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN3="kni://695adaf11c73f180aef1369a569da83743b6740b92a98617bc08e9507d05a0448a40190a6627ca16da6adbf2bf2152de8262d2874e9a4822adad96a1da3395df@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN4="kni://55f6ea1ba83bf7b4c85ef07daa3c17db37be375687d66a1101b7f259557be7678d73fcd96df112c2154d756e51390f1a577a57414d23ac97a53121512d2f5826@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN5="kni://42021e3f561c9ffe1ec06b296b80bd6befa2748f15f03337048dd5559f9d1e0100bba9e300bdac356fe716e5502b7caa6ffda6c680afbd7d7851ce10f233ca22@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN6="kni://d52d93a73679b935644b8984e4d09d13b638043c78dc3dd7f7ac1570b4212188c5b8f331be0be6651cb6f6b92598b11ed9b828bc98363d81c2ff7a80954b73d7@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN7="kni://766ebbe03aa49c14f0dba53791c08ff7891437e0418e9f44f7cc3a703bae1e2878723f5419146f9970f4ec3b35f3d84c19bb64ab878cffd51bfb10d4ec4faa1e@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN8="kni://209bbdea9a7adce83bba184a6e50e5a548a1bbff8c19a5aac530f3920998970a9c99623a5014b5f21f84d438dc539589affe7b48f16de83d4cdd58ac60c2f636@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'PN9="kni://ba06e9cceb45b37ae9faeb07a79d218f47d7bc2ebb175efb580692903beaec7389c325d2051c89b56a35dd4973b0d5aaafa259a1aa8bb77eea61c118ec73fbb8@[::]:32323?ntype=pn"' >> /klaytn-docker-pkg/conf/kbnd.conf
        echo 'AUTHORIZED_NODES="$${PN0},$${PN1},$${PN2},$${PN3},$${PN4},$${PN5},$${PN6},$${PN7},$${PN8},$${PN9}"' >> /klaytn-docker-pkg/conf/kbnd.conf
        /klaytn-docker-pkg/bin/kbnd start
        tail -F /etc/kbnd/logs/kbnd.out
    networks:
      app_net:
        ipv4_address: 172.16.239.23
    restart: "no"

Also, added log messages to inspect p2p internals.

--- a/networks/p2p/discover/udp.go
+++ b/networks/p2p/discover/udp.go
@@ -740,6 +740,10 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte
        retrieveSize := findnodeRetrieveSize(req.TargetType)
        closest := t.RetrieveNodes(target, req.TargetType, retrieveSize)

+       if req.TargetType == NodeTypePN {
+               logger.Error("udp: findnode: closest", "closest", closest, "len", len(closest))
+       }
+
        // Send neighbors in chunks with at most maxNeighbors per packet
        // to stay below the 1280 byte limit.
--- a/networks/p2p/discover/table.go
+++ b/networks/p2p/discover/table.go
@@ -293,6 +293,9 @@ func (tab *Table) findNewNode(seeds *nodesByDistance, targetID NodeID, targetNT
                seeds.entries = removeBn(seeds.entries)
        }
        tab.localLogger.Debug("findNewNode: found nodes", "length", len(seeds.entries), "nodeType", targetNT)
+       if targetNT == NodeTypePN {
+               logger.Error("findNewNode: found nodes", "length", len(seeds.entries), "nodeType", targetNT, "entries", seeds.entries)
+       }
        return seeds.entries
 }
result

In the v1.0.3 version, we could see more than 2 PNs responded in the neighbors msg:

BN-0-1  | ERROR[01/10,03:13:16 Z] [34] udp: findnode: closest                    closest="[kni://42021e3f561c9ffe1ec06b296b80bd6befa2748f15f03337048dd5559f9d1e0100bba9e300bdac356fe716e5502b7caa6ffda6c680afbd7d7851ce10f233ca22@172.16.239.16:32323?ntype=pn kni://f20b86d6a4f1483f5aa1ae4c10109e2862d3c6673b3b4c78edf9f50ff211d5576a69dab424f8efafd43a801c8b340a9c9421efa155bd61285c5da0fa51c8613a@172.16.239.13:32323?ntype=pn kni://b42bd404ec11bfffcbea41a32768b7c2b4d49b7c7a086daf836056f917af63b498134f8b1381cdfcc71e5728da26a1a99c7ae51e066b4c977f6616d698b2cc9c@172.16.239.12:32323?ntype=pn kni://d52d93a73679b935644b8984e4d09d13b638043c78dc3dd7f7ac1570b4212188c5b8f331be0be6651cb6f6b92598b11ed9b828bc98363d81c2ff7a80954b73d7@172.16.239.17:32323?ntype=pn kni://55f6ea1ba83bf7b4c85ef07daa3c17db37be375687d66a1101b7f259557be7678d73fcd96df112c2154d756e51390f1a577a57414d23ac97a53121512d2f5826@172.16.239.15:32323?ntype=pn kni://ba06e9cceb45b37ae9faeb07a79d218f47d7bc2ebb175efb580692903beaec7389c325d2051c89b56a35dd4973b0d5aaafa259a1aa8bb77eea61c118ec73fbb8@172.16.239.20:32323?ntype=pn kni://695adaf11c73f180aef1369a569da83743b6740b92a98617bc08e9507d05a0448a40190a6627ca16da6adbf2bf2152de8262d2874e9a4822adad96a1da3395df@172.16.239.14:32323?ntype=pn kni://766ebbe03aa49c14f0dba53791c08ff7891437e0418e9f44f7cc3a703bae1e2878723f5419146f9970f4ec3b35f3d84c19bb64ab878cffd51bfb10d4ec4faa1e@172.16.239.18:32323?ntype=pn kni://209bbdea9a7adce83bba184a6e50e5a548a1bbff8c19a5aac530f3920998970a9c99623a5014b5f21f84d438dc539589affe7b48f16de83d4cdd58ac60c2f636@172.16.239.19:32323?ntype=pn kni://cb4b1eb548eecf94b11b1d6dd62675fd37a14f764db8933d7dc0848a461492c44f5228b3772d42de352400d3824410c8ef08fcd241a9d552ec6d3ca090e94b5e@172.16.239.11:32323?ntype=pn]" len=10

In the rc.1 version, we have 10 PNs although our intended change was to return 2 PNs (This will be fixed in the rc.2 version).

BN-0-1  | ERROR[01/10,03:18:29 Z] [34] udp: findnode: closest                    closest="[kni://b42bd404ec11bfffcbea41a32768b7c2b4d49b7c7a086daf836056f917af63b498134f8b1381cdfcc71e5728da26a1a99c7ae51e066b4c977f6616d698b2cc9c@172.16.239.12:32323?ntype=pn kni://695adaf11c73f180aef1369a569da83743b6740b92a98617bc08e9507d05a0448a40190a6627ca16da6adbf2bf2152de8262d2874e9a4822adad96a1da3395df@172.16.239.14:32323?ntype=pn kni://cb4b1eb548eecf94b11b1d6dd62675fd37a14f764db8933d7dc0848a461492c44f5228b3772d42de352400d3824410c8ef08fcd241a9d552ec6d3ca090e94b5e@172.16.239.11:32323?ntype=pn kni://209bbdea9a7adce83bba184a6e50e5a548a1bbff8c19a5aac530f3920998970a9c99623a5014b5f21f84d438dc539589affe7b48f16de83d4cdd58ac60c2f636@172.16.239.19:32323?ntype=pn kni://d52d93a73679b935644b8984e4d09d13b638043c78dc3dd7f7ac1570b4212188c5b8f331be0be6651cb6f6b92598b11ed9b828bc98363d81c2ff7a80954b73d7@172.16.239.17:32323?ntype=pn kni://ba06e9cceb45b37ae9faeb07a79d218f47d7bc2ebb175efb580692903beaec7389c325d2051c89b56a35dd4973b0d5aaafa259a1aa8bb77eea61c118ec73fbb8@172.16.239.20:32323?ntype=pn kni://42021e3f561c9ffe1ec06b296b80bd6befa2748f15f03337048dd5559f9d1e0100bba9e300bdac356fe716e5502b7caa6ffda6c680afbd7d7851ce10f233ca22@172.16.239.16:32323?ntype=pn kni://f20b86d6a4f1483f5aa1ae4c10109e2862d3c6673b3b4c78edf9f50ff211d5576a69dab424f8efafd43a801c8b340a9c9421efa155bd61285c5da0fa51c8613a@172.16.239.13:32323?ntype=pn kni://766ebbe03aa49c14f0dba53791c08ff7891437e0418e9f44f7cc3a703bae1e2878723f5419146f9970f4ec3b35f3d84c19bb64ab878cffd51bfb10d4ec4faa1e@172.16.239.18:32323?ntype=pn kni://55f6ea1ba83bf7b4c85ef07daa3c17db37be375687d66a1101b7f259557be7678d73fcd96df112c2154d756e51390f1a577a57414d23ac97a53121512d2f5826@172.16.239.15:32323?ntype=pn]" len=10

In the rc.2 version, we have up to 2 PNs although there are 10 PNs in the test network.

BN-0-1  | ERROR[01/24,06:07:48 Z] [34] udp: findnode: closest                    closest="[kni://695adaf11c73f180aef1369a569da83743b6740b92a98617bc08e9507d05a0448a40190a6627ca16da6adbf2bf2152de8262d2874e9a4822adad96a1da3395df@172.16.239.14:32323?ntype=pn kni://55f6ea1ba83bf7b4c85ef07daa3c17db37be375687d66a1101b7f259557be7678d73fcd96df112c2154d756e51390f1a577a57414d23ac97a53121512d2f5826@172.16.239.15:32323?ntype=pn]" len=2
BN-0-1  | ERROR[01/24,06:07:49 Z] [34] udp: findnode: closest                    closest="[kni://cb4b1eb548eecf94b11b1d6dd62675fd37a14f764db8933d7dc0848a461492c44f5228b3772d42de352400d3824410c8ef08fcd241a9d552ec6d3ca090e94b5e@172.16.239.11:32323?ntype=pn kni://d52d93a73679b935644b8984e4d09d13b638043c78dc3dd7f7ac1570b4212188c5b8f331be0be6651cb6f6b92598b11ed9b828bc98363d81c2ff7a80954b73d7@172.16.239.17:32323?ntype=pn]" len=2
BN-0-1  | ERROR[01/24,06:07:49 Z] [34] udp: findnode: closest                    closest="[kni://209bbdea9a7adce83bba184a6e50e5a548a1bbff8c19a5aac530f3920998970a9c99623a5014b5f21f84d438dc539589affe7b48f16de83d4cdd58ac60c2f636@172.16.239.19:32323?ntype=pn kni://ba06e9cceb45b37ae9faeb07a79d218f47d7bc2ebb175efb580692903beaec7389c325d2051c89b56a35dd4973b0d5aaafa259a1aa8bb77eea61c118ec73fbb8@172.16.239.20:32323?ntype=pn]" len=2
BN-0-1  | ERROR[01/24,06:07:49 Z] [34] udp: findnode: closest                    closest="[kni://42021e3f561c9ffe1ec06b296b80bd6befa2748f15f03337048dd5559f9d1e0100bba9e300bdac356fe716e5502b7caa6ffda6c680afbd7d7851ce10f233ca22@172.16.239.16:32323?ntype=pn kni://b42bd404ec11bfffcbea41a32768b7c2b4d49b7c7a086daf836056f917af63b498134f8b1381cdfcc71e5728da26a1a99c7ae51e066b4c977f6616d698b2cc9c@172.16.239.12:32323?ntype=pn]" len=2

In the v1.0.3 version, we could see that EN is more likely to get empty result when we have more than 2 BNs.

EN-0-1  | ERROR[01/10,02:54:28 Z] [34|networks/p2p/discover/table.go:297]                    findNewNode: found nodes                  length=0 nodeType=2 entries=[]
EN-0-1  | ERROR[01/10,02:54:32 Z] [34|networks/p2p/discover/table.go:297]                    findNewNode: found nodes                  length=0 nodeType=2 entries=[]

In the rc version, we could see that BNs are removed and PNs are filled correctly.

EN-0-1  | ERROR[01/10,03:01:33 Z] [34|networks/p2p/discover/table.go:297]  findNewNode: found nodes                  length=2 nodeType=2 entries="[kni://cb4b1eb548eecf94b11b1d6dd62675fd37a14f764db8933d7dc0848a461492c44f5228b3772d42de352400d3824410c8ef08fcd241a9d552ec6d3ca090e94b5e@172.16.239.11:32323?ntype=pn kni://42021e3f561c9ffe1ec06b296b80bd6befa2748f15f03337048dd5559f9d1e0100bba9e300bdac356fe716e5502b7caa6ffda6c680afbd7d7851ce10f233ca22@172.16.239.16:32323?ntype=pn]"

QA using Kairos BN

setup

To reduce noise, remove EN and BN in discovered nodes. Also, increase PN entry as it might help exhausting PNs to be discovered.

--- a/networks/p2p/discover/table.go
+++ b/networks/p2p/discover/table.go
@@ -159,9 +159,9 @@ func newTable(cfg *Config) (Discovery, error) {
                tab.addStorage(NodeTypeEN, &KademliaStorage{targetType: NodeTypeEN, noDiscover: true})
                tab.addStorage(NodeTypeBN, &simpleStorage{targetType: NodeTypeBN, noDiscover: true, max: 3})
        case NodeTypeEN:
-               tab.addStorage(NodeTypePN, &simpleStorage{targetType: NodeTypePN, noDiscover: true, max: 2})
-               tab.addStorage(NodeTypeEN, &KademliaStorage{targetType: NodeTypeEN})
-               tab.addStorage(NodeTypeBN, &simpleStorage{targetType: NodeTypeBN, noDiscover: true, max: 3})
+               tab.addStorage(NodeTypePN, &simpleStorage{targetType: NodeTypePN, noDiscover: true, max: 8})
+               //tab.addStorage(NodeTypeEN, &KademliaStorage{targetType: NodeTypeEN})
+               //tab.addStorage(NodeTypeBN, &simpleStorage{targetType: NodeTypeBN, noDiscover: true, max: 3})
        case NodeTypeBN:
                tab.addStorage(NodeTypeCN, NewSimpleStorage(NodeTypeCN, true, 100, cfg.AuthorizedNodes))
                tab.addStorage(NodeTypePN, NewSimpleStorage(NodeTypePN, true, 100, cfg.AuthorizedNodes))
result

In v1.0.3, after several restarts, EN has hard time discovering PNs:

INFO[01/07,09:46:20 +09] [35] Mapped network port                       protobuf=tcp extport=32323 intport=32323 interface=NAT-PMP(192.168.0.1)
WARN[01/07,09:46:21 +09] [34] RetrieveNodes: Not Supported NodeType     Discover=Table NodeType=3
WARN[01/07,09:46:24 +09] [34] lookup: Not Supported NodeType            Discover=Table NodeType=3
WARN[01/07,09:46:24 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
ERROR[01/07,09:46:25 +09] [34] findNewNode: found nodes                  length=0 nodeType=2 entries=[]
WARN[01/07,09:46:25 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
WARN[01/07,09:46:25 +09] [34] RetrieveNodes: Not Supported NodeType     Discover=Table NodeType=3
WARN[01/07,09:46:26 +09] [34] RetrieveNodes: Not Supported NodeType     Discover=Table NodeType=3
WARN[01/07,09:46:28 +09] [34] lookup: Not Supported NodeType            Discover=Table NodeType=3
WARN[01/07,09:46:28 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
ERROR[01/07,09:46:29 +09] [34] findNewNode: found nodes                  length=0 nodeType=2 entries=[]
WARN[01/07,09:46:29 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
WARN[01/07,09:46:29 +09] [34] RetrieveNodes: Not Supported NodeType     Discover=Table NodeType=3
WARN[01/07,09:46:32 +09] [34] lookup: Not Supported NodeType            Discover=Table NodeType=3
WARN[01/07,09:46:32 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
ERROR[01/07,09:46:33 +09] [34] findNewNode: found nodes                  length=0 nodeType=2 entries=[]
WARN[01/07,09:46:33 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
WARN[01/07,09:46:34 +09] [34] RetrieveNodes: Not Supported NodeType     Discover=Table NodeType=3
WARN[01/07,09:46:36 +09] [34] lookup: Not Supported NodeType            Discover=Table NodeType=3
WARN[01/07,09:46:36 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
ERROR[01/07,09:46:37 +09] [34] findNewNode: found nodes                  length=0 nodeType=2 entries=[]
WARN[01/07,09:46:37 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3

However in v2.0.0-rc.1, using the same data directory, EN could find PN right away:

INFO[01/07,09:48:33 +09] [35] Mapped network port                       protobuf=tcp extport=32323 intport=32323 interface=NAT-PMP(192.168.0.1)
INFO[01/07,09:48:33 +09] [62] ValsetModule migrate complete
WARN[01/07,09:48:36 +09] [34] add(): Not Supported NodeType             Discover=Table NodeType=3
WARN[01/07,09:48:37 +09] [34] lookup: Not Supported NodeType            Discover=Table NodeType=3
WARN[01/07,09:48:37 +09] [34] ReadRandomNodes: Not Supported NodeType   Discover=Table NodeType=3
WARN[01/07,09:48:37 +09] [34] add(): Not Supported NodeType             Discover=Table NodeType=3
ERROR[01/07,09:48:38 +09] [34] findNewNode: found nodes                  length=1 nodeType=2 entries="[kni://fa7bebd3d535a5956acfe13914dee84cf93ad8aeba013cdd0dc7445473b44660280e909e641860450150f0da48de8296c53528ac57602c63cddaf42116526a05@147.92.173.40:32323?ntype=pn]"
INFO[01/07,09:48:38 +09] [33] [Dial] Add dial candidate from static nodes  id=fa7bebd3d535a595 NodeType=2 ip=147.92.173.40 mainPort=32323 port=[32323]

RPC API changes

  • TotalDifficulty and BlockScore fields removal #134
Details

We can see the difference in the rpc responses.

v1.0.3

> eth.getHeaderByNumber(kaia.blockNumber)
{
  baseFeePerGas: "0x5d21dba00",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0xe8d4a50fff",
  gasUsed: "0x0",
  hash: "0x3f7866da9b0e2512b89f8037b8f5052e0775b73923e8751e12eccbee9998745e",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  mixHash: "0x2e3370ac7b949a1659aec155e3f94b76c7b3071d2382818df77c713c7ffc9519",
  nonce: "0x0000000000000000",
  number: "0x67",
  parentHash: "0x170d8331910c0d6f89180c95711307618a4206c92d6264273d01a14e5f458d47",
  randomReveal: "0xa2d40a24e97357c99d15f750635ad3391cde8191ede5ec5c43154db090c1174f89573c40b6a61689346aa88ed07944a10676ffbad859433dabaa5c35627eba1d5c7f81e7b49808d5e56ca0482835e03e5bf4b80f4138ce7a83bb0e452ef07272",
  receiptsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x388",
  stateRoot: "0xc50887dc933b1dc81388f609c454541d3498e7cb919589b4f023cf13ef22b216",
  timestamp: "0x677c6a8a",
  totalDifficulty: "0x68",
  transactionsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
> kaia.getBlock(kaia.blockNumber)
{
  baseFeePerGas: "0x5d21dba00",
  blockScore: "0x1",
  extraData: "0xd883010003846b6c617988676f312e32322e31856c696e757800000000000000f89ed594f39fd6e51aad88f6f4ce6ab8827279cfffb92266b841b1b2c6657b4eb269a0b38fe701973e72a49ac4723b47768299542cfc8b17d6481841ef0fd3713507a06447660c303a41e209e32c2bbd10e12aa78da757e9fd8000f843b8415623914f378eb02531b516147ae0bd9c336ed673257aca3342b5c0ec7a6732316a76adb3a057a7496a3cca98e1a75e572926c39c9adc693a6189d282f3a56d2f00",
  gasUsed: 0,
  governanceData: "0x",
  hash: "0x758b16f68448949465502dc0245f878f576165af491654f2915bbace595fe717",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  mixHash: "0xc9717f8c41aa21274c6798c6fca038c86bb15d7ee0fde94e90b980787604f324",
  number: 295,
  parentHash: "0xf43d9b0b6bacd2e1e9987f20839a962f0d0e00a3fdcd41b0168a2d9b959916e1",
  randomReveal: "0x8fe0f5ccb6869410cd84529588306e695488236f65523cd3abd88ebe8fbdd98ab42671cd5727e6ec002ccbcb1308fa2618b641908469c6256b52704366aca538d7c31b9bf682843a904ba7e4b1a49ac38d17de771a1b4fb33918f83fe428cc11",
  receiptsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  reward: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  size: 763,
  stateRoot: "0x49cecdb82e9ad18f2a69f3f5815ca2a90a67d3db272688cfb0c8b2a3efd530a4",
  timestamp: 1736207178,
  timestampFoS: 97,
  totalBlockScore: "0x128",
  transactions: [],
  transactionsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  voteData: "0x"
}

v2.0.0-rc.1

> eth.getHeaderByNumber(kaia.blockNumber)
{
  baseFeePerGas: "0x5d21dba00",
  difficulty: "0x1",
  extraData: "0x",
  gasLimit: "0xe8d4a50fff",
  gasUsed: "0x0",
  hash: "0xdb6de1e06186c07d7ba9e1dbdad97613943d40176ed290256b04eb0dacd82663",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  mixHash: "0xa1213bb8b268729e2b038c526064eca3f0c966b47a9877c6cdeb1efa575277d5",
  nonce: "0x0000000000000000",
  number: "0x36",
  parentHash: "0x0618ba50dd8c0ca87bf0d906c0e5ec5ad22e2f59a4e1d776dbfcd53081c8d0d1",
  randomReveal: "0xb9e53401ceb6090a68a50ddf7a15fb1fd3cc02c5e15fe26a40ea5095943b6e53f3cd9e1c02ca88bf264fbf110aed36ab0ab571f03b714179dcdcbf52ea953f5972b8b71972cdd5838c2a37b0b11b21422e36939510cda015caa0f8af4927b2a2",
  receiptsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: "0x388",
  stateRoot: "0xf453b591d1b24c96b7a7b3f1b849c50750296e702027c451c0aa695d90ea4e62",
  timestamp: "0x677c6bc5",
  transactionsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
> kaia.getBlock(kaia.blockNumber)
{
  baseFeePerGas: "0x5d21dba00",
  blockScore: "0x1",
  extraData: "0xd883020000846b6c617988676f312e32322e31856c696e757800000000000000f89ed594f39fd6e51aad88f6f4ce6ab8827279cfffb92266b8416beca5282d9435db35e0cc1f00e63d0c2e24523c4c53560b7703c2cf0cb49c3e51f8557a92d0d6adaa80e180367a79f4a88d5f5d1c0dd55b40accf98946723d401f843b841023bd656a44bf675d6fc554857952fd86b8d96758805faaeafb381ee033951602c2479c2ac1de84f6f28fb95ed4c6833c30ea4ce49519ee610e7a5171cbc571d01",
  gasUsed: 0,
  governanceData: "0x",
  hash: "0xa368575de4091eb6d375513b64bec0c1e1f9a7405ef4c83e2dc19f0ecc8d8b40",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  mixHash: "0x197c47cfc39ba01ee2fa105e8eda28506b0e2a7cb43bdf191950b376df47f66d",
  number: 65,
  parentHash: "0x346b244097818ba78a2e86df61b5de228ad8569139e79a02b44a605571fb1206",
  randomReveal: "0xb4bebc3b81c721e4b3179b0d3928a69d9204d468f35dcbabd00a94bf7d3bbbf3480c577b4b87a9de315746526278056a09f19629e92efe7d39de165edf7c069a79af8e535acb2ca2a8d311a5349ddbe62637a6202e64cc6e9a0cf42f2185dc7a",
  receiptsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  reward: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  size: 761,
  stateRoot: "0x8eb5b37a9de7424c8d7337b54e528776aac0bbd68c4cf0035c66558a12425caa",
  timestamp: 1736207312,
  timestampFoS: 87,
  transactions: [],
  transactionsRoot: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  voteData: "0x"
}

@ulbqb
Copy link
Contributor

ulbqb commented Jan 16, 2025

EIP-2935 blockhash on state

Enviroment

  • version: v2.0.0-rc.2
  • setup: homi setup --gen-type local --cn-num 1 --prague-compatible-blocknumber 100
  • deploy system contract at block number 10
  • enable prague at block number 100
  • wait for over block number 10000

Test

I tried the bellow command for every i ∈ {2, 8, 9, 10, 11 98, 99, 100, 101, 102, 1000, 9000} and every j ∈ [1, 10000].

$ cast call 0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC $(printf "%064x" $i) \
  -b $j \
  -r $RPC_URL

Block hashes

number hash
2 0xbb8f24d44d3f0fb391568297dc0d0ebc01b4ba87c41c5b75144d2857c6230e48
8 0x5bd877f89f21ba658c916eb0277343093add26daa48ca5c8e0c70fc8744fbeed
9 0xb16c1316e5e1a35dd922341df2ad9b71fd00ff2779746314e4fa58401bc383b0
10 0x80b4f09f33f0063a60e6246d84fb661aa18c2eb1f685147ea4bf5f89c2d5f306
11 0xffb2d619aba23173920c69a458805ec6dac756afc0a881cd76d04735bc9216c8
98 0xc7cfcfb6bc383eedb792005c9e135d34fc8413054be676d6e259da56a50c45fe
99 0x02bddd2a0cf92b3a941a07e0f38853ab22469acbf2265a98d8b7062a12bbee62
100 0x3053aee98d3c3e1ec6e511fcbe30f41f27ea1e6b1528aaa4be368cffd5590cbf
101 0x7c633741094399a1662d4e57d63128ec85c760bd5243d33d927dc592415f7b96
102 0xbd7878601627c6ca0150aa5e22c708ede77436c640de2a2ab403705581b7d793
1000 0xaa35a5dd25e7e0d0ed62a70bfcd01939450639c16c5a66345513e539c33afc3e
9000 0x0337fc80f9d9f79eb81d8117902eb8d93661ee6f57f5c58e231a3d36dd97187f

Expected response

i j expected
x [1, 9] 0x
x [10, x] Error: server returned an error response: error code -32000: evm: execution reverted (if x>=10), none (otherwise)
x [x+1, x+8191] 0x0000000000000000000000000000000000000000000000000000000000000000 (if x < 100), blockHash(x) (otherwise)
x [x+8192, 10000] Error: server returned an error response: error code -32000: evm: execution reverted

Results

Open
i j response
2 [1, 9] 0x
2 [10, 8193] 0x0000000000000000000000000000000000000000000000000000000000000000
2 [8194, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
8 [1, 9] 0x
8 [10, 8199] 0x0000000000000000000000000000000000000000000000000000000000000000
8 [8200, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
9 [1, 9] 0x
9 [10, 8200] 0x0000000000000000000000000000000000000000000000000000000000000000
9 [8201, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
10 [1, 9] 0x
10 10 Error: server returned an error response: error code -32000: evm: execution reverted
10 [11, 8201] 0x0000000000000000000000000000000000000000000000000000000000000000
10 [8202, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
11 [1, 9] 0x
11 [10, 11] Error: server returned an error response: error code -32000: evm: execution reverted
11 [12, 8202] 0x0000000000000000000000000000000000000000000000000000000000000000
11 [8203, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
98 [1, 9] 0x
98 [10, 98] Error: server returned an error response: error code -32000: evm: execution reverted
98 [99, 8289] 0x0000000000000000000000000000000000000000000000000000000000000000
98 [8290, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
99 [1, 9] 0x
99 [10, 99] Error: server returned an error response: error code -32000: evm: execution reverted
99 [100, 8290] 0x02bddd2a0cf92b3a941a07e0f38853ab22469acbf2265a98d8b7062a12bbee62
99 [8291, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
100 [1, 9] 0x
100 [10, 100] Error: server returned an error response: error code -32000: evm: execution reverted
100 [101, 8291] 0x3053aee98d3c3e1ec6e511fcbe30f41f27ea1e6b1528aaa4be368cffd5590cbf
100 [8292, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
101 [1, 9] 0x
101 [10, 101] Error: server returned an error response: error code -32000: evm: execution reverted
101 [102, 8292] 0x7c633741094399a1662d4e57d63128ec85c760bd5243d33d927dc592415f7b96
101 [8293, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
102 [1, 9] 0x
102 [10, 102 ] Error: server returned an error response: error code -32000: evm: execution reverted
102 [103, 8293] 0xbd7878601627c6ca0150aa5e22c708ede77436c640de2a2ab403705581b7d793
102 [8294, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
1000 [1, 9 ] 0x
1000 [10, 1000] Error: server returned an error response: error code -32000: evm: execution reverted
1000 [1001, 9191] 0xaa35a5dd25e7e0d0ed62a70bfcd01939450639c16c5a66345513e539c33afc3e
1000 [9192, 10000] Error: server returned an error response: error code -32000: evm: execution reverted
9000 [1, 9] 0x
9000 [10, 9000] Error: server returned an error response: error code -32000: evm: execution reverted
9000 [9001, 10000] 0x0337fc80f9d9f79eb81d8117902eb8d93661ee6f57f5c58e231a3d36dd97187f

@shiki-tak
Copy link
Contributor

shiki-tak commented Jan 16, 2025

[WIP] EIP-2537 precompiles

Config

Result

@shiki-tak
Copy link
Contributor

shiki-tak commented Jan 19, 2025

EIP-7623 & KIP-223 calldata pricing

  • Setup
    • Run v1.0.3 and v2.0.0-rc.2 at local
  • Test Scripts
  • Checklist:
    • ChainDataAnchoring
    • EthereumAccessList
    • EthereumDynamicFee
    • EthereumSetCode
    • FeeDelegatedChainDataAnchoringWithRatio
    • FeeDelegatedChainDataAnchoring
    • FeeDelegatedSmartContractDeployWithRatio
    • FeeDelegatedSmartContractDeploy
    • FeeDelegatedSmartContractExecutionWithRatio
    • FeeDelegatedSmartContractExecution
    • FeeDelegatedValueTransferMemoWithRatio
    • FeeDelegatedValueTransferMemo
    • Legacy
    • SmartContractDeploy
    • SmartContractExecution
    • ValueTransferMemo
    • AccountCreation
    • AccountUpdate
    • Cancel
    • FeeDelegatedAccountUpdateWithRatio
    • FeeDelegatedAccountUpdate
    • FeeDelegatedCancelWithRatio
    • FeeDelegatedCancel
    • FeeDelegatedValueTransferWithRatio
    • FeeDelegatedValueTransfer
    • ValueTransfer

Result

@yoomee1313
Copy link
Contributor

yoomee1313 commented Jan 22, 2025

Test node is full-en node. v1.0.3 node for reference is archive node.

Staking APIs (kaiax/staking), Reward APIs (kaiax/reward), Supply APIs (kaiax/supply)

  • kaia_getRewards: reward-result.log
    • failed to get state for block number error's block number returns source number
    • getRewards call from the block 156660001 returns missing trie node error (v1.0.3 archive node doesn't return error) -> the calculated sourcenum is not multiple of block interval.
  • kaia_getStakingInfo: staking-result.log
    • [] -> none : empty list became none. please refer the result log.
    • since kore, useGini is false: it seems fine, but need to be checked.
    • failed to get state for block number error's block number returns source number
    • 162900479 returns missing trie node error (but v1.0.3 archive node doesn't return error)
  • kaia_getTotalSupply: supply-result.log
    • totalSupply, totalBurnt, zeroBurn, deadBurn became None (but v1.0.3 archive does not return none) -> seems minor.
  • goveranance_getRewardsAccumulated: accumulated.log
    • UTC became number ( 2019-06-26 08:01:12 +0000 UTC -> 1561536072)
    • 98347377 returns wrong value. please refer the log file.
    • since 119145599, it returns wrong value. please refer the log file.
    • since 156659999, it returns missing trie node (but v1.0.3 archive node does not return error)

Test files and steps

  • test-script.zip
  • steps
    • unzip and setup python virtual enviroment.(python -m venv venv & source venv/bin/activate).
    • install requests, subprocess. (pip3 install requests, subprocess)
    • run the test - it runs in kairos testnet.

@hyeonLewis
Copy link
Contributor

hyeonLewis commented Jan 23, 2025

Gov APIs (kaiax/gov), Consensus APIs (kaiax/valset)

  1. Governance (Kairos)
  • governance_nodeAddress: No problem
  • governance_votes: No problem (testing 162221160, 155903352, 155903442, 155903493, 126432843, 125383542, 118303506.
  • kaia_getParams:
    • Different types: reward.mintingamount, reward.minimumstake
      • v1.0.3: 'reward.minimumstake': '5000000', 'reward.mintingamount': '6400000000000000000'
      • v2.0.0: 'reward.minimumstake': 5000000, 'reward.mintingamount': 6400000000000000000
    • Different governance.deriveshaimpl field before block 112492800. Since 112492800, both returns 0. But it returns 2 in v1.0.3 before 112492800.
      • v1.0.3: 'governance.deriveshaimpl': 2
      • v2.0.0: 'governance.deriveshaimpl': 0
  • kaia_chainConfig:
    • Different governance.deriveshaimpl field before block 112492800. (same as getParams)
      • v1.0.3: 'deriveShaImpl': 2
      • v2.0.0: 'deriveShaImpl': 0
  1. Consensus

Check consensus APIs on private network. Using this to make validator demote/promote situations.

  • homi setup --cn-num 4 --baobab --address-book-mock --gen-type local

  • Replace output/cn2/bin/kcn with v2.0.0 binary and keep v1.0.3 for other CNs.

  • hh run src/stakingInterval/script/main.ts

  • After finishing above test, hh run src/v2-api/main.ts

  • kaia_getCommittee

  • kaia_getCommitteeSize

  • kaia_getCouncil

  • kaia_getCouncilSize

  • istanbul_getDemotedValidators

  • istanbul_getDemotedValidatorsAtHash: unknown block: backend: Fix wrong nil check #227

  • istanbul_getValidators

  • istanbul_getValidatorsAtHash

  • istanbul_getValidatorsAtHash

  • kaia_getBlockWithConsensusInfoByNumber (ByHash)

    • Checked committee and proposer fields
  • kaia_getBlockWithConsensusInfoByNumberRange (

    • Checked committee and proposer fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants