Skip to content

Commit

Permalink
GH-1510 Copy over reference boot contract
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Dec 18, 2023
1 parent 84c9033 commit 021b0c3
Show file tree
Hide file tree
Showing 6 changed files with 614 additions and 0 deletions.
1 change: 1 addition & 0 deletions unittests/contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ elseif( USE_EOSIO_CDT_1_8_X )
add_definitions(-DUSE_EOSIO_CDT_1_8_X=true)
endif()

add_subdirectory(eosio.boot)
add_subdirectory(eosio.msig)
add_subdirectory(eosio.system)
add_subdirectory(eosio.token)
Expand Down
6 changes: 6 additions & 0 deletions unittests/contracts/eosio.boot/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if( EOSIO_COMPILE_TEST_CONTRACTS )
add_contract( eosio.boot eosio.boot eosio.boot.cpp )
else()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/eosio.boot.wasm ${CMAKE_CURRENT_BINARY_DIR}/eosio.boot.wasm COPYONLY )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/eosio.boot.abi ${CMAKE_CURRENT_BINARY_DIR}/eosio.boot.abi COPYONLY )
endif()
328 changes: 328 additions & 0 deletions unittests/contracts/eosio.boot/eosio.boot.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
"version": "eosio::abi/1.2",
"types": [],
"structs": [
{
"name": "activate",
"base": "",
"fields": [
{
"name": "feature_digest",
"type": "checksum256"
}
]
},
{
"name": "authority",
"base": "",
"fields": [
{
"name": "threshold",
"type": "uint32"
},
{
"name": "keys",
"type": "key_weight[]"
},
{
"name": "accounts",
"type": "permission_level_weight[]"
},
{
"name": "waits",
"type": "wait_weight[]"
}
]
},
{
"name": "canceldelay",
"base": "",
"fields": [
{
"name": "canceling_auth",
"type": "permission_level"
},
{
"name": "trx_id",
"type": "checksum256"
}
]
},
{
"name": "deleteauth",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "permission",
"type": "name"
}
]
},
{
"name": "key_weight",
"base": "",
"fields": [
{
"name": "key",
"type": "public_key"
},
{
"name": "weight",
"type": "uint16"
}
]
},
{
"name": "linkauth",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "code",
"type": "name"
},
{
"name": "type",
"type": "name"
},
{
"name": "requirement",
"type": "name"
}
]
},
{
"name": "newaccount",
"base": "",
"fields": [
{
"name": "creator",
"type": "name"
},
{
"name": "name",
"type": "name"
},
{
"name": "owner",
"type": "authority"
},
{
"name": "active",
"type": "authority"
}
]
},
{
"name": "onerror",
"base": "",
"fields": [
{
"name": "sender_id",
"type": "uint128"
},
{
"name": "sent_trx",
"type": "bytes"
}
]
},
{
"name": "permission_level",
"base": "",
"fields": [
{
"name": "actor",
"type": "name"
},
{
"name": "permission",
"type": "name"
}
]
},
{
"name": "permission_level_weight",
"base": "",
"fields": [
{
"name": "permission",
"type": "permission_level"
},
{
"name": "weight",
"type": "uint16"
}
]
},
{
"name": "reqactivated",
"base": "",
"fields": [
{
"name": "feature_digest",
"type": "checksum256"
}
]
},
{
"name": "setabi",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "abi",
"type": "bytes"
}
]
},
{
"name": "setcode",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "vmtype",
"type": "uint8"
},
{
"name": "vmversion",
"type": "uint8"
},
{
"name": "code",
"type": "bytes"
}
]
},
{
"name": "unlinkauth",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "code",
"type": "name"
},
{
"name": "type",
"type": "name"
}
]
},
{
"name": "updateauth",
"base": "",
"fields": [
{
"name": "account",
"type": "name"
},
{
"name": "permission",
"type": "name"
},
{
"name": "parent",
"type": "name"
},
{
"name": "auth",
"type": "authority"
}
]
},
{
"name": "wait_weight",
"base": "",
"fields": [
{
"name": "wait_sec",
"type": "uint32"
},
{
"name": "weight",
"type": "uint16"
}
]
}
],
"actions": [
{
"name": "activate",
"type": "activate",
"ricardian_contract": ""
},
{
"name": "canceldelay",
"type": "canceldelay",
"ricardian_contract": ""
},
{
"name": "deleteauth",
"type": "deleteauth",
"ricardian_contract": ""
},
{
"name": "linkauth",
"type": "linkauth",
"ricardian_contract": ""
},
{
"name": "newaccount",
"type": "newaccount",
"ricardian_contract": ""
},
{
"name": "onerror",
"type": "onerror",
"ricardian_contract": ""
},
{
"name": "reqactivated",
"type": "reqactivated",
"ricardian_contract": ""
},
{
"name": "setabi",
"type": "setabi",
"ricardian_contract": ""
},
{
"name": "setcode",
"type": "setcode",
"ricardian_contract": ""
},
{
"name": "unlinkauth",
"type": "unlinkauth",
"ricardian_contract": ""
},
{
"name": "updateauth",
"type": "updateauth",
"ricardian_contract": ""
}
],
"tables": [],
"ricardian_clauses": [],
"variants": [],
"action_results": []
}
19 changes: 19 additions & 0 deletions unittests/contracts/eosio.boot/eosio.boot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "eosio.boot.hpp"
#include <eosio/privileged.hpp>

namespace eosioboot {

void boot::onerror( ignore<uint128_t>, ignore<std::vector<char>> ) {
check( false, "the onerror action cannot be called directly" );
}

void boot::activate( const eosio::checksum256& feature_digest ) {
require_auth( get_self() );
eosio::preactivate_feature( feature_digest );
}

void boot::reqactivated( const eosio::checksum256& feature_digest ) {
check( eosio::is_feature_activated( feature_digest ), "protocol feature is not activated" );
}

}
Loading

0 comments on commit 021b0c3

Please sign in to comment.