Skip to content

merge upsource#1

Open
fighterlyt wants to merge 58 commits intofighterlyt:masterfrom
fbsobreira:master
Open

merge upsource#1
fighterlyt wants to merge 58 commits intofighterlyt:masterfrom
fbsobreira:master

Conversation

@fighterlyt
Copy link
Owner

No description provided.

fbsobreira and others added 30 commits July 13, 2021 23:54
* Add new method for call approve function in contract

* Fixed TRC20Approve Bug
* replace deprecate protobuf package

* .

* improve tx parser

* contract tests/examples

* Account sign and verify message
* add staking 2.0 operations

* update staking 2.0

* adjust model

* update staking v2.0 operations

* skip tests only for testnet nile
* upgrade deprecated packages

* golang packages

* btcd

* goethereum
Co-authored-by: gribanoid <gricrypto007@gmail.com>
tiagolpires and others added 28 commits April 9, 2023 07:36
* upgrade import btcec to v2

* change package name to test

* upgrade btcec to v2

* Revert "change package name to test"

This reverts commit 46b73df.

* Go mod tidy
Signed-off-by: ciricc <facevk.02@mail.ru>
* Fix reflecting issue for TransferContract after json unmarshaling

* Change type conversion from []interface{} to []string
* check erro on git version

* random pk and address from pk cli

* mnemonic to privatekey example/test

* ETH recover not implemented for windows build

* add windows xbuild

* update readme

* update go-ethereum v1.12.2
* update go version

* update dependencies

* add GitHub Actions workflow for running tests

* fix tests

* enhance gen-proto script && update tron proto

* fix grpc insecure deprecated Dial

* refactor command help handling and improve error handling in config saving

* refactor error handling and replace ioutil with os package functions

* refactor tests to remove unnecessary gRPC connection setup and improve error assertions

* remove unused writeKeyFile function and delete plain keystore implementation

* update go.mod, crypto.UnmarshalPubkey, add signature length validation

* add CI targets for testing and linting in Makefile

* add GitHub Actions workflows for build, format, and test processes

* ci: add Git hooks for commit message validation and pre-commit checks

* chore: add issue and pull requests templates

* fix: install goimport in workflow

* ci: update golangci-lint installation method in format workflow

* feat: add methods to retrieve energy, bandwidth, and memo fee #134 - Tron TIP-586

