Commit graph

50 commits

Author SHA1 Message Date
Daniel Liu
001bd7ef3b
fix(eth/hooks,contracts): use parent-state randomize data for checkpoint validator verification (#2186)
Read randomize values at the checkpoint parent height during v1 HookValidator and HookVerifyMNs instead of the latest chain state. This fixes a sync-time race where historical checkpoint headers could be rejected with ErrInvalidCheckpointValidators and then accepted later after local state advanced.

The accompanying regression test now derives expected validators independently from HookValidator and the M2 generation path uses a local RNG source, removing CI-only nondeterminism during repeated verification.
2026-03-21 15:26:54 +08:00
benjamin202410
be36b32b3e
fix(consensus): fix config object not reference to same one and concurrency issues and refactor access pattern (#2146)
* bug fix for using same config object

* update

* change log level to trace on ispochswtich

---------

Co-authored-by: liam.lai <liam.lai@babylonchain.io>
2026-03-12 12:12:49 -07:00
Daniel Liu
2611f1dd9a
fix(all): fix typo foudation (#2063) 2026-02-28 18:00:55 +04:00
wit liu
a83c43f240
all: use 0x-prefix string for type Address in log message (#1874) 2025-12-19 08:55:21 +04:00
Daniel Liu
ebbbdf2bff
core/state: move state log mechanism to a separate layer #30569 #30732 (#1775) 2025-12-16 07:33:19 +04:00
wgr523
1089f0b4fe
record total minted API v2 (#1769)
* feat: GetTokenSupply API, total minted and burned

* feat: token supply API finish burned token. rename minted record functions

* fix(api): handle edge case about minus 1 for epoch in token supply

* fix: check both total minted and burned before breaking loop

* style: modify minor style

* style: modify by comment and rebase code

* chore: modify test based on statedb_utils
2025-12-09 19:43:19 +08:00
Daniel Liu
1990e73b3c
core, eth/hooks, internal/ethapi: rename xdc sort package (#1707) 2025-12-07 15:47:49 +05:30
Daniel Liu
627d77ae24
eth/hook: fix parameter mame mismatch in HookPenalties(), close XFN-141 (#1741) 2025-11-18 17:49:18 +05:30
Daniel Liu
6235de71ba
all: rework statedb utils (#1785) 2025-11-18 11:26:28 +05:30
Daniel Liu
9d85990309
all: fix missing nil check, close XFN-114 (#1695) 2025-11-01 23:21:44 +05:30
Daniel Liu
12668feab8 eth/hooks: use slices.SortStableFunc in engine_v2 2025-10-30 14:54:54 +08:00
wit liu
f709ef2edb
all: remove extra empty lines (#1574) 2025-10-08 12:25:10 +08:00
wgr523
968fb0124b
style: change limitPenaltyEpoch in config to real meaning, avoid +1 (#1538) 2025-09-19 13:43:31 -07:00
wgr523
b8e5baa978
all: fix minted token recorded value is zero (#1480) 2025-09-17 22:50:52 +08:00
wit liu
99e2885b03
all: fix misspell (#1510)
Co-authored-by: wit <wit765765346@gmail>
2025-09-17 08:27:52 +08:00
Daniel Liu
ad9003c41e
eth/tracers: live chain tracing with hooks #29189 (#1352)
Here we add a Go API for running tracing plugins within the main block import process.

As an advanced user of geth, you can now create a Go file in eth/tracers/live/, and within
that file register your custom tracer implementation. Then recompile geth and select your tracer
on the command line. Hooks defined in the tracer will run whenever a block is processed.

The hook system is defined in package core/tracing. It uses a struct with callbacks, instead of
requiring an interface, for several reasons:

- We plan to keep this API stable long-term. The core/tracing hook API does not depend on
  on deep geth internals.
- There are a lot of hooks, and tracers will only need some of them. Using a struct allows you
   to implement only the hooks you want to actually use.

All existing tracers in eth/tracers/native have been rewritten to use the new hook system.

This change breaks compatibility with the vm.EVMLogger interface that we used to have.
If you are a user of vm.EVMLogger, please migrate to core/tracing, and sorry for breaking
your stuff. But we just couldn't have both the old and new tracing APIs coexist in the EVM.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Matthieu Vachon <matthieu.o.vachon@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>
2025-09-09 17:30:56 +08:00
wgr523
4ec4a5390f
Consecutive penalty upgrade (#1053)
* feat: penalty upgrade, consecutive epochs penalty
can be unpenalized

* feat: use binary search inside penalty hook

* style: modification on style

* feat: in penaltyHook change startRange

* fix: add lastPenalty condition in HookPenalty V2
2025-06-25 01:12:56 -07:00
wgr523
e13265a7d7
record total minted into smart contract (#1026)
* feat: record total minted into smart contract

* feat: GetCurrentTotalMinted API
2025-06-16 02:31:33 -07:00
wgr523
6a38aa00aa
Reward float upgrade (#940)
* feat: use float type reward

* feat: add test of float reward
2025-04-16 02:03:41 -07:00
Gerui Wang
6bac06b1e7 feat: fixed reward per node (per capita) 2025-03-25 22:33:49 +08:00
Gerui Wang
84ae914350 feat: add TIPEpochHalving, better style 2025-03-25 22:16:35 +08:00
Wang Gerui
7c4668fa91 style: clean comment 2025-03-25 22:10:03 +08:00
wgr523
c36e4d54c0
Upgrade reward 2.0 (#865)
* refactor: reward hook gets prepared for upgrade

* feat: new reward hook, config change, unit tests

* add missing code

* feat: filter penalty in reward. add unit test

* update constant and config

---------

Co-authored-by: liam.lai <liam.lai@us>
2025-03-02 02:44:34 -08:00
wanwiset25
44ac46f676 add local xdpos function
add readme

changes to support xdpos2 protocol from block 0
2025-01-01 22:06:09 -05:00
Daniel Liu
82ff8c19a0 all: remove uses of untyped golang-lru 2024-12-21 14:39:26 +08:00
benjamin202410
a8560300a4
fix vote test and optimize log (#750)
Co-authored-by: liam.lai <liam.lai@us>
2024-11-29 03:14:25 -08:00
Daniel Liu
f9960875cc fix: staticcheck warning SA4003: every value of uint64 >= 0 2024-10-31 10:17:30 +08:00
Daniel Liu
c36642a0e1 all: fix staticcheck warning ST1008: error should be last return value 2024-10-31 09:51:47 +08:00
Daniel Liu
a79411fa06 all: fix staticcheck warning ST1005: incorrectly formatted error string 2024-10-24 09:48:20 +08:00
Daniel Liu
4976b7cbb3
Fix some panic cuased by nil block, statedb, header (#578)
* fix panic during rollback

* eth/hooks: check nil stateDB to fix issue #271

* internal/ethapi: fix eth_call crash

* all: check nil statedb

* eth: check nil block for tracer api

* internal/ethapi: check nil header and block
2024-08-02 17:05:53 -07:00
JukLee0ira
2d89951e5b all: use errrors.New instead of empty fmt.Errorf 2024-06-14 19:19:21 +08:00
JukLee0ira
0aab4ced98 common: add binary variables for system contract 2024-06-06 19:33:59 +08:00
JukLee0ira
08432b8a0f hook: remove redundant error check in function getValidators 2024-05-29 15:11:01 +08:00
Liam
c7a42fd7c9
resolve sync issue by passing right round number (#384) 2023-12-27 22:14:13 +11:00
Liam
84994df759
Merge pull request #351 from XinFinOrg/bump-golang-1.21
Bump golang 1.21
2023-11-07 10:35:42 +11:00
Daniel Liu
e2359d9b8c filter zero address in function GetCandidates 2023-10-24 12:15:24 +08:00
Daniel Liu
320b358830 replace package sort with common/sort 2023-10-23 22:51:06 +08:00
Liam Lai
5623ce8de0 merge from master 2023-07-30 16:50:45 +10:00
wgr523
a67b347ba8
fix comment of todo (#267) 2023-05-20 17:46:06 +08:00
Daniel Liu
3c21125da5 fix EmptyAddress 2023-03-16 11:47:39 +08:00
Liam
c4f9a552e5
Multi config bug fix (#216)
* refactor multi config
remove pool cleaner
correct message and log level
2022-12-17 20:23:46 +08:00
Liam
6ffbd3e141
Xin 259 support multi v2 config (#210)
* update timeout period and waittime

* remove wrong comment

* update config for preparing test
2022-12-06 20:08:56 +08:00
Liam
a75c315eb5
fix penalty calculation bug (#189) 2022-10-09 14:06:04 +08:00
Liam
765d962d8b
xin-202 fix sync issue on v2 blocks (#108)
* fix sync issue on v2 blocks

* change back to get header method
2022-07-12 16:57:18 +02:00
Liam
ca6a645fca
refactor and improve log (#92)
* refactor and improve log

* fix conflict and test
2022-05-23 02:34:32 +01:00
Liam
5fffa0cd43
xin-188 update penalty limit epoch constant for v2 and shorter test (#87) 2022-05-18 11:17:32 -04:00
wgr523
89acbdd742
XIN-121 Reward hook (#57)
* v2 Hook Reward, need test

* test reward

* fix RewardHook due to modifying params config directly (#56)

* more test

* finish test

Co-authored-by: Jerome <wjrjerome@gmail.com>
2022-02-19 15:31:19 +11:00
wgr523
9b47146120
add calcMasternodes, HookPenalty for v2, tests (#52) 2022-02-13 22:15:23 +08:00
Jianrong
e34311ff45 Remove unused consensus v1 methods 2021-10-10 16:04:34 +11:00
Jianrong
48be4e4ca7 Move consensus hooks to its own package 2021-10-10 16:04:32 +11:00