Commit graph

220 commits

Author SHA1 Message Date
Daniel Liu
d4a6f43ef2
refactor(core/txpool): migrate tx subscription to SubscribeTransactions #28243 (#2125)
* refactor(txpool): remove wrapper type #27841

Partial backport of ethereum/go-ethereum PR #27841, limited to txpool wrapper removal.

- Migrate txpool interfaces/call sites from `*txpool.Transaction` to `*types.Transaction`
- Update eth/miner/contracts paths and related tests accordingly
- No intended behavior change

Blob sidecar validation/handling changes from upstream are not included here.

* refactor(core/txpool): migrate tx subscription to SubscribeTransactions #28243

Replace the old SubscribeNewTxsEvent-style plumbing with the new
SubscribeTransactions(ch, reorgs) interface across txpool, eth protocol
manager, API backend, miner worker, and test helpers.

Key changes:
- Extend txpool/subpool tx subscription interface with a reorgs flag
- Route eth tx announcement path to reorgs=false (new tx announcements only)
- Route API/miner subscriptions to reorgs=true
- Move subscription-scope cleanup to TxPool.Close()
- Add Gas field to LazyTransaction in legacy pending view

Note:
LegacyPool currently cannot strictly separate newly seen and resurrected txs,
so the reorgs flag is accepted for API compatibility and future blob-subpool
integration.
2026-03-10 18:44:38 +05:30
Daniel Liu
2611f1dd9a
fix(all): fix typo foudation (#2063) 2026-02-28 18:00:55 +04:00
Daniel Liu
e77ac510d0
all: replace Div/Mul with Rsh/Lsh if possible #29911 (#1966) 2026-01-29 11:31:58 +05:30
Daniel Liu
b3d354a897
all: move main transaction pool into a subpool #27463 (#1890) 2026-01-05 15:43:50 +05:30
wit liu
55c2d47c45
all: use 0x-prefix string for type Address in error message (#1835) 2025-12-23 15:39:23 +05:30
Daniel Liu
639531aae9
contracts, tests: fix global variable modifications and remove unsafe parallelism (#1882)
Add defer cleanup for global variables and remove t.Parallel() where
global state is modified to prevent race conditions and test pollution.

Changes:

1. tests/vm_test.go:
   - Add defer to restore common.TIPXDCXCancellationFee
   - Remove t.Parallel() since modifying global variable makes concurrent
     execution unsafe, even with defer cleanup
   - Prevents potential race conditions with other tests in the package

2. contracts/tests/Inherited_test.go:
   - Add defer to restore common.TIPXDCXCancellationFee
   - No t.Parallel() present, so safe with defer alone

3. contracts/trc21issuer/trc21issuer_test.go:
   - Add defer to restore common.TRC21IssuerSMC (was missing)
   - Fix existing bug: restore correct variable common.TRC21GasPriceBefore
     instead of common.TIPTRC21Fee
   - Remove unused variables: token, delay

Rationale for removing t.Parallel():
While defer ensures cleanup after test completion, during test execution
the modified global variable is visible to all concurrent tests. Even
though tests/vm_test.go is currently the only test modifying
TIPXDCXCancellationFee, removing t.Parallel() is the safer approach to
ensure complete test isolation and prevent timing-dependent behavior.

This follows the same principles as the txpool MinGasPrice fix: global
variable modifications should not occur during concurrent test execution.
2025-12-22 12:00:39 +05:30
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
70755237e7
contracts, core/rawdb: refactor read and write randomizeKey (#1806) 2025-12-09 11:01:37 +05:30
wit liu
d6309612fc
all: fix unnecessary whitespace (#1800) 2025-12-08 15:07:11 +05:30
wit liu
66e96b507c
all: use 0x-prefix for Address type in log (#1830) 2025-12-07 15:36:36 +05:30
Daniel Liu
6235de71ba
all: rework statedb utils (#1785) 2025-11-18 11:26:28 +05:30
wit liu
39eb15531d
all: fix whitespace error of golangci-lint, remove extra empty lines (#1676) 2025-11-17 11:16:09 +05:30
Daniel Liu
eef5242fa3
all: pre-allocate memory for slices and maps, close XFN-148 (#1714) 2025-11-14 20:13:36 +05:30
Daniel Liu
c3c3d03551
common: fix gas fee mismatch before TIPTRC21Fee, close XFN-51 (#1636) 2025-11-03 16:24:14 +05:30
Daniel Liu
c7fb2e875d
consensus, contracts: check input length of ExtractValidatorsFromBytes, close XFN-14 (#1608) 2025-10-08 13:16:01 +08:00
wit liu
f709ef2edb
all: remove extra empty lines (#1574) 2025-10-08 12:25:10 +08:00
wit liu
9ce02a7010
all: fix goimports (#1560) 2025-09-24 07:51:10 +08:00
Daniel Liu
31f5c7da88
all: remove deprecated uses of math.rand #26710 (#1549) 2025-09-22 20:42:14 +08:00
wit liu
590cbafae9
all: fix goimports (#1521)
Co-authored-by: wit <wit765765346@gmail>
2025-09-21 18:57:54 +08:00
Wanwiset Peerapatanapokin
1f6bd2bae5
Merge pull request #1280 from XinFinOrg/XDPoSv2-privatenet-improve-genesis
Improve genesis for easy privatechain deployment
2025-09-20 19:03:52 +04:00
wit liu
e9da4ca95b
all: fix ineffassign (#1516)
Co-authored-by: wit <wit765765346@gmail>
2025-09-17 08:49:28 +08:00
wit liu
4a6fccaf69
all: fix whitespace (#1506)
Co-authored-by: wit <wit765765346@gmail>
2025-09-17 08:23:06 +08:00
wit liu
1fe81d541d
all: fix goimports (#1495)
Co-authored-by: wit <wit765765346@gmail>
2025-09-17 08:15:43 +08:00
wanwiset25
a1e5a98377 update validator initial configs 2025-09-14 15:19:19 +04:00
wit765
12eab8e785
all: rename ChainId to ChainID #16853 (#1456)
Co-authored-by: wit <wit765765346@gmail>
2025-09-09 22:54:34 +08:00
Daniel Liu
06b2524fb2
all: use fmt.Appendf instead of fmt.Sprintf where possible #31301 (#1432) 2025-09-06 17:12:19 +08:00
Daniel Liu
0be5580b98
all: use big.Sign to compare with zero #29490 (#1387) 2025-08-28 18:56:39 +08:00
benjamin202410
3e43756fd7
fix: add TIP condition for reward bug fix (#1360)
Co-authored-by: liam.lai <liam.lai@us>
2025-08-20 01:25:44 -07:00
benjamin202410
3cea40cf9d
fix: owner and foundation same address for reward (#1024)
Co-authored-by: liam.lai <liam.lai@us>
2025-05-01 08:46:09 -07:00
Daniel Liu
c73a0aa929 core/state: fix state iterator (#19127) 2025-03-28 22:34:59 +08:00
JukLee0ira
d6b136ed7c
consensus, internal, contracts: remove extra hash and string conversions (#830)
* consensus, internal: remove extra hash conversions

* contracts: remove extra string conversions
2025-02-07 13:59:07 +08:00
Daniel Liu
b6f3007af1 core: move genesis alloc types to core/types (#29003) 2025-01-24 16:54:12 +08:00
Daniel Liu
c1913bb22a accounts/abi/bind/backends: replace NewSimulatedBackend with NewXDCSimulatedBackend 2025-01-24 16:54:12 +08:00
Daniel Liu
b0063d39b9 accounts/abi: ABI explicit difference between Unpack and UnpackIntoInterface (#21091)
* accounts/abi: refactored abi.Unpack

* accounts/abi/bind: fixed error

* accounts/abi/bind: modified template

* accounts/abi/bind: added ToStruct for conversion

* accounts/abi: reenabled tests

* accounts/abi: fixed tests

* accounts/abi: fixed tests for packing/unpacking

* accounts/abi: fixed tests

* accounts/abi: added more logic to ToStruct

* accounts/abi/bind: fixed template

* accounts/abi/bind: fixed ToStruct conversion

* accounts/abi/: removed unused code

* accounts/abi: updated template

* accounts/abi: refactored unused code

* contracts/checkpointoracle: updated contracts to sol ^0.6.0

* accounts/abi: refactored reflection logic

* accounts/abi: less code duplication in Unpack*

* accounts/abi: fixed rebasing bug

* fix a few typos in comments

* rebase on master

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
f542e463d3 accounts: implement simple checkpoint syncing (#19543) 2025-01-24 16:18:29 +08:00
Daniel Liu
eb90b2899f backends: increase gaslimit in order to allow tests of large contracts (#17358) 2025-01-24 16:18:28 +08:00
JukLee0ira
653b59710e core/rawdb: separate raw database access to own package (#16666 #19345) 2025-01-22 15:19:39 +08:00
Daniel Liu
7bbb05d672 contracts: remove ens 2025-01-16 08:50:16 +08:00
Daniel Liu
28739d7863 common: remove usage of deprecated function (#21610) 2024-12-28 09:06:30 +08:00
Daniel Liu
82ff8c19a0 all: remove uses of untyped golang-lru 2024-12-21 14:39:26 +08:00
Daniel Liu
ec4ca1ed6a all: replace log15 with slog (#28187) 2024-11-15 10:02:42 +08:00
Daniel Liu
8b2e8d9b3a all: refactor txpool into it's own package in prep for 4844 (#26038) 2024-11-01 11:36:53 +08:00
Daniel Liu
5132d7f7e0 contracts: fix staticcheck warning S1025: unnecessary fmt.Sprintf("%s", x) 2024-10-31 21:48:23 +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
a5bc0baba9 all: fix staticcheck warning ST1019: import package twice 2024-10-28 17:45:19 +08:00
Daniel Liu
fbecb8c5a5 all: fix staticcheck warning ST1006: don't use generic name self
The name of a method’s receiver should be a reflection of its identity;
often a one or two letter abbreviation of its type suffices (such as
“c” or “cl” for “Client”). Don’t use generic names such as “me”, “this”
or “self”, identifiers typical of object-oriented languages that place
more emphasis on methods as opposed to functions. The name need not be
as descriptive as that of a method argument, as its role is obvious and
serves no documentary purpose. It can be very short as it will appear
on almost every line of every method of the type; familiarity admits
brevity. Be consistent, too: if you call the receiver “c” in one method,
don’t call it “cl” in another.
2024-10-25 21:30:54 +08:00
Daniel Liu
dd6822bc3c internal/ethapi, contracts/trc21issuer: fix staticcheck warning SA1012: pass nil Context 2024-10-25 18:29:08 +08:00
Daniel Liu
c6e4e880ea all: fix staticcheck warning SA4006: never used value 2024-10-24 17:37:19 +08:00
Daniel Liu
5bc578f4bc contracts: log Signer reward from Info to Debug 2024-08-21 15:16:38 +08:00
Liam Lai
d28c7f659d rebase from dev-upgrade 2024-06-19 16:05:08 +08:00