Skip to content

Tags: core-coin/go-core

Tags

v2.2.1

Toggle v2.2.1's commit message

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
SC api extensions 01 (#481)

* Adds synced status API

Implements the `xcb_synced` API method, providing information about
the node's sync status and a subscription for real-time updates.
This allows clients to monitor the progress of blockchain synchronization.

* Adds smart contract API for token symbols

Introduces a new smart contract API (scapi) to retrieve token symbols,
including a subscription mechanism for real-time updates.

Adds `sc_symbol` RPC method to retrieve token symbols from contracts,
handling different symbol function selectors and string encodings.
Also provides a `symbol` subscription for real-time updates on symbol changes.

Implements dynamic string decoding to handle responses from contract calls.

* Adds name retrieval to smart contract API

Adds functionality to retrieve the name of a token contract via the `name()` function.
It attempts multiple function selectors to accommodate variations in contract implementations.
Also includes subscription functionality for real-time name updates.
Includes tests to ensure the dynamic string decoding works correctly with name examples.

* Adds CBC20 token support

Adds support for fetching the symbol, name, and balance of CBC20 tokens.

Updates the smart contract API to use CBC20 function selectors
for symbol and name retrieval, and adds a new BalanceOf method
to retrieve token balances. Also includes unit tests to verify
the correctness of the BalanceOf implementation.

* Adds decimals function for CBC20 tokens

Implements a new API method to retrieve the number of decimal places used by a given CBC20 token contract.

This information is crucial for displaying token amounts correctly and performing accurate calculations.

Includes unit tests to ensure correct function data construction and response decoding.

* Adds TotalSupply method to smart contract API

Implements the `TotalSupply` method in the smart contract API to retrieve the total supply of a given token contract.

Includes corresponding client-side implementation and unit tests for data construction and response decoding.

* Adds `sc_length` method to retrieve contract code size

Adds a new `sc_length` method to the SmartContract API, which allows retrieving the size of a contract's code in bytes.

This method fetches the contract code using `xcb.getCode` and returns the code's byte size, addressing the need to determine the size of deployed contracts. It handles cases where the address is an EOA or the contract has empty code, returning 0 in those scenarios.

Includes a comprehensive test suite to validate the function's logic, particularly focusing on the JavaScript example provided by the user and ensuring accurate parsing.

* Adds CIP-150 Key-Value metadata retrieval

Implements functionality to retrieve key-value metadata from smart contracts adhering to the CIP-150 standard.

This includes a new `GetKV` method that retrieves metadata, along with supporting functions to check key existence and sealed status. A corresponding data structure to hold the results is also added.

The client is updated to support the new sc_getKV method.

A comprehensive set of tests are added to verify correct behaviour, including mock contract interactions and tests for sealed/unsealed keys.

* Implements CIP-150 ListKV method

Adds the `ListKV` method to the Smart Contract API, enabling retrieval of keys and values from contracts implementing the CIP-150 standard.

This method supports fetching all keys with their associated values and sealed status, or filtering for only sealed keys. It includes function selectors and decoding logic for handling dynamic arrays of strings as required by CIP-150.

Also adds tests to verify basic functionality and validate function selectors.

* Adds TokenURI method for retrieving NFT metadata

Implements the `TokenURI` method to retrieve the token URI for a given NFT token ID from a CoreNFT contract, adhering to the CIP-721 standard.

This allows applications to fetch metadata associated with specific NFTs.

Includes unit tests to verify the functionality and correctness of the `TokenURI` method, including function selector validation, data construction, and interaction with a mock contract.

* Adds smart contract event subscriptions

Adds subscription methods for various smart contract events,
including balance changes, decimal updates, total supply,
code length, key-value metadata, and token URIs.

These subscriptions allow clients to receive real-time updates
on specific smart contract properties.

The initial implementation provides a basic monitoring loop
and may require further refinement for production use.

* Adds `xcb_composeTransaction` RPC method

Adds a new `xcb_composeTransaction` RPC method, allowing users to compose transactions with automatic nonce, energy, and energy price estimation.

If `sign=true`, the transaction is signed and submitted. Otherwise, it returns the transaction data for external signing.

Also includes the `sc` module to the default HTTP and WS modules.

Adds tests to verify the structure of the new arguments and results structs.

* Adds price feed functionality to SCAPI

Adds `GetPrice` and `GetPriceSubscription` methods to the Smart Contract API,
enabling retrieval and subscription to price updates from PriceFeed contracts
according to CIP-104.

This allows clients to access real-time price data from on-chain sources.
The `GetPriceSubscription` uses a ticker to periodically check for price
changes and notifies subscribers if the price has changed by more than 1%.

* Adds token expiration status check

Implements a method to check token expiration status based on the CIP-151 Token Lifecycle Metadata Standard.

This includes fetching tokenExpiration and tradingStop metadata,
comparing the expiration timestamp with the current block timestamp,
and providing real-time updates via a subscription.

* Adds KYC verification via smart contract

Implements KYC verification functionality using CorePass KYC smart contracts.

This includes:
- Adding `GetKYC` and `GetKYCSubscription` methods to check user KYC status
- Defining `KYCResult` struct to represent verification results
- Implementing a subscription mechanism for real-time KYC status updates.

The implementation uses the standard "KYC" field within CorePass contracts
for verification, ensuring compatibility with the Core Blockchain system.

* changed function selector to NIST SHA3
## What ❔
Changed known functions selectors to be hashed by NIST SHA3 which is used in Core Blockchain
## Why ❔
Need to have compatibility with hashing system

* Fixes dynamic string decoding in SCAPI

Corrects the dynamic string decoding logic to handle both null-terminated and length-prefixed strings correctly.

The previous implementation had issues with strings of bytes32 type,
and also did not correctly return the string data for cases where the data was present with an offset and length.

This change ensures accurate and reliable string retrieval from smart contracts.

* Enhances smart contract API for view calls

Improves the smart contract API by adding security enhancements,
optimizations, and support for retrieving data from smart contracts.

This includes:
- Centralizing view call message creation for consistency.
- Adding response size limits to prevent DoS attacks.
- Validating offset and length values to prevent integer overflows.
- Returning `hexutil.Big` instead of `big.Int` for consistency
  with other core blockchain API functions.

* Improves `EstimateEnergy` and `ComposeTransaction`

Updates `EstimateEnergy` to use the latest block for estimation.

Enhances `ComposeTransaction` to return a more structured transaction result,
including only meaningful transaction fields. It also now includes the
network ID in the transaction response.

* Returns contract values as hexutil.Big

Updates the `Decimals` and `Length` functions to return contract values as `hexutil.Big` instead of `uint8` and `uint64` respectively.

This change ensures consistency in how contract values are handled and provides better compatibility with other parts of the system that expect `hexutil.Big` values.

* Fix(scapi): robust KV decoding, sealed-list shape, and large-response fallback; include network_id in compose

* fix: sc_getKYC proper call

* Renames symbol to ticker for CBC20 token API

Updates the smart contract API to use the term "ticker"
instead of "symbol" for retrieving the token ticker symbol.
This change ensures consistency with common terminology
and improves clarity in the API. It also updates related
subscription methods.

---------

Co-authored-by: Mykhailo Slyvka <misha.slyvka@wallit.eu>

v2.1.12

Toggle v2.1.12's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix tests for darwin arm64 (increase timeouts) (#483)

v2.1.11

Toggle v2.1.11's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Build x86_64 on ubuntu-latest and arm64 on raspbian-private runners (#…

…479)

v2.1.10

Toggle v2.1.10's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Build a new release, update go packages for darwin (#478)

v2.1.9

Toggle v2.1.9's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix graphql address parse (#475)

v2.1.8

Toggle v2.1.8's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
modify devp2p testdata (#474)

v2.1.7

Toggle v2.1.7's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix devp2p (#473)

* fix devp2p

* add new acc for devp2p genesis

v2.1.6

Toggle v2.1.6's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
use the latest go 1.21 (#471)

v2.1.5

Toggle v2.1.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
use the latest go 1.21 (#471)

v2.1.4

Toggle v2.1.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Update trusted checkpoint on Devin (#463)

* Added checks for addresses and txs. Skipping dev address and bad tx hash (#460)

* Added checks for addresses and txs. Skipping dev address and bad tx hash

* skip ZeroNetworkIDTxHash in block validator

* new devin genesis preallocation

* fix tests

* add new address to devin alloc (#462)

* add new address to devin alloc

* fix tests

* update trusted checkpoint

* fix devin genesis (#464)

* fix xcbkey networkID flag (#467)