* fix: remove unused parameter from UnDelegateResource method #109
* fix: rename init function to InitConfigDir for clarity (#147)

* fix: ensure home directory is created if it doesn't exist during keystore import
…ion (#153)

* fix: retract v2 versions to resolve module versioning issue

Add retract directives for all v2.x.x versions that were incorrectly
tagged without /v2 in the module path. This ensures proper version
resolution for users and allows continuation with v1.x.x releases.

* docs: Add comprehensive documentation for GoTRON SDK

- Add complete documentation structure in docs/ directory:
  - installation.md: Multi-platform installation guide with troubleshooting
  - cli-usage.md: Complete CLI command reference with examples
  - sdk-usage.md: Go SDK patterns, examples, and best practices
  - api-reference.md: Full API documentation for all packages
  - examples.md: Practical examples and complete applications
- Rewrite README.md with modern structure and correct CLI syntax

* fix: update comment for clarity in address test

* feat: add IsValid method to validate TRON addresses with comprehensive tests (#152)
Remove redundant error checking block in pkg/client/account.go
that was duplicated at lines 452-454.

Fixes #160
* feat(keys): implement GenerateKey function for private key generation

* feat(keys): add functions to retrieve private keys from hex and bytes

* feat(address): add functions to convert btcec public and private keys to TRON addresses

* feat(transaction): implement SignTransaction function for transaction signing

* feat(transaction): refactor SignTransaction to use ecdsa.PrivateKey directly

* feat(api): add SetData and UpdateHash methods for TransactionExtention

* fix(docs): Review and update examples code

* fix(docs): Correct API reference documentation and improve method signatures
)

* fix: replace deleted tyler-smith/go-bip39 with fbsobreira/go-bip39

  The upstream repository github.com/tyler-smith/go-bip39 has been deleted.
  This change migrates to github.com/fbsobreira/go-bip39 v1.2.0, a maintained fork created from a cached copy of the original library.

  Changes:
  - Replace go-bip39 import in cmd/subcommands/keys.go
  - Replace go-bip39 import in pkg/keys/mnemonic.go
  - Replace go-bip39 import in pkg/mnemonic/mnemonic.go
  - Update go.mod and go.sum with new dependency
  - Update golang.org/x dependencies to latest versions

* fix: update energy estimate test to use a range for stability
…ilds (#174)

On non-CGO builds (e.g., Windows), go-ethereum's crypto.Sign() validates
that the private key's curve is its own S256() instance. Keys from
btcec.ToECDSA() use btcec's secp256k1 curve object, which fails this
pointer comparison even though the curves are mathematically identical.

Round-trip the key bytes through crypto.FromECDSA/ToECDSA to ensure the
correct curve instance is set. This is a no-op for keys already using
go-ethereum's curve.

Closes #173
…ns (#175)

Add method to query resources delegated to an account by other accounts
using Stake 2.0. Uses FromAccounts from GetDelegatedResourceAccountIndexV2
which was previously unused in the SDK.

Closes #171
Resolves all 5 Dependabot security alerts:
- CVE for DoS via malicious p2p message (high)
- CVE for DoS affecting vulnerable nodes (high)
- CVE for high CPU usage via malicious p2p message (high)
- CVE for improperly validated ECIES public key (medium)
- CVE for DoS via malicious p2p message (medium)

Also updates transitive dependencies: grpc, protobuf,
gnark-crypto, blst, testify, and golang.org/x/sys.
Configure AI-powered code reviews with path-specific instructions
for protobuf, CLI, and client packages.
…#179)

* fix(abi): support overloaded methods in GetParser and GetInputsParser

GetParser and GetInputsParser previously matched ABI entries by name
only, always returning the first match. This caused incorrect results
for contracts with overloaded methods (same name, different parameters).

The method parameter now accepts a full signature (e.g.
"rollDice(uint256,uint256,address)") to select the exact overload.
Plain method names remain supported for backward compatibility.

Fixes #118

* style(abi): fix struct field alignment in test

* fix(abi): restrict lookup to function entries only

Address PR review feedback:
- Filter ABI entries to Function type only in GetParser and
  GetInputsParser, preventing name collisions with events/constructors
- Skip canonicalization via eABI.NewType since go-ethereum rejects
  non-canonical types (e.g. "uint") and the Solidity compiler always
  emits canonical forms — raw type strings match correctly as-is
- Add tests for entry type filtering and signature edge cases

* test(abi): set explicit entry Type in TestMatchEntry fixture
* feat(abi): add ParseTopicsIntoMap and GetEventParser (#110)

Add utilities for parsing event log topics with automatic TRON address
conversion:

- GetEventParser: extracts indexed and non-indexed argument lists from
  ABI event entries
- ParseTopicsIntoMap: wraps ethereum's ParseTopicsIntoMap and converts
  any decoded Ethereum addresses to TRON format (0x41 prefix)

Closes #110

* test(abi): verify full address bytes in ParseTopicsIntoMap test

Assert the payload bytes of converted TRON addresses, not just the
0x41 prefix, for stronger test coverage.
JSON unmarshaling produces []interface{} but GetPaddedParam only
accepted []string for integer arrays, causing a type assertion failure.

- Add toStringSlice() helper to accept both []string and []interface{}
- Add convertSmallIntSlice() to handle int/uint arrays with size <= 64
- Fix typo in error message ("unints" -> "ints")

Closes #120
The SliceTy handler in GetPaddedParam had no case for BytesTy elements,
causing bytes[] parameters to be passed through without encoding.

Add handling that converts each element via convertToBytes and packs
them as a [][]byte slice for proper ABI encoding.

Closes #131
* ci: add GoReleaser and release workflow

Add automated release pipeline triggered by version tags (v*):
- GoReleaser v2 config building tronctl for 6 targets
  (linux/darwin/windows × amd64/arm64)
- GitHub Actions release workflow with test gate
- Update all workflow actions to latest versions
- Remove artifact upload from build workflow
- Add dist/ to .gitignore

* refactor(ci): reuse test workflow in release pipeline

Convert test.yaml to a reusable workflow (workflow_call) and
call it from release.yaml instead of duplicating the test job.

* fix(ci): scope write permission to release job only

Move contents:write from top-level to the release job so the
test job runs with default read-only permissions.
* test: improve SDK test coverage from 3% to 54%

Add comprehensive unit tests across all pure SDK packages with
table-driven tests, testify assertions, and edge case coverage.

Packages covered:
- pkg/common/decimals: 100% (13 math functions)
- pkg/common: 94% (hex, hash, base58, presentation)
- pkg/common/numeric: 93% (50+ Dec operations)
- pkg/keys/hd: 96% (BIP44 HD wallet with BIP32 test vectors)
- pkg/address: 92% (address conversions and round-trips)
- pkg/keys: 44% (key generation, encoding, mnemonic derivation)
- pkg/keystore: 71% (encrypt/decrypt, account CRUD, sign/verify)
- pkg/contract: 100% (ABI JSON parsing)
- pkg/abi: 100% (ABI encoding/decoding, event parsing)
- pkg/account: 85% (import/export/removal with temp dirs)
- pkg/mnemonic: 100% (BIP39 generation and validation)
- pkg/store: 74% (local account management)

Bug fixes discovered during testing:
- Fix Pow(x, 0) returning x instead of 1
- Fix EncodeCheck mutating caller's input slice
- Fix nil dereference in ExportPrivateKey/ExportKeystore
- Fix DerivePrivateKeyForPath empty segment handling
- Add legacy ABI stateMutability resolution (constant/payable)

Also:
- Exclude pkg/proto and cmd from coverage reporting
- Add Codecov integration to CI workflow
- Refactor store path helpers to support test isolation

* chore: fix goimports formatting

* fix: address PR review feedback from CodeRabbit

- Add gitleaks:allow annotation to test private key constant
- Propagate os.RemoveAll error in RemoveAccount instead of ignoring it
- Use non-zero bytes for valid secp256k1 private key test case
- Add path traversal prevention for account names in ImportKeyStore
- Zero sensitive seed and master key material after use in mnemonic derivation

* fix: add ZeroBytes utility and zero chain code in mnemonic derivation

- Add common.ZeroBytes helper for wiping sensitive byte slices
- Use ZeroBytes to zero seed, master, and chain code in mnemonic derivation
- Add gitleaks:allow annotations to all test key hex literals

* fix(keys): bound derivation index and zero private key bytes

- Reject index > math.MaxUint32 to prevent uint32 truncation
- Zero derived private key bytes after btcec conversion
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

Successfully merging this pull request may close these issues.