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

Verification of changes in ABI-files generated during build golos.contracts #956 #957

Merged
merged 2 commits into from
Mar 17, 2020
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "cyberway.contracts"]
path = cyberway.contracts
url = https://github.com/cyberway/cyberway.contracts
[submodule "scripts/deployutils"]
path = scripts/deployutils
url = https://github.com/cyberway/deployutils.git
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ macro(install_contract TARGET)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.abi DESTINATION ${CMAKE_INSTALL_PREFIX}/${TARGET}/)
endmacro()

macro(add_contract_with_checked_abi CONTRACT_NAME TARGET ABIFILE)
add_contract(${CONTRACT_NAME} ${TARGET} ${ARGN})
get_target_property(BINOUTPUT ${TARGET}.wasm BINARY_DIR)
add_custom_command(TARGET ${TARGET}.wasm POST_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/scripts/deployutils/abiprinter.py <${BINOUTPUT}/${TARGET}.abi >${BINOUTPUT}/${TARGET}.abi.pretty)
add_custom_target(${TARGET}.abicheck ALL
COMMAND ${CYBERWAY_ABIDIFF} ${CMAKE_CURRENT_SOURCE_DIR}/${ABIFILE} ${BINOUTPUT}/${TARGET}.abi
DEPENDS ${TARGET}.wasm ${ABIFILE}
)
endmacro()

macro(add_contract_with_abi TARGET ABIFILE)
add_executable( ${TARGET}.wasm ${ARGN} )
target_compile_options( ${TARGET}.wasm PUBLIC -std=c++17)
Expand Down Expand Up @@ -65,6 +76,7 @@ if (NOT DEFINED VESTING_NAME)
endif(NOT DEFINED VESTING_NAME)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/common/config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/common/config.hpp)
set(CYBERWAY_ABIDIFF ${CYBERWAY_CDT_ROOT}/bin/cyberway-abidiff)

# include_directories(AFTER ${BOOST_ROOT}/include)
add_subdirectory(golos.ctrl)
Expand Down
2 changes: 1 addition & 1 deletion golos.charge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_contract(golos.charge golos.charge golos.charge.cpp)
add_contract_with_checked_abi(golos.charge golos.charge golos.charge.abi golos.charge.cpp)
install_contract(golos.charge)
target_include_directories(golos.charge.wasm
PUBLIC
Expand Down
151 changes: 151 additions & 0 deletions golos.charge/golos.charge.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
"version": "cyberway::abi/1.1",
"types": [
{"new_type_name": "base_t", "type": "int64"},
{"new_type_name": "enum_t", "type": "uint8"},
{"new_type_name": "index_t", "type": "uint64"}
],
"structs": [{
"name": "balance", "base": "",
"fields": [
{"name": "charge_symbol", "type": "uint64"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "last_update", "type": "uint64"},
{"name": "value", "type": "base_t"}
]
}, {
"name": "bytecode", "base": "",
"fields": [
{"name": "varssize", "type": "index_t"},
{"name": "operators", "type": "index_t[]"},
{"name": "values", "type": "value[]"},
{"name": "nums", "type": "base_t[]"},
{"name": "consts", "type": "base_t[]"}
]
}, {
"name": "chargestate", "base": "",
"fields": [
{"name": "user", "type": "name"},
{"name": "charge_symbol", "type": "uint64"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "last_update", "type": "uint64"},
{"name": "value", "type": "base_t"}
]
}, {
"name": "restorer", "base": "",
"fields": [
{"name": "charge_symbol", "type": "uint64"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "func", "type": "bytecode"},
{"name": "max_prev", "type": "base_t"},
{"name": "max_vesting", "type": "base_t"},
{"name": "max_elapsed", "type": "base_t"}
]
}, {
"name": "setrestorer", "base": "",
"fields": [
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "func_str", "type": "string"},
{"name": "max_prev", "type": "int64"},
{"name": "max_vesting", "type": "int64"},
{"name": "max_elapsed", "type": "int64"}
]
}, {
"name": "stored", "base": "",
"fields": [
{"name": "id", "type": "uint64"},
{"name": "symbol_stamp", "type": "uint128"},
{"name": "value", "type": "base_t"}
]
}, {
"name": "use", "base": "",
"fields": [
{"name": "user", "type": "name"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "price", "type": "int64"},
{"name": "cutoff", "type": "int64"},
{"name": "vesting_price", "type": "int64"}
]
}, {
"name": "usenotifygt", "base": "",
"fields": [
{"name": "user", "type": "name"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "price_arg", "type": "int64"},
{"name": "id", "type": "int64"},
{"name": "code", "type": "name"},
{"name": "action_name", "type": "name"},
{"name": "cutoff", "type": "int64"}
]
}, {
"name": "usenotifylt", "base": "",
"fields": [
{"name": "user", "type": "name"},
{"name": "token_code", "type": "symbol_code"},
{"name": "charge_id", "type": "uint8"},
{"name": "price_arg", "type": "int64"},
{"name": "id", "type": "int64"},
{"name": "code", "type": "name"},
{"name": "action_name", "type": "name"},
{"name": "cutoff", "type": "int64"}
]
}, {
"name": "value", "base": "",
"fields": [
{"name": "kind", "type": "enum_t"},
{"name": "idx", "type": "index_t"}
]
}
],
"actions": [
{"name": "setrestorer", "type": "setrestorer"},
{"name": "use", "type": "use"},
{"name": "usenotifygt", "type": "usenotifygt"},
{"name": "usenotifylt", "type": "usenotifylt"}
],
"events": [
{"name": "chargestate", "type": "chargestate"}
],
"tables": [{
"name": "balances", "type": "balance",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "charge_symbol", "order": "asc"}
]
}
]
}, {
"name": "restorers", "type": "restorer",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "charge_symbol", "order": "asc"}
]
}
]
}, {
"name": "storedvals", "type": "stored",
"indexes": [{
"name": "primary", "unique": true,
"orders": [
{"field": "id", "order": "asc"}
]
}, {
"name": "symbolstamp", "unique": true,
"orders": [
{"field": "symbol_stamp", "order": "asc"}
]
}
]
}
],
"variants": []
}
2 changes: 1 addition & 1 deletion golos.config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_contract(golos.config golos.config src/golos.config.cpp)
add_contract_with_checked_abi(golos.config golos.config golos.config.abi src/golos.config.cpp)
install_contract(golos.config)
target_include_directories(golos.config.wasm
PUBLIC
Expand Down
10 changes: 10 additions & 0 deletions golos.config/golos.config.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
"version": "cyberway::abi/1.1",
"types": [],
"structs": [],
"actions": [],
"events": [],
"tables": [],
"variants": []
}
2 changes: 1 addition & 1 deletion golos.ctrl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_contract(golos.ctrl golos.ctrl src/golos.ctrl.cpp)
add_contract_with_checked_abi(golos.ctrl golos.ctrl golos.ctrl.abi src/golos.ctrl.cpp)
install_contract(golos.ctrl)
target_include_directories(golos.ctrl.wasm
PUBLIC
Expand Down
Loading