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

Refactor Tokens contract #518

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/komodo_mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Build (macOS)
run: |
# flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
# flag for some CC tests transactions - therefore DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/
./zcutil/build-mac-dtest.sh -j4
tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ Makefile.in
configure
doc/man/Makefile.in
src/Makefile.in
src/cc/customcc.so
src/cc/libcc.so
src/libcc.so
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,6 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-man

clean-local:
rm -rf test_bitcoin.coverage/ zcash-gtest.coverage/ total.coverage/

clean-all: clean-local
$(MAKE) -C src clean-all
5 changes: 2 additions & 3 deletions depends/hosts/linux.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
linux_CFLAGS=-pipe
linux_CXXFLAGS=$(linux_CFLAGS)

linux_release_CFLAGS=-O1
linux_release_CFLAGS=-O3
linux_release_CXXFLAGS=$(linux_release_CFLAGS)

linux_debug_CFLAGS=-O1
linux_debug_CFLAGS=-g -O0
linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)

linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

ifeq (86,$(findstring 86,$(build_arch)))
Expand Down
11 changes: 5 additions & 6 deletions depends/hosts/mingw32.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
mingw32_CC=x86_64-w64-mingw32-gcc-posix
mingw32_CXX=x86_64-w64-mingw32-g++-posix
mingw32_CFLAGS=-pipe -std=c11
mingw32_CXXFLAGS=$(mingw32_CFLAGS) -std=c++11
mingw32_CXXFLAGS=-pipe -std=c++11

mingw32_release_CFLAGS=-O1
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

mingw32_debug_CFLAGS=-O1
mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS)
mingw32_release_CFLAGS=-O3
mingw32_release_CXXFLAGS=$(mingw32_CXXFLAGS) $(mingw32_release_CFLAGS)

mingw32_debug_CFLAGS=-g -O0
mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
mingw32_debug_CXXFLAGS=$(mingw32_CXXFLAGS) $(mingw32_debug_CFLAGS)
4 changes: 2 additions & 2 deletions qa/pytest_komodo/chainconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"TONYCI": {
"rpc_user": "test",
"rpcpassword": "test",
"rpcallowip": "0.0.0.0/0",
"rpcallowip": "127.0.0.1",
"rpcport": 7000,
"port": 6000,
"rpcbind": "0.0.0.0",
"rpcbind": "127.0.0.1",
"ac_name": "TONYCI",
"ac_reward": "100000000000",
"ac_supply": "10000000000",
Expand Down
68 changes: 30 additions & 38 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DIST_SUBDIRS = secp256k1 univalue cryptoconditions

DIST_SUBDIRS = secp256k1 univalue
SUBDIRS = cryptoconditions
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
AM_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS)
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
Expand All @@ -15,7 +15,7 @@ LIBMEMENV += $(builddir)/leveldb/libmemenv.a
$(LIBLEVELDB): $(LIBMEMENV)

$(LIBLEVELDB) $(LIBMEMENV):
@echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
$(AM_V_at)$(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
OPT="$(AM_CXXFLAGS) $(PIE_FLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
endif
Expand All @@ -40,11 +40,11 @@ LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
LIBVERUS_CRYPTO=crypto/libverus_crypto.a
LIBVERUS_PORTABLE_CRYPTO=crypto/libverus_portable_crypto.a
LIBSECP256K1=secp256k1/libsecp256k1.la
LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.la
LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.a
LIBSNARK=snark/libsnark.a
LIBUNIVALUE=univalue/libunivalue.la
LIBCC=libcc.a
LIBZCASH=libzcash.a
LIBCJSON=libcjson.a

if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
Expand All @@ -55,15 +55,13 @@ endif
if BUILD_BITCOIN_LIBS
LIBZCASH_CONSENSUS=libzcashconsensus.la
endif
if ENABLE_WALLET
LIBBITCOIN_WALLET=libbitcoin_wallet.a
endif

$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "

LIBSNARK_CXXFLAGS = $(AM_CXXFLAGS) $(PIC_FLAGS) -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all
LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1
LIBSNARK_OPTFLAGS = $(CPPFLAGS) -march=x86-64
if HAVE_OPENMP
LIBSNARK_CONFIG_FLAGS += MULTICORE=1
endif
Expand All @@ -72,23 +70,14 @@ LIBSNARK_CONFIG_FLAGS += PLATFORM=darwin
endif

$(LIBSNARK): $(wildcard snark/src/*)
$(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
$(AM_V_at)CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="$(LIBSNARK_OPTFLAGS)"

libsnark-tests: $(wildcard snark/src/*)
$(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
$(AM_V_at)CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"

$(LIBUNIVALUE): $(wildcard univalue/lib/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "

$(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "

#%.o: %.c
# $(CC) -c -o $@ $<

#$(LIBCJSON): cJSON.o komodo_cJSON.o komodo_cutils.o
# $(AR) cr $(LIBCJSON) $^

# libcjson build
LIBCJSON=libcjson.a
libcjson_a_SOURCES = cJSON.c \
Expand Down Expand Up @@ -118,7 +107,7 @@ if ENABLE_PROTON
EXTRA_LIBRARIES += $(LIBBITCOIN_PROTON)
endif

lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS)
lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS) $(LIBCC)

bin_PROGRAMS =
noinst_PROGRAMS =
Expand Down Expand Up @@ -298,6 +287,7 @@ libbitcoin_server_a_SOURCES = \
cc/import.cpp \
cc/importgateway.cpp \
cc/CCassetsCore.cpp \
cc/CCcontract.cpp \
cc/CCcustom.cpp \
cc/CCtx.cpp \
cc/CCutils.cpp \
Expand Down Expand Up @@ -410,6 +400,11 @@ libbitcoin_wallet_a_SOURCES = \
$(BITCOIN_CORE_H) \
$(LIBZCASH_H)

# a shared library for cryptoconditions
libcc_a_SOURCES = cc/cclib.cpp
libcc_a_CXXFLAGS = -DBUILD_CUSTOMCC -I../secp256k1/include -I../depends/$(shell echo `../depends/config.guess`/include) -I./univalue/include -I./cryptoconditions/include -I./cryptoconditions/src -I./cryptoconditions/src/asn -I. -I./cc
libcc_a_LDFLAGS = -version-info 0:0:0

# crypto primitives library
crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
Expand Down Expand Up @@ -497,12 +492,13 @@ libbitcoin_common_a_SOURCES = \
komodo_events.cpp \
komodo_gateway.cpp \
komodo_globals.cpp \
komodo_hardfork.cpp \
komodo_interest.cpp \
komodo_jumblr.cpp \
komodo_kv.cpp \
komodo_notary.cpp \
komodo_pax.cpp \
komodo_utils.cpp \
komodo_utils.cpp \
netbase.cpp \
metrics.cpp \
primitives/block.cpp \
Expand Down Expand Up @@ -614,18 +610,9 @@ komodod_LDADD += \
$(LIBVERUS_CRYPTO) \
$(LIBVERUS_PORTABLE_CRYPTO) \
$(LIBZCASH_LIBS) \
$(LIBCC) \
-lcurl

if TARGET_DARWIN
komodod_LDADD += libcc.dylib $(LIBSECP256K1)
endif
if TARGET_WINDOWS
komodod_LDADD += libcc.dll $(LIBSECP256K1)
endif
if TARGET_LINUX
komodod_LDADD += libcc.so $(LIBSECP256K1)
endif

if ENABLE_PROTON
komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
endif
Expand Down Expand Up @@ -713,7 +700,6 @@ komodo_tx_LDADD = \
$(LIBCRYPTOCONDITIONS)

komodo_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
#

# zcash protocol primitives #
libzcash_a_SOURCES = \
Expand All @@ -733,12 +719,11 @@ libzcash_a_SOURCES = \
zcash/circuit/prfs.tcc \
zcash/circuit/utils.tcc

libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)

#libzcash_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
#libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
#libzcash_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMONTGOMERY_OUTPUT

libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 \
-DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) \
$(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) \
-Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden \
-DSTATIC $(BITCOIN_INCLUDES)
libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
Expand Down Expand Up @@ -788,6 +773,13 @@ clean-local:
-$(MAKE) -C univalue clean
rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
-rm -f config.h
-$(RM) *.a
-$(RM) crypto/*.a
-$(RM) cryptoconditions/.libs/*.a

clean-all: clean-local
-$(MAKE) -C snark clean-all
-$(MAKE) -C univalue clean-all

.rc.o:
@test -f $(WINDRES)
Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.ktest.include
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ komodo_test_SOURCES = \
test-komodo/test_addrman.cpp \
test-komodo/test_netbase_tests.cpp \
test-komodo/test_events.cpp \
test-komodo/test_hex.cpp
test-komodo/test_hex.cpp \
test-komodo/test_tokens.cpp \
test-komodo/test_heir.cpp

komodo_test_CPPFLAGS = $(komodod_CPPFLAGS)

Expand Down
22 changes: 16 additions & 6 deletions src/cc/CCGateways.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/


#ifndef CC_GATEWAYS_H
#define CC_GATEWAYS_H
#pragma once

#include "CCinclude.h"

bool GatewaysValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
UniValue GatewaysBind(const CPubKey& pk, uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4);
UniValue GatewaysDeposit(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount);
UniValue GatewaysClaim(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount);
Expand All @@ -37,4 +33,18 @@ UniValue GatewaysExternalAddress(uint256 bindtxid,CPubKey pubkey);
UniValue GatewaysDumpPrivKey(uint256 bindtxid,CKey privkey);
UniValue GatewaysList();

#endif
struct CCGatewaysContract_info : public CCcontract_info
{
CCGatewaysContract_info() : CCcontract_info()
{
evalcode = EVAL_GATEWAYS;
strcpy(unspendableCCaddr, "RKWpoK6vTRtq5b9qrRBodLkCzeURHeEk33");
strcpy(normaladdr, "RGJKV97ZN1wBfunuMt1tebiiHENNEq73Yh");
strcpy(CChexstr, "03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40");
uint8_t GatewaysCCpriv[32] = { 0xf7, 0x4b, 0x5b, 0xa2, 0x7a, 0x5e, 0x9c, 0xda, 0x89,
0xb1, 0xcb, 0xb9, 0xe6, 0x9c, 0x2c, 0x70, 0x85, 0x37, 0xdd, 0x00, 0x7a, 0x67,
0xff, 0x7c, 0x62, 0x1b, 0xe2, 0xfb, 0x04, 0x8f, 0x85, 0xbf };
memcpy(CCpriv, GatewaysCCpriv, 32);
}
virtual bool validate(Eval* eval, const CTransaction &tx, uint32_t nIn) override;
};
25 changes: 16 additions & 9 deletions src/cc/CCHeir.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,11 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/


#ifndef CC_HEIR_H
#define CC_HEIR_H
#pragma once

#include "CCinclude.h"
#include "CCtokens.h"

//#define EVAL_HEIR 0xea

bool HeirValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);

class CoinHelper;
class TokenHelper;

Expand All @@ -34,4 +27,18 @@ UniValue HeirAddCaller(uint256 fundingtxid, int64_t txfee, std::string amount);
UniValue HeirInfo(uint256 fundingtxid);
UniValue HeirList();

#endif
struct CCHeirContract_info : public CCcontract_info
{
CCHeirContract_info() : CCcontract_info()
{
evalcode = EVAL_HEIR;
strcpy(unspendableCCaddr, "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy");
strcpy(normaladdr, "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf");
strcpy(CChexstr, "03c91bef3d7cc59c3a89286833a3446b29e52a5e773f738a1ad2b09785e5f4179e");
uint8_t HeirCCpriv[32] = { 0x9d, 0xa1, 0xf8, 0xf7, 0xba, 0x0a, 0x91, 0x36, 0x89, 0x9a,
0x86, 0x30, 0x63, 0x20, 0xd7, 0xdf, 0xaa, 0x35, 0xe3, 0x99, 0x32, 0x2b, 0x63,
0xc0, 0x66, 0x9c, 0x93, 0xc4, 0x5e, 0x9d, 0xb9, 0xce };
memcpy(CCpriv, HeirCCpriv, 32);
}
virtual bool validate(Eval* eval, const CTransaction &tx, uint32_t nIn) override;
};
21 changes: 15 additions & 6 deletions src/cc/CCImportGateway.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/


#ifndef CC_IMPORTGATEWAY_H
#define CC_IMPORTGATEWAY_H
#pragma once

#include "CCinclude.h"

// CCcustom
bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx, uint32_t nIn);
bool ImportGatewayExactAmounts(bool goDeeper, struct CCcontract_info *cpTokens, int64_t &inputs, int64_t &outputs, Eval* eval, const CTransaction &tx, uint256 tokenid);
std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4);
std::string ImportGatewayDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 burntxid,int32_t burnvout,std::string rawburntx,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount);
Expand All @@ -34,4 +30,17 @@ UniValue ImportGatewayExternalAddress(uint256 bindtxid,CPubKey pubkey);
UniValue ImportGatewayDumpPrivKey(uint256 bindtxid,CKey key);
UniValue ImportGatewayList();
UniValue ImportGatewayInfo(uint256 bindtxid);
#endif

struct CCImportGatewayContract_info : public CCcontract_info
{
CCImportGatewayContract_info() : CCcontract_info()
{
evalcode = EVAL_IMPORTGATEWAY;
strcpy(unspendableCCaddr, "RXJT6CRAXHFuQ2UjqdxMj7EfrayF6UJpzZ");
strcpy(normaladdr, "RNFRho63Ddz1Rh2eGPETykrU4fA8r67S4Y");
strcpy(CChexstr, "0397231cfe04ea32d5fafb2206773ec9fba6e15c5a4e86064468bca195f7542714");
uint8_t ImportGatewayCCpriv[32] = { 0x65, 0xef, 0x27, 0xeb, 0x3d, 0xb0, 0xb4, 0xae, 0x0f, 0xbc, 0x77, 0xdb, 0xf8, 0x40, 0x48, 0x90, 0x52, 0x20, 0x9e, 0x45, 0x3b, 0x49, 0xd8, 0x97, 0x60, 0x8c, 0x27, 0x4c, 0x59, 0x46, 0xe1, 0xdf };
memcpy(CCpriv, ImportGatewayCCpriv, 32);
}
virtual bool validate(Eval* eval, const CTransaction &tx, uint32_t nIn) override;
};
Loading